I wanted to typeset LaTeX code directly into my document, but without it doing something, i.e., I just want to show my code in the output.
Now, I know there is the verbatim environment for code, as well as the listings package for this, but I am wondering what the best method for typesetting LaTeX code directly is (if there is one), without needing any extra packages.
A few days ago I tried to do it inside a table, and I came up with this question: Print small TeX code verbatim and render it
but still, they managed to do something different, as it automatically included the showcase.
I just want to be able to write a LaTeX code snippet easily and inside a normal environment, say, tables. What is the best way to do it?
MWE
\documentclass{report}
\usepackage{booktabs}
\begin{document}
\begin{table}[tbhp]
\centering
\caption{Citing with FEUPPHDTESES.STY}\label{tab:Citing}
\begin{tabular}{ll}
\toprule
Command & Result\\
\midrule
\texttt{citeplist} & \verb\citeplist{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\\
\texttt{citet} & \verb\citet{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\\
\texttt{citep} & \verb\citep{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\\
\texttt{citeyear} & \verb\citeyear{peel_epidemiology_2011}\\
\texttt{citeauthor} & \verb\citeauthor{peel_epidemiology_2011}\\
\texttt{citetlist} & \verb\citetlist{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\\
\texttt{citeplist} & \verb\citeplist{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

\verbcommand and theverbatimenvironment? They are available without extra packages... of course they have no syntax highlighting... – cgnieder Oct 25 '13 at 13:11tableenvironment. I'll upload a MWE. – Mario S. E. Oct 25 '13 at 13:20\verbsyntax is\verb<marker><code><marker>where<code>may not contain<marker>, e.g.,\verb+&$%#+. – cgnieder Oct 25 '13 at 13:27\verband friends are fragile; see the related http://tex.stackexchange.com/questions/203/how-to-obtain-verbatim-text-in-a-footnote – Sean Allred Oct 25 '13 at 13:27\verbcannot be used and neitherbegin{verbatim}... how can I use it? Most importantly, how did the guys that wroteThe LaTeX Companiondid it? – Mario S. E. Oct 25 '13 at 13:30\verbcorrectly, you'd have no problem:\verb|\citeyear{peel_epidemiology_2011}|– egreg Oct 25 '13 at 13:36verbatimorverb? What are the main differences or advantages? – Mario S. E. Oct 25 '13 at 13:39verbatimmakes a text block the whole\linewidthwide;\verb<char><text><char>(where<char>is not used in<text>takes just the space it needs. See http://tex.stackexchange.com/questions/86568/what-are-the-differences-between-verb-and-verbatim – egreg Oct 25 '13 at 13:40\begin{verbatim}\citeplist{peel_epidemiology_2011,espinoza2012inverse,espinoza2012optimization}\end{verbatim}– Mario S. E. Oct 25 '13 at 13:44verbatimenvironment doesn't make any sense in a cell declared to belong to anlcolumn. – egreg Oct 25 '13 at 13:46verbatiminside a table or is it impossible to useverbatiminside anlcolumn? – Mario S. E. Oct 25 '13 at 13:47