I'm using the glossaries
package to allow for managing acronyms in a document of mine. Separately, I've also defined a very specific table format (accessed via the \doctable
command) which forces all tables in the document to have the same formatting for consistency and allows for defining tables more simply by only providing the content.
I was then able to integrate these two feature together by forcing the glossaries acronym style to use that table to output the acronym table. The problem I'm running into now is in cases when I've got so many acronyms that my table runs longer than a single page (see image below). How do I handle such a case? Can I somehow break up the table when it is too long?
Note, I've seen things like this question which suggest using ltablex
but for my case this doesn't seem to work since the table uses column width formatting.
MWE
Sorry for the long example, but I had to add enough glossary entries to get the effect I wanted to show.
\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}