我可以告诉词汇表包在标题中拼出缩写吗?

我可以告诉词汇表包在标题中拼出缩写吗?

我的导师认为,在科学论文中,人们只需看表格/图片及其标题即可理解表格/图片,而无需阅读其周围的内容,这一点非常重要。因此,缩写(以 引入\gls{bla})在标题中第一次出现时应拼写出来 - 之后的任何标题均应如此。

可以自动获取吗?

平均能量损失

文档.tex

\documentclass[a4paper,9pt]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{glossaries}
\loadglsentries[main]{glossary}
\makeglossaries

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quam elit,
vestibulum nec facilisis at, condimentum id enim. Sed iaculis lacinia quam, vel
accumsan eros tempor in. Integer ipsum metus, accumsan sit amet commodo a,
egestas vitae sem. \Gls{SLP} Mauris ut orci ut dolor viverra convallis nec a
erat. Aenean consequat elit vel eros fermentum vestibulum id at ipsum. In vitae
orci mauris, et rhoncus odio. Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.

\begin{figure}[h]
    \centering
    \includegraphics*[width=\linewidth, keepaspectratio]{YourImage.jpg} 
    \caption{adsfasdf \gls{SLP} adsfasdf.}
\end{figure}

Fusce libero nulla, euismod vel suscipit nec, elementum vel massa. Mauris ut
sapien sed neque dignissim sodales. Proin accumsan, lectus non gravida dapibus,
lorem leo tincidunt odio, in semper ligula libero bibendum lorem. Pellentesque
venenatis massa a neque porttitor congue. Maecenas ornare lacus ac orci mattis
a placerat sapien euismod. In sed eros enim, non interdum nisi. Curabitur quis
magna et tortor interdum pharetra. Donec sit amet turpis neque, quis congue
leo. Proin sit amet placerat dolor.
\end{document}

词汇表

%Term definitions
\newacronym{CUDA}{CUDA}{Compute Unified Device Architecture}
\newacronym{SLP}{SLP}{supervised layer-wise pretraining}

像这样编译

DOKUMENT = document
make:
    pdflatex -shell-escape $(DOKUMENT).tex -interaction=batchmode -output-format=pdf # aux-files for makeindex / makeglossaries
    makeglossaries $(DOKUMENT)
    pdflatex -shell-escape $(DOKUMENT).tex -interaction=batchmode -output-format=pdf # include glossary

答案1

您可以在标题中简单地使用\acrfull及其变体(\Acrfull\ACRfull等)来代替\gls及其变体(\Gls、等)。\GLS

这将始终提供您的首字母缩略词的完整格式。

平均能量损失

\documentclass[a4paper,9pt]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[demo]{graphicx}
\usepackage{glossaries}
\newacronym{CUDA}{CUDA}{Compute Unified Device Architecture}
\newacronym{SLP}{SLP}{supervised layer-wise pretraining}
\makeglossaries

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quam elit,
vestibulum nec facilisis at, condimentum id enim. Sed iaculis lacinia quam, vel
accumsan eros tempor in. Integer ipsum metus, accumsan sit amet commodo a,
egestas vitae sem. \Gls{SLP} Mauris ut orci ut dolor viverra convallis nec a
erat. Aenean consequat elit vel eros fermentum vestibulum id at ipsum. In vitae
orci mauris, et rhoncus odio. Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.

\begin{figure}[h]
    \centering
    \includegraphics*[width=\linewidth, keepaspectratio]{YourImage.jpg}
    \caption{adsfasdf \acrfull{SLP} adsfasdf.}
\end{figure}

Fusce libero nulla, euismod vel suscipit nec, elementum vel massa. Mauris ut
sapien sed neque dignissim sodales. Proin accumsan, lectus non gravida dapibus,
lorem leo tincidunt odio, in semper ligula libero bibendum lorem. Pellentesque
venenatis massa a neque porttitor congue. Maecenas ornare lacus ac orci mattis
a placerat sapien euismod. In sed eros enim, non interdum nisi. Curabitur quis
magna et tortor interdum pharetra. Donec sit amet turpis neque, quis congue
leo. Proin sit amet placerat dolor.

\printglossaries
\end{document} 

输出(标题)

在此处输入图片描述

否则,如果您想保持\gls原来的类似命令,您可以在本地重置每个命令中的第一个使用标志\caption

为了实现这一点,请在序言中插入以下几行

\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{\glslocalresetall#2}%
}

MWE(输出与上面相同)

\documentclass[a4paper,9pt]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[demo]{graphicx}
\usepackage{glossaries}
\newacronym{CUDA}{CUDA}{Compute Unified Device Architecture}
\newacronym{SLP}{SLP}{supervised layer-wise pretraining}
\makeglossaries

\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{\glslocalresetall#2}%
}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla quam elit,
vestibulum nec facilisis at, condimentum id enim. Sed iaculis lacinia quam, vel
accumsan eros tempor in. Integer ipsum metus, accumsan sit amet commodo a,
egestas vitae sem. \Gls{SLP} Mauris ut orci ut dolor viverra convallis nec a
erat. Aenean consequat elit vel eros fermentum vestibulum id at ipsum. In vitae
orci mauris, et rhoncus odio. Pellentesque habitant morbi tristique senectus et
netus et malesuada fames ac turpis egestas.

\begin{figure}[h]
    \centering
    \includegraphics*[width=\linewidth, keepaspectratio]{YourImage.jpg}
    \caption{adsfasdf \gls{SLP} adsfasdf.}
\end{figure}

Fusce libero nulla, euismod vel suscipit nec, elementum vel massa. Mauris ut
sapien sed neque dignissim sodales. Proin accumsan, lectus non gravida dapibus,
lorem leo tincidunt odio, in semper ligula libero bibendum lorem. Pellentesque
venenatis massa a neque porttitor congue. Maecenas ornare lacus ac orci mattis
a placerat sapien euismod. In sed eros enim, non interdum nisi. Curabitur quis
magna et tortor interdum pharetra. Donec sit amet turpis neque, quis congue
leo. Proin sit amet placerat dolor.

\printglossaries
\end{document} 

相关内容