Latex 使用乳胶的长台面内的环境
我想创建一个新环境,在表的各个部分之间打印页眉和页脚 我这样做:Latex 使用乳胶的长台面内的环境,latex,latex-environment,longtable,Latex,Latex Environment,Longtable,我想创建一个新环境,在表的各个部分之间打印页眉和页脚 我这样做: \documentclass{article} \usepackage{longtable} \newenvironment{env}{Heading&&& \\}{\hline \\} \begin{document} \begin{longtable}{p{7cm}lrr} \begin{env} Content&b&c&d \end{en
\documentclass{article}
\usepackage{longtable}
\newenvironment{env}{Heading&&& \\}{\hline \\}
\begin{document}
\begin{longtable}{p{7cm}lrr}
\begin{env}
Content&b&c&d
\end{env}
\end{longtable}
\end{document}
但是我被编译器侮辱了。有关完整输出,请参阅
有人看到问题了吗?这里有两个问题。首先,在“
Content&b&c&d
”行的末尾需要一个\\。第二,环境在表格/长表中不起作用——这就是大多数错误消息的来源。也许骗他们去工作是可能的,但这远远超出了我的工作范围。这是我能想到的最好办法:
\documentclass{article}
\usepackage{longtable}
\newcommand{\startenv}{Heading\tabularnewline}
\newcommand{\stopenv}{\hline\tabularnewline}
\begin{document}
\begin{longtable}{p{7cm}lrr}
\startenv
Content&b&c&d \\
\stopenv
\end{longtable}
(严格来说,不必使用\tablernewline
而不是\\
,但如果您将其与其他出于自身目的而使用\
的环境混合使用,则可以避免麻烦。)