參考這個郵政,我嘗試使我的符號列表適應我的縮寫列表。
縮寫表
% 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}