[Tex/LaTex] Quote verbatim in Latex

math-modeverbatim

I would like to quote some passages using the quote environment. However the quoted passage contains some math mode equations written in text format like "Your paper is worthless because x^2 +y^2 = 0." I would like to be able to quote this as is, without using the math-mode. Is there something like a mixture of verbatim and quote environments so that I don't have to go through every instance of such equations and replace them with something like \verb*x^2+y^2=0*? Something perhaps with some flexibility in the choice of fonts too.

EDIT: Basically, what I want is all the text-handling capabilities of LaTeX for the quoted text, while treating things like a^2+b^2 = 0 as is, just some characters to be displayed verbatim. I don't know if this is achievable without surrounding a^2+b^2=0 or the like with special characters.

Best Answer

You can set this "verbatim quote" as a regular listing. Below I defined a new listing verbquote:

enter image description here

\documentclass{article}

\usepackage{listings,lipsum}

\lstnewenvironment{verbquote}[1][]
  {\lstset{columns=fullflexible,
           basicstyle=\ttfamily,
           xleftmargin=2em,
           xrightmargin=2em,
           breaklines,
           breakindent=0pt,
           #1}}% \begin{verbquote}[..]
  {}% \end{verbquote}

\begin{document}

\lipsum[1]

\begin{verbquote}
Your paper is worthless because x^2 + y^2 = 0. Please reconsider what you are attempting.
\lipsum[2]
\end{verbquote}

\lipsum[2]

\end{document}

All content within verbquote will be set as-is. You can change the font (or any other styles) using any of the options provided for listings.


You can also just reset the category codes of active keys that could cause problems to print them as "other" (category code 12):

enter image description here

\documentclass{article}

\usepackage{lipsum}
\usepackage[T1]{fontenc}% http://tex.stackexchange.com/q/48632/5764

\newenvironment{verbquote}
  {\catcode `^=12% Math superscript
   \catcode `_=12% Math subscript
   \catcode `$=12% Math deliniation
   \begin{quote}}
  {\end{quote}}


\begin{document}

\lipsum[1]

\begin{verbquote}
Your paper is worthless because x^2 + y_2 = 0 or about $0. Please reconsider what you are attempting.
\end{verbquote}

\lipsum[2]

\end{document}
Related Question