我怎样才能将原始文本插入到投影仪框架中,同时保留该部分的格式?

我怎样才能将原始文本插入到投影仪框架中,同时保留该部分的格式?
\documentclass{beamer}
\begin{document}
\newcommand{\origintext}[??]{?????}         %<-------------How ?
\section{aaa}

\subsection{bbb}


%%%%%%%%%%%%%%%%%%%  frame 1


\frame{test frame 1}


%%%%%%%%%%%%%%%%%%%%%%% frame 2

\origintext{

\section*{sec title}

\subsection*{subsec title}

sadsadf
asfsaf


asfasf

}

%%%%%%%%%%%%%%%%%%%%%%%%  frame

\frame{test frame 3}

\end{document}

非常感谢!@cfr @barbara beeton @Christian Hupfer。是的,我想显示另一个 .tex 文件中的内容\documentclass{article},希望看起来像结果 pdf 文件。\section*{}生成粗体大字体...Barbara Beeton 提供了一种方法,但我想直接生成它

\documentclass{article}
\begin{document}
\section*{sec title}

\subsection*{subsec title}

sadsadf
asfsaf


asfasf
\end{document}

答案1

你可以尝试一下

\documentclass{beamer}
\makeatletter
\newcommand{\origintext}[1]{%
\begingroup
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
#1
\endgroup}
\makeatother
\begin{document}

\section{aaa}

\subsection{bbb}


%%%%%%%%%%%%%%%%%%%  frame 1


\frame{test frame 1}


%%%%%%%%%%%%%%%%%%%%%%% frame 2
\frame{
\origintext{

\section*{sec title}

\subsection*{subsec title}

sadsadf
asfsaf


asfasf

}}

%%%%%%%%%%%%%%%%%%%%%%%%  frame

\frame{test frame 3}

\end{document}

相关内容