Text FormattingDisplay verbatim LaTeX Command in Output

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
man2011
Posts: 43
Joined: Tue Jan 11, 2011 4:19 am

Display verbatim LaTeX Command in Output

Post by man2011 »

Dear All,

I am preparing a slide to be used for teaching how LaTeX is used. And I need to type a LaTeX command and explain it like the following.

Code: Select all

\begin{quotation}
\end{quotation}
I want the LaTeX command to be shown in the PDF view so I can explain the LaTeX command to the audience?


Thanks a lot

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Display verbatim LaTeX Command in Output

Post by localghost »

The very basic solution would be to use the verbatim environment for longer pieces of code and to use the \verb|…| command for in-line display of single commands. There are some enhancements by packages.
  • fancyvrb
  • moreverb
For more sophisticated display of complete code listings it is suggestive to use packages with appropriate capabilities.
  • listings
  • minted
For display of LaTeX code along with the corresponding output there is the showexpl package.


Thorsten
Post Reply