Text FormattingText without Command

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
kruftin
Posts: 7
Joined: Tue Apr 17, 2012 6:16 am

Text without Command

Post by kruftin »

Good day!

I'm interesting next question: How paste in file tex format code block, which save initial view (command will't processed by compiler).
For example I have code:
%\int_{-\infty}^{\infty} dx \exp(-x^2) = \sqrt{\pi}.
And I want that % and other symbols no processed by compiler and in pdf i see:
%\int_{-\infty}^{\infty} dx \exp(-x^2) = \sqrt{\pi}.
May be there is anything block or library for it?
Or I have one way use /% replace % ?

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Text without Command

Post by Stefan Kottwitz »

Hi kruftin,

welcome to the board!

You could use the command \verb, such as

Code: Select all

\documentclass{article}
\begin{document}
Example:

\verb|%\int_{-\infty}^{\infty} dx \exp(-x^2) = \sqrt{\pi}.|
\end{document}
verb.png
verb.png (3.41 KiB) Viewed 12453 times
or a {verbatim} environment:

Code: Select all

\documentclass{article}
\begin{document}
Example:
\begin{verbatim}
%\int_{-\infty}^{\infty} dx \exp(-x^2) = \sqrt{\pi}.
\end{verbatim}
\end{document}
Stefan
LaTeX.org admin
kruftin
Posts: 7
Joined: Tue Apr 17, 2012 6:16 am

Text without Command

Post by kruftin »

Thanks for answer.
And how i can disable non processing input in the block begin{verbatim} end{verbatim}?
If i want use usual format of tex? There is else from:

Code: Select all

/begin{verbatim} 
text input
/end{verbatim}
usual text in tex
/begin{verbatim}
text input
/end{verbatim}
Last edited by Stefan Kottwitz on Wed Apr 18, 2012 8:55 am, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Text without Command

Post by Stefan Kottwitz »

Just end the verbatim environment so that input is normally processed by TeX.
Btw. commands begin with a backslash \, not a slash /.

Stefan
LaTeX.org admin
Post Reply