簡體   English   中英

在LaTeX中臨時更改文檔類/重置pdfLaTeX

[英]Temporarily changing document class in LaTeX/resetting pdfLaTeX

如何暫時使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使用它也是如此

我認為最簡單的方法是編譯一些小文檔,然后將生成的pdf作為圖像包含在較大的文檔中。 即使不是您想要的,也要簡單得多。 我這樣做是為了在Beamer演示中展示LaTeX文章的外觀。

當然,如果要在投影儀中包含一個非常簡單的文檔(例如,一個簡單的文本塊),我建議您使用包含某些文本的TikZ“圖片”模仿該文檔。

也許是另一種方法:與其試圖像在文章中那樣對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}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM