
私はpdfLaTeXのパッケージを使用していますglossaries
。
本文では小文字で書かれた頭字語を使用する
そして
索引の場合は、用語集の各エントリ名の最初の文字を大文字にします。
すでにいろいろ調べてみましたが、解決策が見つかりませんでした。
用語集を取得するには、次のように定義されたコマンドを実行しますmakeindex
。
"/usr/texbin/makeglossaries" %
通常、私は 2 つの外部ファイルからエントリをロードしますが、MWE を実行した後でも同じ問題が発生するため、これが問題だとは思いません。とにかく、使用しているコマンドを表示するために、それらを MWE にコメントとして挿入しました。
また、これは重要かどうかわかりませんが、私はメインフォントとして MinionPro を使用し、KOMA-Script を使用しています。
私の MWE はこのスレッドに基づいています: http://www.latex-community.org/forum/viewtopic.php?f=5&t=9966
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[toc=true,smallcaps,section,nonumberlist,acronym,nomain]{glossaries}
\newglossary{slg}{sym}{syb}{Nomenclature}
% \input{./text/glossary}
% \loadglsentries{./text/symbols}
\makeglossaries
\newacronym{pcm} {PCM} {phase change material}
\newglossaryentry{sym:hfus}{type=slg,sort={pl:h},
name = {\null$\Delta H_{fus}$},
description={latent heat of fusion}}
\begin{document}
Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.
\textsc{This is small caps. PCM pcm }
\renewcommand{\glsnamefont}[1]{\makefirstuc{#1}}
\printglossary[type=slg, style=long, nonumberlist=true]
\renewcommand{\glsnamefont}[1]{\MakeUppercase{#1}}
\printglossary[type=acronym, style=long]
\end{document}
結果は次のとおりです。
大文字になるのは数式環境の Fus だけですが、これがどのように行われるのかまったく理解できません。その他すべて (小文字オプションと説明の大文字) は機能しません。
誰か、私が何を間違っているのか説明してくれませんか?
答え1
コメントで述べたように、頭字語が小文字で表示されないのは、大文字を使用して定義したためです。説明の大文字化が機能していないとおっしゃいました。これは、説明に関連する変更を行っていないためです。は、\glsnamefont
説明ではなく名前に適用されます。説明が大文字で始まるように新しいスタイルを定義する必要があります。
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[toc=true,smallcaps,section,nonumberlist,acronym,nomain]{glossaries}
\newglossary{slg}{sym}{syb}{Nomenclature}
\makeglossaries
\newacronym{pcm}{pcm}{phase change material}
\newglossaryentry{sym:hfus}{type=slg,sort={pl:h},
name = {\null$\Delta H_{fus}$},
description={latent heat of fusion}}
\newglossarystyle{long-ucdesc}{%
\setglossarystyle{long}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\Glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
}%
}
\begin{document}
Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.
\textsc{This is small caps. PCM pcm }
\printglossary[type=slg, style=long-ucdesc, nonumberlist=true]
\renewcommand{\glsnamefont}[1]{\MakeUppercase{#1}}
\printglossary[type=acronym, style=long]
\end{document}
これにより、次のものが生成されます。
以下は、説明の最初の文字を大文字にするスタイルを定義します。
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[toc=true,smallcaps,section,nonumberlist,acronym,nomain]{glossaries}
\newglossary{slg}{sym}{syb}{Nomenclature}
\makeglossaries
\newacronym{pcm}{pcm}{phase change material}
\newglossaryentry{sym:hfus}{type=slg,sort={pl:h},
name = {\null$\Delta H_{fus}$},
description={latent heat of fusion}}
\newglossarystyle{long-ucdesc}{%
\setglossarystyle{long}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\Glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
}%
}
\makeatletter
\newglossarystyle{long-initcapsdesc}{%
\setglossarystyle{long}%
\renewcommand{\glsnamefont}[1]{\MakeUppercase{##1}}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\protected@edef\thisdesc{\glsentrydesc{##1}}%
\xcapitalisewords{\thisdesc}\glspostdescription\space ##2\tabularnewline
}%
}
\makeatother
\begin{document}
Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.
\textsc{This is small caps. PCM pcm }
\printglossary[type=slg, style=long-ucdesc, nonumberlist=true]
\printglossary[type=acronym, style=long-initcapsdesc]
\end{document}
結果:
のバージョン 4.22 以上をお持ちの場合はglossaries
、代わりに以下を使用できます\glsentrytitlecase
。
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[toc=true,smallcaps,section,nonumberlist,acronym,nomain]{glossaries}
\newglossary{slg}{sym}{syb}{Nomenclature}
\makeglossaries
\newacronym{pcm}{pcm}{phase change material}
\newglossaryentry{sym:hfus}{type=slg,sort={pl:h},
name = {\null$\Delta H_{fus}$},
description={latent heat of fusion}}
\newglossarystyle{long-ucdesc}{%
\setglossarystyle{long}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\Glossentrydesc{##1}\glspostdescription\space ##2\tabularnewline
}%
}
\newglossarystyle{long-initcapsdesc}{%
\setglossarystyle{long}%
\renewcommand{\glsnamefont}[1]{\MakeUppercase{##1}}%
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glsentrytitlecase{##1}{desc}\glspostdescription\space ##2\tabularnewline
}%
}
\begin{document}
Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.
\textsc{This is small caps. PCM pcm }
\printglossary[type=slg, style=long-ucdesc, nonumberlist=true]
\printglossary[type=acronym, style=long-initcapsdesc]
\end{document}
とglossaries-extra
次の属性を利用できますglossdesc
:
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[section,nonumberlist,acronym,nomain]{glossaries-extra}
\newglossary{slg}{sym}{syb}{Nomenclature}
\makeglossaries
\setabbreviationstyle[acronym]{long-short-sc}
\newacronym{pcm}{pcm}{phase change material}
\newglossaryentry{sym:hfus}{type=slg,sort={pl:h},
name = {\null$\Delta H_{fus}$},
description={latent heat of fusion}}
\glssetcategoryattribute{acronym}{glossdesc}{title}
\glssetcategoryattribute{general}{glossdesc}{firstuc}
\begin{document}
Sample: \gls{sym:hfus}. \gls{sym:hfus}. \gls{pcm}. \gls{pcm}.
\textsc{This is small caps. PCM pcm }
\printglossary[type=slg, style=long, nonumberlist=true]
\printglossary[type=acronym, style=long]
\end{document}