假设我正在写一本书,我想标记新引入的单词。比如说,下面这段话中的 LaTeX 标记是什么绕口令(苏斯博士)?
And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \whatgoeshere{Thneed}!
我现在担心的是,新引入的单词应该有一个独特的外观(我很想使用\emph
,但意思不一样)。然而,另一种用法可能是,在书的其他地方,有一个自动生成的索引或词汇表条目引用这个实例(也许这是为某种语言的使用者编写的版本,其中特尼德实际上意味着什么,并且可能需要进行解释)。
答案1
只要您定义\whatgoeshere
,就可以定义它应该做的任何事情,无论是\emph
、还是词汇表\textbf
中的条目。因此,也许可以避免\emph
在\newword
一致的方式:
\documentclass{article}
% https://tex.stackexchange.com/a/29846/5764
\newcommand{\newword}{\textbf}
\begin{document}
And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \newword{Thneed}!
\end{document}
答案2
我建议使用superscript
,如下所示:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{garamondx}
\usepackage{geometry}
\usepackage{verse}
\newcommand{\newword}[1]{#1\textsuperscript{\textup{\mdseries\scriptsize\scshape n}}}
\begin{document}
\setlength{\afterpoemtitleskip}{8ex}
\renewcommand{\poemtitlefont}{\centering\itshape\Large}
\settowidth{\versewidth}{When they saw him nearing the further side –} %
\poemtitle{ The \newword{Pobble\kern1pt} who has no Toes}
\begin{verse}[\versewidth]
\begin{altverse}
The Pobble swam fast and well, \\
And when boats or ships came near him, \\
He\newword{ tinkledy}-\newword{blinkledy}-winkled a bell, \\
So that all the world could hear him. \\
And all the Sailors and Admirals cried, \\
When they saw him nearing the further side – \\
‘He has gone to fish for his Aunt Jobiska's \\
\newword{Runcible} Cat with crimson whiskers!’
\end{altverse}
\end{verse}
\end{document}
答案3
编辑文档时,可能会移动部分内容,并且可能会忘记第一次使用某个单词的时间。glossaries
包通过“首次使用标志”来帮助实现这一点。下面的 MWE 使用glossaries-extra
扩展包,功能更加丰富。
\documentclass{article}
\usepackage{glossaries-extra}
\newglossaryentry{Thneed}{name={Thneed},description={knitted object}}
% \glsxtrregularfont is a glossaries-extra.sty command
\renewcommand*{\glsxtrregularfont}[1]{%
\ifglsused{\glslabel}{#1}{\textbf{#1}}%
}
\begin{document}
And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \gls{Thneed}!
Next use: \gls{Thneed}.
\end{document}
如果您稍后决定需要所有条款的摘要,则只需添加\printunsrtglossary
:
\documentclass{article}
\usepackage{glossaries-extra}
\newglossaryentry{Thneed}{name={Thneed},description={knitted object}}
% \glsxtrregularfont is a glossaries-extra.sty command
\renewcommand*{\glsxtrregularfont}[1]{%
\ifglsused{\glslabel}{#1}{\textbf{#1}}%
}
\begin{document}
And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \gls{Thneed}!
Next use: \gls{Thneed}.
% \printunsrtglossary is a glossaries-extra.sty command:
\printunsrtglossary[title=Summary]
\end{document}
这会按定义顺序列出所有已定义的术语。如果您想要一个带有页面/章节引用的排序列表,那么它会变得有点复杂。
仅使用基础glossaries
包,第一个例子可以重写为:
\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{Thneed}{name={Thneed},description={knitted object}}
\renewcommand*{\glsentryfmt}{%
\ifglsused{\glslabel}{\glsgenentryfmt}{\textbf{\glsgenentryfmt}}%
}
\begin{document}
And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \gls{Thneed}!
Next use: \gls{Thneed}.
\end{document}
该\printunsrtglossary
命令特定于glossaries-extra
包,因此对于第二个示例,您必须使用包含索引和排序功能的更复杂的方法。