
다음 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) 첫 번째 줄은 다음과 같습니다.
(b) 여기 두 번째 줄이 있습니다.
그러나 다음과 같은 결과를 얻고 싶습니다.
\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
당신의 예는 어디에 있습니까?