Como obter o texto inteiro no arquivo do documento de saída com a saída real?

Como obter o texto inteiro no arquivo do documento de saída com a saída real?

Considere o seguinte documento LaTeX

\documentclass{article}
\usepackage{enumerate}
\begin{document}

\begin{enumerate}[(a)]

\item Here is the 1st line.
\item Here is the 2nd line.

\end{enumerate}

\end{document}

Ele fornece a seguinte saída

(a) Aqui está a primeira linha.
(b) Aqui está a segunda linha.

No entanto, gostaria de obter a seguinte saída

\documentclass{article}
\usepackage{enumerate}
\begin{document}

\begin{enumerate}[(a)]

\item Here is the 1st line.                   (a)  Here is the 1st line.
\item Here is the 2nd line.                   (b) Here is the 2nd line            

\end{enumerate}

\end{document}

Ou seja, o lado esquerdo das colunas conterá todo o texto e o lado direito das colunas conterá a saída original do código TeX. Há alguma maneira de fazer isso?

Responder1

Aqui está o seu MWE com showexpl:

\documentclass{article}
\usepackage{enumerate}
\usepackage[final]{showexpl}

\begin{document}

\begin{LTXexample}
\begin{enumerate}[(a)]
\item Here is the 1st line.
\item Here is the 2nd line.
\end{enumerate}
\end{LTXexample}

Another possibility in Listing~\ref{ex:test}:

\begin{LTXexample}[pos=r,rframe={},caption={Test},label=ex:test]
\begin{enumerate}[(a)]
\item Here is the 1st line.
\item Here is the 2nd line.
\end{enumerate}
\end{LTXexample}

Another possibility is:

\begin{LTXexample}[pos=r,rframe=single,numbers=none,basicstyle=\ttfamily\small,]
\begin{enumerate}[(a)]
\item Here is the 1st line.
\item Here is the 2nd line.
\end{enumerate}
\end{LTXexample}

Original environment in document:
\begin{enumerate}[(a)]
\item Here is the 1st line.
\item Here is the 2nd line.
\end{enumerate}

\end{document}

Por favor, dê uma olhada nos exemplos fornecidos com esse pacote.

Voce deveria pegar: insira a descrição da imagem aqui

Responder2

insira a descrição da imagem aqui

\documentclass{article}
\usepackage{verbatim}
\usepackage{enumerate}

\begin{document}

\noindent
\begin{minipage}{.42\textwidth}
\verbatiminput{ex1.tex}
\end{minipage}
\hfill
\vrule
\hfill
\begin{minipage}{.42\textwidth}
\def\documentclass#1{}
\def\usepackage#1{}
\renewenvironment{document}{}{}
\input{ex1.tex}
\end{minipage}

\end{document}

onde ex1.texestá o seu exemplo.

informação relacionada