声明首字母缩略词和缩写以自动更正句号后的空格?

声明首字母缩略词和缩写以自动更正句号后的空格?

如果我理解正确的话,(La)TeX 认为小写字母后的句号结束一个句子,而大写字母后的句号则不结束。不幸的是,我的文档通常包含大量首字母缩略词和缩写。除非我记得使用\@,否则句号后的空格是错误的:

\documentclass[convert={density=150},varwidth]{standalone}
\begin{document}
\noindent
\makebox[0.7in][l]{Incorrect:}%
Your computer needs more RAM.  I can give you some.\\
\makebox[0.7in][l]{Correct:}%
Your computer needs more RAM\@.  I can give you some.\\
\makebox[0.7in][l]{Incorrect:}%
Colors (red, blue, etc.) are nice.\\
\makebox[0.7in][l]{Correct:}%
Colors (red, blue, etc.\@) are nice.
\end{document}

上述文件的呈现

是否可以将某些字符串声明为首字母缩略词或缩写来推翻这一假设?如果是这样,这将减少我的文档中的间距错误数量。

例如:

\documentclass[convert={density=150},varwidth]{standalone}
\usepackage{magicalacronymhelper}
\declareacronym{RAM}
\declareabbr{etc}
\begin{document}
\noindent
\makebox[0.7in][l]{Correct:}%
Your computer needs more RAM.  I can give you some.\\
\makebox[0.7in][l]{Correct:}%
Your computer needs more RAM\@.  I can give you some.\\
\makebox[0.7in][l]{Correct:}%
Colors (red, blue, etc.) are nice.\\
\makebox[0.7in][l]{Correct:}%
Colors (red, blue, etc.\@) are nice.
\end{document}

在此处输入图片描述

答案1

没有办法自动执行此操作,除非您愿意使用 XeLaTeX 和不受支持的包xesearch

您可以做的最好的事情是定义宏\acro\abbr

\newcommand{\acro}[1]{#1\@}
\makeatletter
\newcommand{\abbr}{\@ifstar\@firstofone\@abbr}
\newcommand{\@abbr}[1]{#1.\@}
\makeatother

完整示例:

\documentclass{article}
\newcommand{\acro}[1]{#1\@}
\makeatletter
\newcommand{\abbr}{\@ifstar\@firstofone\@abbr}
\newcommand{\@abbr}[1]{#1.\@}
\makeatother

\begin{document}
\noindent
Your computer needs more \acro{RAM}.  I can give you some.\\
Your computer needs more RAM\@.  I can give you some.\\[3pt]
Colors (red, blue, \abbr{etc}) are nice.\\
Colors (red, blue, etc.\@) are nice.\\[3pt]
I like citrus flavors: orange, lemon, lime, \abbr*{etc}. They are tasty\\
I like citrus flavors: orange, lemon, lime, etc\@. They are tasty
\end{document}

在此处输入图片描述

相关内容