词汇表样式较长,但符号前没有缩进

词汇表样式较长,但符号前没有缩进

我想使用词汇表包制作一个术语表。我喜欢“长”打印样式,但是,我更喜欢它左侧没有大的缩进,如果它有三列就更好了,这样我就可以将第一列用于符号,第二列用于单位,第三列用于描述。我的代码的最小示例:

\documentclass[12pt,a4paper]{report}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage[acronym,toc,nopostdot]{glossaries}

\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = black, %Colour for external hyperlinks
  linkcolor    = black, %Colour of internal links
  citecolor   = black %Colour of citations
}

\newglossaryentry{resonance_angular_frequency}{
  name = $\omega_0$ ,
  description = [rad/s] - The angular frequency at which the imaginary part of an impedance is zero
}
\newglossaryentry{coil}{
  name = $W_i$ ,
  description = The coils in the magnetic circuit where 1 denotes the primary side and 2 denotes the secondary side.
}
\newglossaryentry{electric_field}{
  name = $\vec{E}$ ,
  description = [V/m] - Electric field
}
\newglossaryentry{magnetic_flux_density}{
  name = $\vec{B}$ ,
  description = [T] - Magnetic flux density
}

\makeglossaries

\glsaddall

\printglossary[nonumberlist, style = long, title=Nomenclature]

\end{document}

有没有办法按照我想要的方式调整词汇表样式“长”?

编辑:如果您想使用“长”样式看看它现在是什么样子:

答案1

您只需增加长度的值\glsdescwidth(其默认值为)0.6\hsize。例如,添加行

\setlength{\glsdescwidth}{0.8\hsize}

在你的序言中,你将拥有

在此处输入图片描述

完整代码:

\documentclass[12pt,a4paper]{report}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage[acronym,toc,nopostdot]{glossaries}

\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = black, %Colour for external hyperlinks
  linkcolor    = black, %Colour of internal links
  citecolor   = black %Colour of citations
}

\newglossaryentry{resonance_angular_frequency}{
  name = $\omega_0$ ,
  description = [rad/s] - The angular frequency at which the imaginary part of an impedance is zero
}
\newglossaryentry{coil}{
  name = $W_i$ ,
  description = The coils in the magnetic circuit where 1 denotes the primary side and 2 denotes the secondary side.
}
\newglossaryentry{electric_field}{
  name = $\vec{E}$ ,
  description = [V/m] - Electric field
}
\newglossaryentry{magnetic_flux_density}{
  name = $\vec{B}$ ,
  description = [T] - Magnetic flux density
}

\makeglossaries

\setlength{\glsdescwidth}{0.8\hsize}

\begin{document}

\glsaddall

\printglossary[nonumberlist, style = long, title=Nomenclature]

\end{document} 

相反,如果您想要一个单位列,您可以定义一个新的词汇表样式mystyle

\newglossarystyle{mylong}{%
  \renewenvironment{theglossary}%
    {\begin{longtable}[l]{llp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{longtable}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrysymbol{##1} &
    \glossentrydesc{##1} &
    ##2\tabularnewline
  }%
  \renewcommand{\subglossentry}[3]{%
     &
     \glssubentryitem{##2}%
     \glossentrysymbol{##2} &
     \glstarget{##2}{\strut}\glossentrydesc{##2} & ##3\tabularnewline
  }%
  \renewcommand*{\glsgroupskip}{%
    \ifglsnogroupskip\else & & &\tabularnewline\fi}%
}

并将单位定义为符号,如

\newglossaryentry{magnetic_flux_density}{
  name = $\vec{B}$ ,
  description =  Magnetic flux density,
  symbol = [T]
}

以下 MWE

\documentclass[12pt,a4paper]{report}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage[acronym,toc,nopostdot]{glossaries}

\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = black, %Colour for external hyperlinks
  linkcolor    = black, %Colour of internal links
  citecolor   = black %Colour of citations
}

\newglossaryentry{resonance_angular_frequency}{
  name = $\omega_0$ ,
  description = The angular frequency at which the imaginary part of an impedance is zero,
  symbol = [rad/s]
}
\newglossaryentry{coil}{
  name = $W_i$ ,
  description = The coils in the magnetic circuit where 1 denotes the primary side and 2 denotes the secondary side.
}
\newglossaryentry{electric_field}{
  name = $\vec{E}$ ,
  description = Electric field,
  symbol = [V/m]
}
\newglossaryentry{magnetic_flux_density}{
  name = $\vec{B}$ ,
  description =  Magnetic flux density,
  symbol = [T]
}

\makeglossaries

\newglossarystyle{mylong}{%
  \renewenvironment{theglossary}%
    {\begin{longtable}[l]{llp{\glsdescwidth}p{\glspagelistwidth}}}%
    {\end{longtable}}%
  \renewcommand*{\glossaryheader}{}%
  \renewcommand*{\glsgroupheading}[1]{}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrysymbol{##1} &
    \glossentrydesc{##1} &
    ##2\tabularnewline
  }%
  \renewcommand{\subglossentry}[3]{%
     &
     \glssubentryitem{##2}%
     \glossentrysymbol{##2} &
     \glstarget{##2}{\strut}\glossentrydesc{##2} & ##3\tabularnewline
  }%
  \renewcommand*{\glsgroupskip}{%
    \ifglsnogroupskip\else & & &\tabularnewline\fi}%
}


\begin{document}

\glsaddall

\printglossary[nonumberlist, style = mylong, title=Nomenclature]

\end{document} 

产生以下结果:

在此处输入图片描述

相关内容