词汇表 Longtable 布局交换和宽度调整

词汇表 Longtable 布局交换和宽度调整

我从 Christian Hupfer 那里找到了这个用于词汇表设置的漂亮代码。我想更改描述和单位的顺序(符号、单位、描述),但我找不到在交换时如何调整列宽的方法。我该怎么做才能使描述宽度比符号和单位宽度更长?

\documentclass{scrbook}                           % documentclass: scrbook
\usepackage{siunitx}
\usepackage[acronym,toc]{glossaries}              % use glossaries-package


\setlength{\glsdescwidth}{15cm}

\newglossary[slg]{symbolslist}{syi}{syg}{Symbolslist} % create add. symbolslist


\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}

\makeglossaries                                   % activate glossaries-package


% ==== EXEMPLARY ENTRY FOR SYMBOLS LIST =========================================
    \newglossaryentry{symb:Pi}{name=\ensuremath{\pi},
        description={Geometrical value},
        unit={},
        type=symbolslist}

    \newglossaryentry{height}{name=\ensuremath{h},
        description={Height of tower},
        unit={\si{m}},
        type=symbolslist}

    \newglossaryentry{energyconsump}{name=\ensuremath{P},
        description={Energy consumption},
        unit={\si{kW}},
        type=symbolslist}




% ==== EXEMPLARY ENTRY FOR ACRONYMS LIST ========================================
    \newacronym{VRBD}{VRBD}{Violet-Red-Bile-Glucose-Agar}


% ==== EXEMPLARY ENTRY FOR MAIN GLOSSARY ========================================
    \newglossaryentry{Biofouling}{name=Biofouling,description={Some description}}


\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
  \begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
  {\end{longtable}}%
%
\renewcommand*{\glossaryheader}{%  Change the table header
  \bfseries Sign & \bfseries Description & \bfseries Unit \\
  \hline
  \endhead}
\renewcommand*{\glossentry}[2]{%  Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1}  \tabularnewline
}
}


\begin{document}

    \glsaddall

    \printglossary[type=\acronymtype,style=long]  % list of acronyms
    \printglossary[type=symbolslist,style=symbunitlong]   % list of symbols
    \printglossary[type=main]                     % main glossary

\end{document}

我使用了下面的样式并且接近我需要的。

\newglossarystyle{3colger}{%
    \setglossarystyle{longragged3col}% base this style on the list style
    \renewenvironment{theglossary}{% Change the table type --> 3 columns
        \begin{longtable}{l l p{\glsdescwidth}}}%
        {\end{longtable}}%
    %
    \renewcommand*{\glossaryheader}{%  Change the table header
        \bfseries Zeichen & \bfseries Einheit & \bfseries Beschreibung \\
%       \hline
        \vspace{0.05cm}
        \endhead}
    \renewcommand*{\glossentry}[2]{%  Change the displayed items
        \glstarget{##1}{\glossentryname{##1}} %
        & \glsunit{##1} 
        &  \glossentrydesc{##1}  \tabularnewline
    }
}

剩下的问题是,如果第三列的条目太长,它就不会中断。有没有办法彻底中断?

相关内容