4

Suppose I am writing a book where I want to mark newly introduced words. What is the LaTeX markup in say, the following passage from The Lorax (Dr. Suess)?

And with great skillful skill and with great speedy speed,
I took the soft tuft. And I knitted a \whatgoeshere{Thneed}!

My present concern is that newly introduced words be given a distinct appearance (I am tempted to use \emph, but that does not have the same meaning.) However, another usage might be that somewhere else in the book, there would be an automatically generated index or glossary entry that references this instance (maybe this is an edition for speakers of a language where thneed actually means something, and an explanation might be in order).

  • You've tagged this glossaries. Why don't you use its method for this? What does this have to do with indexing? Are you indexing the words, too? – cfr Jan 28 '18 at 3:19
  • At the moment, I merely want newly introduced words to be visually distinguished, but I will take a look at glossaries. – Ana Nimbus Jan 28 '18 at 3:25
  • 1
    You've tagged it glossaries and provided no code: obviously, people will try to use every clue to figure out what you are doing. If that tag isn't appropriate, remove it. And provide some code people can compile to play with. Do you just want a macro you use for the first use? Or do you want that automatically handled? What's the setup here? – cfr Jan 28 '18 at 3:46
4

As long as you define \whatgoeshere, you can define whatever it should do, whether that be \emph, \textbf, or an entry into glossaries. So, perhaps avoid \emph and use \newword in a consistent way:

\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}
  • your answer is consistent with what I am looking for. I guess you are saying that there is no default behavior for \newword. – Ana Nimbus Jan 28 '18 at 7:15
  • @AnaNimbus: The "default" would be subjective. Perhaps \textbf, maybe \textit, maybe \emph or something else altogether. Regardless of your choice, you have a hook into the behaviour using \newword. It would be far more difficult to randomly trying to identify the words after you've built your entire document. – Werner Jan 28 '18 at 7:24
1

I propose to use a superscript, like this:

\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} 

enter image description here

1

When you edit your document there's a chance that sections may be moved around and it's possible to lose track of the first time you use a word. The glossaries package helps with this by having a "first use flag". The MWE below uses the glossaries-extra extension package, which is more versatile.

\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}

And with great skillful skill and with great speedy speed, I took the soft tuft. And I knitted a Thneed! Next use: Thneed.

If at a later date you decide that you want a summary of all the terms, you can just add \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}

And with great skillful skill and with great speedy speed, I took the soft tuft. And I knitted a Thneed! Next use: Thneed. Summary Thneed knitted object

This lists all the defined terms in order of definition. If you want a sorted list with page/section references, then it gets a bit more complicated.

With just the base glossaries package, the first example can be rewritten as:

\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}

The \printunsrtglossary command is specific to the glossaries-extra package, so for the second example, you'd have to use the more complicated methods that include the indexing and sorting functions.

  • Although I had removed the glossaries tag earlier at the prompting of @cfr, I have added the tag again, because now I see that the desired behavior associated with the identification of new words is facilitated with that package, whether or not one wants an actual glossary. – Ana Nimbus Jan 29 '18 at 1:57
  • Nicola, could you comment your code to distinguish which features use glossaries and which use glossaries-extra? Thanks – Ana Nimbus Jan 29 '18 at 1:58
  • @AnaNimbus Okay, done. – Nicola Talbot Jan 29 '18 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.