[Tex/LaTex] Beginner’s problem – Undefined control sequence

symbols

I'm trying to produce the following result:

[/ or ?] – Search for a pattern of text, jump to it by hitting Enter

Then, I tried the following:
\item [\/ or \?] - Search for a pattern of text, jump to it by hitting Enter

But then, I get an "Undefined control sequence."

What am I doing wrong?

Best Answer

Neither \/ nor \? are control sequences in LaTeX*, causing the error. Instead, you're probably looking for:

enter image description here

\documentclass{article}
\begin{document}
\begin{description}
  \item [\texttt{/} or \texttt{?}] - Search for a pattern of text, jump to it by hitting Enter
\end{description}
\end{document}

The above minimal example typesets / and ? in a monospaced Computer Modern (or typewriter-style) font, within the description environment's \item. Not sure what exactly your context is, but if you want to include the square brackets [...], use

\item [{[\texttt{/} or \texttt{?}]}] ...

instead. This puts the contents of the \item's optional argument in a group, rather than confusing TeX in using unmatched brackets and causing spacing problems:

enter image description here

* Well, \/ is a control sequence (using as an italic correction), but not the one you're after...

Related Question