framed
我在将包与包组合时遇到了问题longtable
。在下面的示例中,如果我注释掉,\begin{leftbar}... \end{leftbar}
则表格可以正常工作。但是当我添加栏时,延续标题和两个页脚都会从表格中消失。
请忽略 rpt 循环(由这个答案) 以及末尾的格式问题。我只是用它来减少示例代码的行数。当我手动写出所有行时,也会出现同样的问题。
\documentclass{article}
\usepackage{longtable}
\usepackage{framed}
\usepackage{forloop}% http://ctan.org/pkg/forloop
\newcounter{loopcntr}
\newcommand{\rpt}[2][1]{%
\forloop{loopcntr}{0}{\value{loopcntr}<#1}{#2}%
}
\begin{document}
\begin{leftbar}
\begin{longtable}{|l|l|}
\hline First top & First top\\ \hline\endfirsthead
\hline Top & Top\\ \hline \endhead
\hline Last bottom & Last bottom \\ \hline \endlastfoot
\hline \multicolumn{2}{|l|}{Continued\ldots} \\ \hline \endfoot
\rpt[47]{Left & Right \\} \\
\hline
\end{longtable}
\end{leftbar}
\end{document}
答案1
framed
也许您只需在表中添加更粗的垂直线即可达到预期的结果。
\documentclass{article}
\usepackage{array}
\usepackage{longtable}
\usepackage{forloop}% http://ctan.org/pkg/forloop
\newcounter{loopcntr}
\newcommand{\rpt}[2][1]{%
\forloop{loopcntr}{0}{\value{loopcntr}<#1}{#2}%
}
\newcolumntype{?}{!{\vrule width 4pt}}% from: https://tex.stackexchange.com/a/156820/101651
\begin{document}
\begin{longtable}{?p{.2\textwidth}|l|l|p{.2\textwidth}}
\cline{2-3}
& First top & First top &\\ \cline{2-3}
\endfirsthead
\cline{2-3}
& Top & Top\\
\cline{2-3}
\endhead
\cline{2-3}
& Last bottom & Last bottom \\
\cline{2-3}
\endlastfoot
\cline{2-3} & \multicolumn{2}{|l|}{Continued\ldots} \\
\cline{2-3} \endfoot
\rpt[47]{& Left & Right \\} \\
\cline{2-3}
\end{longtable}
\end{document}
编辑:看着这个答案,我发现有changebar
一个包,我认为这正是你需要的。
\documentclass{article}
\usepackage{array}
\usepackage{longtable}
\usepackage{forloop}% http://ctan.org/pkg/forloop
\newcounter{loopcntr}
\newcommand{\rpt}[2][1]{%
\forloop{loopcntr}{0}{\value{loopcntr}<#1}{#2}%
}
\newcolumntype{?}{!{\vrule width 4pt}}% from: https://tex.stackexchange.com/a/156820/101651
\usepackage{mwe}% for testing purpose only
\usepackage[color,leftbars]{changebar}
\cbcolor{blue}
\begin{document}
\cbstart
\blindtext
\begin{longtable}{|l|l|}
\hline First top & First top\\ \hline\endfirsthead
\hline Top & Top\\ \hline \endhead
\hline Last bottom & Last bottom \\ \hline \endlastfoot
\hline \multicolumn{2}{|l|}{Continued\ldots} \\ \hline \endfoot
\rpt[47]{Left & Right \\} \\
\hline
\end{longtable}
\blindtext
\cbend
\cbcolor{red}
\cbstart
\blindtext
\begin{longtable}{|l|l|}
\hline First top & First top\\ \hline\endfirsthead
\hline Top & Top\\ \hline \endhead
\hline Last bottom & Last bottom \\ \hline \endlastfoot
\hline \multicolumn{2}{|l|}{Continued\ldots} \\ \hline \endfoot
\rpt[47]{Left & Right \\} \\
\hline
\end{longtable}
\blindtext
\cbend
\end{document}