我正在使用该glossaries
软件包来管理我的文档中的首字母缩略词。另外,我还定义了一种非常具体的表格格式(通过命令访问\doctable
),该格式强制文档中的所有表格具有相同的格式以保持一致性,并且仅通过提供内容就可以更简单地定义表格。
然后,我能够通过强制词汇表首字母缩略词样式使用该表来输出首字母缩略词表,将这两个功能整合在一起。我现在遇到的问题是,当我有太多首字母缩略词时,我的表格会超过一页(见下图)。我该如何处理这种情况?当表格太长时,我能以某种方式拆分表格吗?
请注意,我见过类似的事情这个问题建议使用ltablex
,但就我的情况而言,这似乎不起作用,因为表使用列宽格式。
平均能量损失
抱歉,例子太长了,但我必须添加足够的词汇表条目才能达到我想要的效果。
\documentclass{article}
%%% PREAMBLE %%%
% Use packages
\usepackage[table,dvipsnames]{xcolor} % Provides coloring for tables and text
\usepackage{tabularx} % Customized table formatting
\usepackage{environ} % Used to define custom table environment
\usepackage[acronym]{glossaries} % Handles acronym and abbreviation creations and usage
% Table preamble
% Defines an environment to create a table in the document according to
% a common formatting. This uses the environ package.
\NewEnviron{doctable}[1]{%
\begin{table}[!htbp]
\centering
\rowcolors{2}{black!5}{black!15}
\caption{#1}
\begin{tabularx}{\linewidth}{L{0.2}|L{0.8}<{\clearrow}}
\hline
\rowcolor{greyblue} \setrow{\bfseries} % Make the header row bold and colored grey-blue
\BODY
\hline
\end{tabularx}
\label{tbl:acronym}
\end{table}
}
\definecolor{greyblue}{rgb}{0.6353,0.6863,0.7686} % Define a color used in the tables
\newcommand\setrow[1]{\gdef\rowmac{#1}#1\ignorespaces} % Used for making a row bold
\newcommand\clearrow{\global\let\rowmac\relax} \clearrow % Used for clearing a row formatting
\newcolumntype{C}[1]{>{\hsize=#1\hsize\rowmac\centering\arraybackslash}X} % Centered column, input is relative width of page
\newcolumntype{L}[1]{>{\hsize=#1\hsize\rowmac\raggedright\arraybackslash}X} % Left-aligned column, input is relative width of page
\newcolumntype{R}[1]{>{\hsize=#1\hsize\rowmac\raggedleft\arraybackslash}X} % Right-aligned column, input is relative width of page
\newcolumntype{T}{} % Define a new column type which is temporary
% Define a set of commands for redfining a column type, to be used to redefine the temporary T column type.
\newcommand{\undefcolumntype}[1]{\expandafter\let\csname NC@find@#1\endcsname\relax}
\newcommand{\forcenewcolumntype}[1]{\undefcolumntype{#1}\newcolumntype{#1}}
% Glossary preamble
\makenoidxglossaries % Create our glossaries
\newcommand{\acronymtable}{\printnoidxglossary[type=\acronymtype,style=acronymstyle]}
% The style to use in creating the acronym table
\newglossarystyle{acronymstyle}
{%
\renewenvironment{theglossary}
{%
\doctable{Acronyms}
Acronym & Description \\
}{
\enddoctable
}
\renewcommand{\glossarysection}[2][]{}
\renewcommand*{\glossaryheader}{}%
% Don't do anything between letter groups
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glsgroupskip}{}%
% Set display for each the acronym entry
\renewcommand{\glossentry}[2]{%
\glstarget{##1}{\glsentryshort{##1}}% short form
&
\glsentrylong{##1}% long form
\\% end of row
}%
}
\newacronym{abc1}{abc1}{alphabet1}
\newacronym{abc2}{abc2}{alphabet2}
\newacronym{abc3}{abc3}{alphabet3}
\newacronym{abc4}{abc4}{alphabet4}
\newacronym{abc5}{abc5}{alphabet5}
\newacronym{abc6}{abc6}{alphabet6}
\newacronym{abc7}{abc7}{alphabet7}
\newacronym{abc8}{abc8}{alphabet8}
\newacronym{abc9}{abc9}{alphabet9}
\newacronym{abc10}{abc10}{alphabet10}
\newacronym{abc11}{abc11}{alphabet11}
\newacronym{abc12}{abc12}{alphabet12}
\newacronym{abc13}{abc13}{alphabet13}
\newacronym{abc14}{abc14}{alphabet14}
\newacronym{abc15}{abc15}{alphabet15}
\newacronym{abc16}{abc16}{alphabet16}
\newacronym{abc17}{abc17}{alphabet17}
\newacronym{abc18}{abc18}{alphabet18}
\newacronym{abc19}{abc19}{alphabet19}
\newacronym{abc20}{abc20}{alphabet20}
\newacronym{abc21}{abc21}{alphabet21}
\newacronym{abc22}{abc22}{alphabet22}
\newacronym{abc23}{abc23}{alphabet23}
\newacronym{abc24}{abc24}{alphabet24}
\newacronym{abc25}{abc25}{alphabet25}
\newacronym{abc26}{abc26}{alphabet26}
\newacronym{abc27}{abc27}{alphabet27}
\newacronym{abc28}{abc28}{alphabet28}
\newacronym{abc29}{abc29}{alphabet29}
\newacronym{abc30}{abc30}{alphabet30}
\newacronym{abc31}{abc31}{alphabet31}
\newacronym{abc32}{abc32}{alphabet32}
\newacronym{abc33}{abc33}{alphabet33}
\newacronym{abc34}{abc34}{alphabet34}
\newacronym{abc35}{abc35}{alphabet35}
\newacronym{abc36}{abc36}{alphabet36}
\newacronym{abc37}{abc37}{alphabet37}
\newacronym{abc38}{abc38}{alphabet38}
\newacronym{abc39}{abc39}{alphabet39}
\newacronym{abc40}{abc40}{alphabet40}
\newacronym{abc41}{abc41}{alphabet41}
\newacronym{abc42}{abc42}{alphabet42}
\newacronym{abc43}{abc43}{alphabet43}
\newacronym{abc44}{abc44}{alphabet44}
\newacronym{abc45}{abc45}{alphabet45}
\newacronym{abc46}{abc46}{alphabet46}
\newacronym{abc47}{abc47}{alphabet47}
\newacronym{abc48}{abc48}{alphabet48}
\newacronym{abc49}{abc49}{alphabet49}
%%% DOCUMENT %%%
\begin{document}
\gls{abc1} \gls{abc2} \gls{abc3} \gls{abc4} \gls{abc5} \gls{abc6} \gls{abc7} \gls{abc8} \gls{abc9} \gls{abc10} \gls{abc11} \gls{abc12} \gls{abc13} \gls{abc14} \gls{abc15} \gls{abc16} \gls{abc17} \gls{abc18} \gls{abc19} \gls{abc20} \gls{abc21} \gls{abc22} \gls{abc23} \gls{abc24} \gls{abc25} \gls{abc26} \gls{abc27} \gls{abc28} \gls{abc29} \gls{abc30} \gls{abc31} \gls{abc32} \gls{abc33} \gls{abc34} \gls{abc35} \gls{abc36} \gls{abc37} \gls{abc38} \gls{abc39} \gls{abc40} \gls{abc41} \gls{abc42} \gls{abc43} \gls{abc44} \gls{abc45} \gls{abc46} \gls{abc47} \gls{abc48} \gls{abc49}
\acronymtable
\end{document}
答案1
您的问题只是浮点数的使用。使用ltablex
以下代码可以解决您的问题。
更新:由于 zephyr 发现ltablex
的功能之一是消除列类型的布局,X
以免与其他布局选项冲突。因此您需要发出\keepXColumns
以保留所需的布局。
\NewEnviron{doctable}[1]{%
\centering
\rowcolors{2}{black!5}{black!15}
\begin{tabularx}{\linewidth}{L{0.2}|L{0.8}<{\clearrow}}
\caption{#1}\\
\hline
\rowcolor{greyblue} \setrow{\bfseries} % Make the header row bold and colored grey-blue
\BODY
\hline
\end{tabularx}
\label{tbl:acronym}
}