词汇表和错误的边距

词汇表和错误的边距

我复制粘贴了一位朋友的词汇表,用于我的论文。我不得不承认,我完全不明白那一节发生了什么。我只知道词汇表的右边距太宽了。我不确定是什么原因造成的,因为朋友的文件中的示例是有效的。所以也许你可以通过找出这里明显的错误来提供帮助。

这是我的例子:

\documentclass[a4paper,12pt,twoside]{report}
\raggedbottom

%Einstellungen.....................
% Formatierungseinstellungen

\usepackage[colorinlistoftodos]{todonotes} %Erzeugt Kommentare mittels \todo{} in der .pdf
\usepackage{setspace}
\usepackage{notoccite} %Damit Zitate im Abbildungskapitel nicht die Reihenfolge versauen
\usepackage{MnSymbol}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{siunitx}
\usepackage{blindtext}
\usepackage{fancyhdr} % Package für Kopf- und Fußzeilen
    \pagestyle{fancyplain} % Kopfzeilen definieren
        \renewcommand{\chaptermark}[1]{\markboth{\thechapter \hspace{3mm}#1}{}}
        \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
        \cfoot[\fancyplain{}{}]{\fancyplain{}{}}
        \lhead[\fancyplain{}{\small\sl\thepage}]
        {\fancyplain{}{\small\sl\leftmark}}
        \rhead[\fancyplain{}{\small\sl\rightmark}]
        {\fancyplain{}{\small\sl\thepage}}
        \renewcommand{\footrulewidth}{0pt}
        \setlength{\headheight}{15pt}
\usepackage[nottoc]{tocbibind}
\usepackage[nohyperlinks, printonlyused, withpage]{acronym}
\usepackage{suffix} %Gehört irgendwie mit zu {acronym}
\usepackage{xstring} %Gehört irgendwie mit zu {acronym}
\usepackage{relsize} %Gehört irgendwie mit zu {acronym}
\usepackage{graphicx} %Ich glaube, damit man Grafiken adden kann
    \graphicspath{{./Images/}} %Unterordner Images
\usepackage{tikz}
\usepackage{xcolor,colortbl} %Für farbige Tabellen
    \definecolor{myOrange}{HTML}{ed7d31}
    \definecolor{myRed}{HTML}{d60000}
    \definecolor{myYellow}{HTML}{ffc000}
\usepackage{array} %Für Tabellen
\usepackage{multirow} %Für komplexe Tabellen
\usepackage{subcaption} %Mehre Bilder nebeneinander
\usepackage{epstopdf} %package to overcome problem with eps in pdf files
%\usepackage{cite} %Damit man mit Citavi zitieren kann. Wird mit Biblatex nicht benötigt
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
    \DeclareUnicodeCharacter{2215}{/} %Behebung eines random Fehlers wo "/" nicht erkannt wurde
\usepackage[labelfont=bf]{caption}% u. a. für \captionof
    \captionsetup[figure]{font=small}
\usepackage{mwe}    
\usepackage{float} %Wichtig um die floats von Bildern und Tabellen zu ändern
\usepackage[section]{placeins}
\usepackage{amsfonts} %Für Formeln
\usepackage{amsmath} %Für Formeln
\usepackage{mathtools} %Für Formeln
    \DeclarePairedDelimiter\abs{\lvert}{\rvert}%
    \DeclarePairedDelimiter\norm{\lVert}{\rVert}%
    % Swap the definition of \abs* and \norm*, so that \abs
    % and \norm resizes the size of the brackets, and the 
    % starred version does not.
    \makeatletter
    \let\oldabs\abs
    \def\abs{\@ifstar{\oldabs}{\oldabs*}}
    \let\oldnorm\norm
    \def\norm{\@ifstar{\oldnorm}{\oldnorm*}}
    \makeatother
\usepackage{color,soul}

%Glossaries----------------------------------
\usepackage[
nopostdot,      %kein Punkt hinten
nonumberlist, %keine Seitenzahlen anzeigen
acronym,      %ein Abkürzungsverzeichnis erstellen
%toc,          %Einträge im Inhaltsverzeichnis
nogroupskip,    %kein Abstand zwischen 
section]      %im Inhaltsverzeichnis auf section-Ebene erscheinen
{glossaries}
\AtBeginDocument{\setlength{\glsdescwidth}{.85\columnwidth}} %für Zeilenumbrüche im Abkürzungsverzeichnis
\usepackage{xassoccnt} %Damit man Seiten zählen kann
    \newcounter{realpage}
    \DeclareAssociatedCounters{page}{realpage}
    \AtBeginDocument{%
        \stepcounter{realpage}
    }
    
\newglossary[mlg]{mater}{myi}{myg}{Elemente und Materialien}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbole}

\setlength{\glsdescwidth}{15cm}
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}

\makeglossaries
%\loadglsentries {Kapitel/ASE.tex}

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


%Alle globalen document settings hier rein-----------------------------------------------
\setlength\parindent{0pt} %Wenn man keine Indentation haben möchte einfahc auf 0 setzen
\onehalfspacing %Zeilenabstand des Dokuments
\pagestyle{fancy} %Seitenzahlen abwechselnd rechts/links im header

%Literaturverzeichnis mit Biblatex/biber-----------------------------------------------
\usepackage[autostyle]{csquotes}  %für biblatex
\usepackage{xpatch}
\usepackage[backend=biber, maxnames=20, style=nature, autocite=superscript, isbn=false, intitle=true, url=false, doi=false, natbib=true, eprint=false]{biblatex}
\setlength{\bibitemsep}{0.5\baselineskip} 
\addbibresource{Literaturverzeichnis.bib}
%\bibliographystyle{unsrt} %Literaturverzeichnis mit Citavi; (plain, unsrt, abbrv, alpha)
%\bibliography{Literaturverzeichnis}

\makeatother %???
\numberwithin{equation}{section} % Integriert Kapitelnummer in Formeln

%Commands hier rein
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
    \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newcommand{\angstrom}{\textup{\AA}}

\usepackage{hyperref} %Alles was mit Hyperlinks zu tun hat
    \hypersetup{
        colorlinks = true,
        linkcolor = black,
        anchorcolor = blue,
        citecolor = blue,
        filecolor = blue,
        urlcolor = blue
        }
        \addto\extrasngerman{\def\subsectionautorefname{Kapitel}} %Definition "Kapitel" bei autoref von subsection  
        \addto\extrasngerman{\def\sectionautorefname{Kapitel}} %Definition "Kapitel" bei autoref von section
\usepackage{cleveref}   


\begin{document}
\pagestyle{fancyplain} 
\pagenumbering{Roman} 
    
%%%%%%%%%%%%%%%%%%% Abkürzungen %%%%%%%%%%%%%
\newglossaryentry{MIGS}{type=acronym, name={MIGS},
description={Metall induzierte Bandlückenzustände (\textit{engl.} Metal Induced Gap States (MIGS)},
first={MIGS}}
\newglossaryentry{UVO}{type=acronym, name={UVO},
description={Ultraviolett-Ozon},
first={UVO}}
\newglossaryentry{MQW}{type=acronym, name={MQW},
description={multiple Quantentöpfe (engl. \textit{multiple quantum well})},
first={multiple Quantentöpfe (MQW)}}
\newglossaryentry{TCF}{type=acronym, name={TCF},
description={transparente, leitfähige Schicht/Elektrode (engl. \textit{transparent conducting film}},
first={transparente, leitfähige Schicht/Elektrode (TCF)}}           
\newglossaryentry{TL}{type=acronym, name={T$_L$},
description={Transferlänge},
first={Transferlänge (T$_L$)}}
\newglossaryentry{IIINitride}{type=acronym, name={III-Nitride},
description={Halbleiterverbindung aus Elementen der III. Hauptgruppe des Periodensystems und Stickstoff},
first={III-Nitride}}
\newglossaryentry{MOVPE}{type=acronym, name={MOVPE},
description={Metallorganische Gasphasenepitaxie (engl. \textit{metal organic chemical vapor phase epitaxy})},
first={metallorganische Gasphasenepitaxie (MOVPE)}}
\newglossaryentry{PID}{type=acronym,name={PID-Regelkreis},
description={PID-Regelkreis (engl. \textit{proportional-integral-derivative controller})},
first={PID-Regelkreis (engl. \textit{proportional-integral-derivative controller}, PID-controller})}
%%%%%%%%%% Symbole %%%%%%%%%%%%%%%
\newglossaryentry{symb:a0}{type=acronym, name={$a_0$},
description={Gitterkonstante von GaN in \textit{a}-Richtung},
first={$a_0$}, unit={$nm$}, type=symbolslist}
\newglossaryentry{symb:c0}{type=acronym, name={$c_0$},
description={Gitterkonstante von GaN in \textit{c}-Richtung},
first={$c_0$}, unit={$nm$}, type=symbolslist}
\newglossaryentry{symb:RhoMGrpGaN}{type=acronym, name={$\rho_{M/Gr/p-GaN}$},
description={Summe der spez. Kontaktwiderstände zwischen Metallkontakt, Graphen und \textit{p}-GaN},
first={$\rho_{M/Gr/p-GaN}$}, unit={$\Omega cm^2$}, type=symbolslist}
\newglossaryentry{symb:RhoGrpGaN}{type=acronym, name={$\rho_{Gr/p-GaN}$},
description={spez. Kontaktwiderstand zwischen Graphen und \textit{p}-GaN},
first={$\rho_{M/p-GaN}$}, unit={$\Omega cm^2$}, type=symbolslist}
%%%%%%%%%% Elemente und Materialien %%%%%%%%%%%%%%%
\newglossaryentry{H2O}{name={H$_2$O},
description={Wasser-Molekül}, first={H$_2$O}, type=mater}
\newglossaryentry{Si}{name={Si},
description={Silizium}, first={Silizium (Si)}, type=mater}
\newglossaryentry{C-OH}{name={C-OH},
description={Bindung zwischen einem Kohlenstoffatom und einer OH-Gruppe}, first={C-OH}, type=mater} 
\newglossaryentry{AlGaN}{name={Al$_{x}$Ga$_{1-x}$N},
description={Aluminiumgalliumnitrid}, first={Aluminiumgalliumnitrid (Al$_{x}$Ga$_{1-x}$N)}, type=mater}
    
\cleardoublepage\phantomsection\addcontentsline{toc}{section}{Abkürzungen und Symbole}
\printglossary[type=\acronymtype, style=long, title=Abk{\"u}rzungen]
\printglossary[type=symbolslist, style=symbunitlong]
\cleardoublepage\phantomsection\addcontentsline{toc}{section}{Elemente und Materialien}
\printglossary[type=mater,style=long]

\chapter{Test}
\gls{MIGS}, \gls{UVO}, \gls{MQW}, \gls{TCF}, \gls{TL}, \gls{symb:a0}, \gls{symb:RhoMGrpGaN}, \gls{H2O}, \gls{Si}, \gls{MOVPE}, \gls{IIINitride}, \gls{C-OH}, \gls{AlGaN}, \gls{PID}
\end{document}

在此处输入图片描述

在此处输入图片描述

答案1

有两种设置可以控制宽度:

这是关于 Abkürzungen 和 Elemente und Materialien 的:

\AtBeginDocument{\setlength{\glsdescwidth}{.75\columnwidth}}

另一个用于 Symbole,p{8.5cm} 控制第三列的宽度:

\renewenvironment{theglossary}{% Change the table type --> 3 columns
  \begin{longtable}{lp{0.15\glsdescwidth}>{\arraybackslash}p{8.5cm}}}%
  {\end{longtable}}%
%

根据您的评论,自动调整与包无关glossaries。要自动调整第二列或第三列的宽度,您需要依靠xltabularenviron来定义您的自定义词汇表样式(例如,\begin{xltabular}{\linewidth}{lX}两列列表和\begin{xltabular}{\linewidth}{lcX}三列列表)。我将向您展示以下示例:

\documentclass[a4paper,twoside,12pt]{report}
\usepackage{showframe}

\usepackage[
nopostdot,      
nonumberlist, 
nogroupskip, 
acronym,
section,
automake,
]      
{glossaries}

\usepackage{xltabular}
\usepackage{environ} 

\NewEnviron{symboltable}{%
    \begin{xltabular}{\linewidth}{lcX}%
        \BODY
    \end{xltabular}
}

\NewEnviron{twocoltable}{%
    \begin{xltabular}{\linewidth}{lX}%
        \BODY
    \end{xltabular}
}

\newglossary[mlg]{mater}{myi}{myg}{Elemente und Materialien}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbole}

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

\makeglossaries

\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}
\renewenvironment{theglossary}{%
\symboltable
}
{\endsymboltable}

\renewcommand*{\glossaryheader}{\textbf{Symbol} & \textbf{Einheit} & \textbf{Beschreibung}\endhead}
\renewcommand*{\glossentry}[2]{\glstarget{##1}{\glossentryname{##1}} & \glsunit{##1} & \glossentrydesc{##1}\\
}
}

\newglossarystyle{twocollong}{%
\setglossarystyle{long}
\renewenvironment{theglossary}{%
\twocoltable
}
{\endtwocoltable}

\renewcommand*{\glossaryheader}{\endhead}
}

%%%%%%%%%%%%%%%%%%% Abkürzungen %%%%%%%%%%%%%
\newglossaryentry{MIGS}{type=acronym, name={MIGS},
description={Metall induzierte Bandlückenzustände (\textit{engl.} Metal Induced Gap States (MIGS)},
first={MIGS}}
\newglossaryentry{UVO}{type=acronym, name={UVO},
description={Ultraviolett-Ozon},
first={UVO}}
\newglossaryentry{MQW}{type=acronym, name={MQW},
description={multiple Quantentöpfe (engl. \textit{multiple quantum well})},
first={multiple Quantentöpfe (MQW)}}
\newglossaryentry{TCF}{type=acronym, name={TCF},
description={transparente, leitfähige Schicht/Elektrode (engl. \textit{transparent conducting film}},
first={transparente, leitfähige Schicht/Elektrode (TCF)}}           
\newglossaryentry{TL}{type=acronym, name={T$_L$},
description={Transferlänge},
first={Transferlänge (T$_L$)}}
\newglossaryentry{IIINitride}{type=acronym, name={III-Nitride},
description={Halbleiterverbindung aus Elementen der III. Hauptgruppe des Periodensystems und Stickstoff},
first={III-Nitride}}
\newglossaryentry{MOVPE}{type=acronym, name={MOVPE},
description={Metallorganische Gasphasenepitaxie (engl. \textit{metal organic chemical vapor phase epitaxy})},
first={metallorganische Gasphasenepitaxie (MOVPE)}}
\newglossaryentry{PID}{type=acronym,name={PID-Regelkreis-longer name},
description={PID-Regelkreis (engl. \textit{proportional-integral-derivative controller})},
first={PID-Regelkreis (engl. \textit{proportional-integral-derivative controller}, PID-controller})}
%%%%%%%%%% Symbole %%%%%%%%%%%%%%%
\newglossaryentry{symb:a0}{name={$a_0$},
description={Gitterkonstante von GaN in \textit{a}-Richtung},
first={$a_0$}, unit={$nm$}, type=symbolslist}
\newglossaryentry{symb:c0}{name={$c_0$},
description={Gitterkonstante von GaN in \textit{c}-Richtung},
first={$c_0$}, unit={$nm$}, type=symbolslist}
\newglossaryentry{symb:RhoMGrpGaN}{name={$\rho_{M/Gr/p-GaN}longer symbol$},description={Summe der spez. Kontaktwiderstände zwischen Metallkontakt, Graphen und \textit{p}-GaN},
first={$\rho_{M/Gr/p-GaN}$}, unit={$\Omega cm^2$}, type=symbolslist}
\newglossaryentry{symb:RhoGrpGaN}{name={$\rho_{Gr/p-GaN}$},
description={spez. Kontaktwiderstand zwischen Graphen und \textit{p}-GaN},
first={$\rho_{M/p-GaN}$}, unit={$\Omega cm^2longer unit$}, type=symbolslist}
\newglossaryentry{symb:test1}{name={$\rho_1$},
description={spez. Kontaktwiderstand zwischen Graphen und \textit{p}-GaN},
first={$\rho_1$}, unit={$\Omega cm^2longer unit$}, type=symbolslist}
%%%%%%%%%% Elemente und Materialien %%%%%%%%%%%%%%%
\newglossaryentry{H2O}{name={H$_2$O},
description={Wasser-Molekül}, first={H$_2$O}, type=mater}
\newglossaryentry{Si}{name={Si},
description={Silizium}, first={Silizium (Si)}, type=mater}
\newglossaryentry{C-OH}{name={C-OH},
description={Bindung zwischen einem Kohlenstoffatom und einer OH-Gruppe}, first={C-OH}, type=mater} 
\newglossaryentry{AlGaN}{name={Al$_{x}$Ga$_{1-x}$N longer name test},
description={Aluminiumgalliumnitrid}, first={Aluminiumgalliumnitrid (Al$_{x}$Ga$_{1-x}$N)}, type=mater}
\glsaddall

\begin{document}
\printglossary[type=\acronymtype, style=twocollong, title=Abk{\"u}rzungen]\clearpage

\printglossary[type=symbolslist, style=symbunitlong]\clearpage

\printglossary[type=mater,style=twocollong]\clearpage
\end{document}

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容