参考此邮政,我尝试使我的符号列表适应我的缩写列表。
缩略语表
% Setup list of abbreviations
\newglossarystyle{mylong}{
\setglossarystyle{long}
\renewenvironment{theglossary}{\vspace{-3mm}\begin{longtable*}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{0.8\hsize}}}{\end{longtable*}}}
\printglossary[style=mylong,type=\acronymtype,title=Abkürzungsverzeichnis]
现在我想对我的符号列表实现非常相似的呈现。
符号列表
\newglossary{symbolslist}{syi}{syg}{}
\glsaddstoragekey{unit}{}{\glsentryunit}
\newglossarystyle{symbunitlong}{
\setglossarystyle{long3col}
\renewenvironment{theglossary}{\vspace{-3mm}
\begin{longtable*}[l]{lp{\glsdescwidth}>{\arraybackslash}p{1cm}}}{\end{longtable*}}
\renewcommand*{\glossentry}[2]{
\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentryunit{##1}\\
}
}
\printunsrtglossary[type=symbols,style=symbunitlong,title=Symbolverzeichnis]
如何使符号列表左对齐以及如何使符号之间的距离适应 CAD 到 CRC 的距离?
编辑1
为了解决垂直距离的问题,我只需要向新符号的定义添加排序属性,如下所示:
\glsxtrnewsymbol[
description={test1},
unit={m},
sort={a}]
{y}{y}
感谢@leandriis,更多信息请参见此处邮政。
编辑2
如果我像@leandriis 提到的那样将行更改为此
\begin{longtable*}[l]{@{}lp{\glsdescwidth}>{\arraybackslash}p{1cm}}}{\end{longtable*}}
看起来更好,但并不完美
编辑3
平均能量损失
\documentclass[]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[binary-units=true,locale = DE]{siunitx}
\usepackage{caption}
\usepackage[nonumberlist,acronym,toc,symbols,nomain]{glossaries-extra}
\usepackage{showframe} % just for the example
% Setup list of abbreviations
\newglossarystyle{mylong}{
\setglossarystyle{long}
\renewenvironment{theglossary}{%
\vspace{-3mm}%
\begin{longtable*}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{\dimexpr\textwidth-\tabcolsep-2cm}@{}}%
}{\end{longtable*}}
}
\setabbreviationstyle[acronym]{long-short}
\newacronym[
plural={Test},
firstplural={Test (Test)},
description={Test}]
{Test}{Test}{Test}
\newacronym[
plural={Test1},
firstplural={Test1 (Test1)},
description={Test1}]
{Test1}{Test1}{Test1}
% Setup list of symbols
\newglossary{symbolslist}{syi}{syg}{}
\glsaddstoragekey{unit}{}{\glsentryunit}
\newglossarystyle{symbunitlong}{
\setglossarystyle{long3col}
\renewenvironment{theglossary}{\vspace{-3mm}\begin{longtable*}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{\glsdescwidth}>{\arraybackslash}p{1cm}}}{\end{longtable*}}
\renewcommand*{\glossentry}[2]{
\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentryunit{##1}\\
}
}
\glsxtrnewsymbol[
description={test0},
unit={m},
sort={a}]
{x}{x}
\glsxtrnewsymbol[
description={test1},
unit={m},
sort={a}]
{y}{y}
\makeglossaries
\glsadd{x}
\glsadd{y}
\glsadd{Test}
\glsadd{Test1}
\begin{document}
\printglossary[type=\acronymtype,style=mylong,title=Abkürzungsverzeichnis]
\printunsrtglossary[type=symbols,style=symbunitlong,title=Symbolverzeichnis]
\end{document}
结果
答案1
不要猜测宽度并重新定义左边的距离:
\documentclass[]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[binary-units=true,locale = DE]{siunitx}
\usepackage{caption}
\usepackage[nonumberlist,acronym,toc,symbols,nomain]{glossaries-extra}
\usepackage{showframe} % just for the example
% Setup list of abbreviations
\newglossarystyle{mylong}{
\setglossarystyle{long}
\renewenvironment{theglossary}{%
\vspace{-3mm}%
\begin{longtable*}{
@{}
p{\dimexpr 2cm-\tabcolsep}
p{\dimexpr\textwidth-\tabcolsep-2cm}
@{}
}%
}{\end{longtable*}}
}
\setabbreviationstyle[acronym]{long-short}
% Setup list of symbols
\newglossary{symbolslist}{syi}{syg}{}
\glsaddstoragekey{unit}{}{\glsentryunit}
\newglossarystyle{symbunitlong}{
\setglossarystyle{long3col}%
\renewenvironment{theglossary}{%
\vspace{-3mm}%
\setlength{\LTleft}{0pt}%
\begin{longtable*}{%
@{}
p{\dimexpr 2cm-\tabcolsep}
p{\glsdescwidth}
r
@{}
}%
}{\end{longtable*}}
\renewcommand*{\glossentry}[2]{%
\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentryunit{##1}\\
}%
}
\newacronym[
plural={Test},
firstplural={Test (Test)},
description={Test}]
{Test}{Test}{Test}
\newacronym[
plural={Test1},
firstplural={Test1 (Test1)},
description={Test1}]
{Test1}{Test1}{Test1}
\glsxtrnewsymbol[
description={test0},
unit={m},
sort={a}]
{x}{x}
\glsxtrnewsymbol[
description={test1},
unit={m},
sort={a}]
{y}{y}
\makeglossaries
\glsadd{x}
\glsadd{y}
\glsadd{Test}
\glsadd{Test1}
\begin{document}
\printglossary[type=\acronymtype,style=mylong,title=Abkürzungsverzeichnis]
\printunsrtglossary[type=symbols,style=symbunitlong,title=Symbolverzeichnis]
\end{document}
别忘了\usepackage[T1]{fontenc}