
Рассмотрим следующий документ 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}
Это дает следующий вывод
(a) Вот 1-я строка.
(b) Вот 2-я строка.
Однако я хотел бы получить следующий результат
\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}
То есть левая часть столбцов будет содержать весь текст, а правая часть столбцов будет содержать исходный вывод кода TeX. Есть ли способ сделать это?
решение1
Вот ваш MWE с 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}
Ознакомьтесь, пожалуйста, с примерами, прилагаемыми к этому пакету.
Вы должны получить:
решение2
\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}
где ex1.tex
ваш пример.