将命名法示例转换为使用词汇表

将命名法示例转换为使用词汇表

我希望得到有关如何转换此示例以使用词汇表包的指点:

如何实现命名条目,如:符号、描述、尺寸和单位等?

上述帖子正是我想要的,但我更喜欢词汇表,因为它内置于我用来生成 pdf 的包装器(Latexian)中。

我需要采取什么步骤来“重写”它?

编辑:MWE 布局,但代码不起作用:

Nomenclature

Acronyms
Symbol  Description     % no Dimensions and Units 
EVRA    Euler Vector Rotation Angle
...

Greek Symbols
Symbol  Description             Dimensions     Units
alpha    angle of attack        1 or (-)       radians                 
...

Roman Symbols
Symbol  Description             Dimensions     Units
S       Surface area vector     L^2            m^2
...

Superscripts
Symbol  Description     % no Dimensions and Units 
b       bottom surface 
...

Dimensionless Numbers
Symbol  Description     Definition
Re      reynolds number  equation
...

\documentclass{article}
\usepackage{longtable}
\usepackage{siunitx}
\usepackage[acronym]{glossaries}
etc.

\newcommands % make it easy to add each type of nomenclature

\makeglossaries
\begin{document}
 bunch of stuff \superscript[A]{\(A\)}{a dimensionless coefficient}{--}{1}

 more stuff \acronym[EVRA]{\(EVRA\)}{Euler Vector Rotation Angle}

 \printglossary[title=Nomenclature]

\end{document}

答案1

我解决这个问题的方法是:

  1. 我将为要创建的新类型的列创建键
  2. 我将定义各种类型的命名法
  3. 打印具体词汇表
  4. 确保你的命令行编译序列有额外的 makeindex 调用
  5. 为词汇表组件创建自定义样式,并使用新创建的字段键插入单位、定义和尺寸等信息。
  6. 认识到何时可以重复使用这些样式
  7. first={}请注意中的定义,\newglossaryentry{}因为如果不存在,则只会使用名称(可能需要),但请在最终文档中仔细观察这种格式的结果。

评论/注释:我还没有探索当不完全使用\gls{}tex 中的命令时此解决方案会如何变化。我更喜欢到处使用,\gls{}即使已经定义了首字母缩略词命令。我发现当词汇表条目在不同类型的词汇表中反复出现时,这给了我灵活性。

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{longtable,floatrow,booktabs}
\usepackage{siunitx,microtype,textcomp,textgreek}
\usepackage[nogroupskip,toc,indexonlyfirst]{glossaries}


%=============================================================================
%   G L O S S A R Y   S E T U P
%=============================================================================


\glsaddkey
{unit}          % new key
{\relax}        % default value if "unit" isn't used in \newglossaryentry
{\glsentryunit} % analogous to \glsentrytext
{\Glsentryunit} % analogous to \Glsentrytext
{\glsunit}      % analogous to \glstext
{\Glsunit}      % analogous to \Glstext
{\GLSunit}      % analogous to \GLStext

\glsaddkey
{dimension}     % new key
{\relax}            % default value if "dimension" isn't used in \newglossaryentry
{\glsentrydim}      % analogous to \glsentrytext
{\Glsentrydim}      % analogous to \Glsentrytext
{\glsdim}           % analogous to \glstext
{\Glsdim}           % analogous to \Glstext
{\GLSdim}           % analogous to \GLStext

\glsaddkey
{def}       % new key
{\relax}            % default value if "prerequisite" isn't used in \newglossaryentry
{\glsentrydef}      % analogous to \glsentrytext
{\Glsentrydef}      % analogous to \Glsentrytext
{\glsdef}           % analogous to \glstext
{\Glsdef}           % analogous to \Glstext
{\GLSdef}           % analogous to \GLStext

\newglossary[alg]{acronym}{acr}{acn}{List of Acronyms}% if not using the acronyms package option - can declare it myself
\newglossary[nlgG]{notationGreek}{notG}{ntnG}{Greek Symbols}
\newglossary[nlgR]{notationRoman}{notR}{ntnR}{Roman Symbols}
\newglossary[dnlg]{dimensionlessNumber}{dnt}{dntn}{Dimensionless Numbers}
\newglossary[sslg]{superscript}{sst}{sstn}{Superscripts}

% please note these should be accompanied by command line calls to makeindex eg:

% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.glg"  -o "main.gls"  "main.glo"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.alg"  -o "main.acr"  "main.acn"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.nlgG" -o "main.notG" "main.ntnG"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.nlgR" -o "main.notR" "main.ntnR"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.dnlg" -o "main.dnt"  "main.dntn"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.sslg" -o "main.sst"  "main.sstn"


%==================================================================================================================================================================

%http://tex.stackexchange.com/questions/78016/questions-regarding-conversion-from-acronym-package-to-glossaries
%http://tex.stackexchange.com/questions/71549/how-can-i-repeat-the-header-but-not-the-caption-with-longtable
%http://tex.stackexchange.com/questions/8946/how-to-combine-acronym-and-glossary
%http://tex.stackexchange.com/questions/26563/problems-with-glossaries-package-see-attribute

%http://tex.stackexchange.com/questions/126323/glossaries-list-only-page-number-of-the-first-occurrence

%\renewcommand*{\glspostdescription}{}%removes dot at end

\floatsetup[table]{style=ruled,
    objectset=raggedright,
    margins=raggedright,
    midcode=captionskip,
    captionskip=10pt}

\newglossarystyle{custom_acronyms}
{
    \setglossarystyle{long3colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description 
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1}
        \tabularnewline
    }%
}

\newglossarystyle{custom_symbols}
{
    \setglossarystyle{long4colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description & Dimensions & Units
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentrydim{##1} & \glsentryunit{##1} 
        \tabularnewline
    }%
}

\newglossarystyle{custom_dimlessnum}
{
    \setglossarystyle{long3colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description & Definition
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentrydef{##1}
        \tabularnewline
    }%
}

%==================================================================================================================================================================



\newglossaryentry{EVRA}{ type={acronym}, sort={EVRA},  name={EVRA}, short={EVRA}, long={Euler Vector Rotation Angle}, first={Euler Vector Rotation Angle (EVRA)}, description={Euler Vector Rotation Angle} }

\newglossaryentry{EVA}{ type={acronym}, sort={EVA},  name={EVA}, short={EVA}, long={Extra Vehicular Activity}, first={Extra Vehicular Activity (EVA)}, description={Extra Vehicular Activity} }

\newglossaryentry{angle of attack}{ type={notationGreek}, name={\textalpha}, first={angle of attack (\textalpha)}, description={angle of attack}, dimension={1 or (-)}, unit={radians} }

\newglossaryentry{SAvector}{ type={notationRoman}, name={S},description={Surface area vector}, first={surface area vector (S)}, dimension={\si{L^2}}, unit={\si{m^2}}}

\newglossaryentry{bS}{ type={superscript}, name={bS},description={bottom surface} }

\newglossaryentry{Re}{ type={dimensionlessNumber}, name={Re}, description={reynolds nummber}, def={math mode equation } }


\makeglossaries
\begin{document}
    \noindent
    Begin document:

    First example is of an acronym:  Could call \gls{EVRA} and we would see the expansion.  \Gls{EVRA} again yields just the abbreviation.  Another acronym is \gls{EVA}
    \medskip

    Example of a greek symbol with dimensions and units \gls{angle of attack}
    \medskip

    Roman symbol example:  \gls{SAvector}, and \gls{SAvector}
    \medskip

    Superscript examble \gls{bS} (if included in the formula with the gls command, the  glossary can hyperlink to the use and automate the population of your superscript list )
    \medskip

    Dimensionless number such as reynolds number \gls{Re}


    \printglossary[type=acronym,style=custom_acronyms]
    \printglossary[type=notationGreek,style=custom_symbols]
    \printglossary[type=notationRoman,style=custom_symbols]
    \printglossary[type=superscript,style=custom_acronyms]
    \printglossary[type=dimensionlessNumber,style=custom_dimlessnum]
    %\printglossary[type=main]

\end{document}

相关内容