暂时更改LaTeX中的文档类/重置pdfLaTeX

问题描述 投票:1回答:2

我怎么能暂时让pdfLaTeX忘记我告诉过的所有内容并从一个新的文档类开始?

我已经从lshort文档修改了示例环境:

\newwrite\examplesx@out
\newenvironment{examplesx}{%
  \begingroup% Lets Keep the Changes Local
    \@bsphack
    \immediate\openout \examplesx@out \jobname.exa
    \let\do\@makeother\dospecials\catcode`\^^M\active
    \def\verbatim@processline{%
      \immediate\write\examplesx@out{\the\verbatim@line}}%
    \verbatim@start
  }{%
  \immediate\closeout\examplesx@out\@esphack\endgroup%
  \noindent\makebox[\textwidth][l]{%
    \begin{minipage}[c]{0.45\textwidth}%
      \small\verbatiminput{\jobname.exa}
    \end{minipage}%
    \hspace*{0.1\textwidth}%
    \framebox{%
      \begin{minipage}{0.45\textwidth}%
        \small\input{\jobname.exa}%
      \end{minipage}
    }%
  }\vspace*{\parskip}%
}

它主要起作用,但我希望能够做类似的事情

\begin{examplesx}
\section{Section}
\end{examplesx}

并将其显示为框中的一个部分。我也希望它使用标准的article样式排版列表,即使我在beamer中使用它

latex pdflatex
2个回答
0
投票

我认为最简单的方法是编译一些小文档,然后将结果pdf作为图像包含在更大的文档中。即使不完全是你想要的,也要简单得多。我这样做是为了在Beamer演示中展示LaTeX文章的样子。

当然如果它是一个真正的简单文档(例如,一个简单的文本块),你想要在内部投影,我可以建议你用包含一些文本的TikZ“图片”模仿文档。


0
投票

也许是另一种方法:不是试图在beamer中排版事物,就好像它们将在文章中完成一样,只需将它们与文章文档类一起排版,并将结果包含在beamer文档中。

使用tcolorbox,这可以自动完成:

% !TeX program = txs:///arara
% arara: pdflatex: {synctex: on, interaction: nonstopmode, shell: yes}

\documentclass{beamer}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{frame}[fragile]

\begin{tcblisting}{
    comment only,
  pdf comment,
  compilable listing,
  run pdflatex,
}
\documentclass{article}
\begin{document}
\section{Section Title}
test
\end{document}
\end{tcblisting}

\end{frame}

\end{document}
© www.soinside.com 2019 - 2024. All rights reserved.