6

I'm sorry if this is the wrong stackexchange to ask in, but it seems to be the place where people care about typography :)

I'm writing lecture notes on Android development, and I like to put class names and code fragments in monospaced in order to make it easier to read.

For instance \texttt{Activity} is used a lot.

My question is how should I typeset the plural reference?

\texttt{Activity}s looks wrong

activities doesn't distinguish from other text

\texttt{Activities} removes the verbatim nature that I'm trying to convey using the texttt.

Any recommendations and guidelines will be appreciated.

  • 2
    I have a feeling you can use \texttt{Activity}(s) or declare at the beginning that `...hereon now known as \texttt{activity} regardless if is considered just one or many. – Mario S. E. Jun 3 '14 at 10:01
  • Thank you for your input. I think I like the \textt{Activity}(s) most, then I just need to make sure I'm consistent, but that is not going to go away. – RandomSort Jun 3 '14 at 10:07
  • For future reference, you might find English Language and Usage to be another suitable forum for such questions. – John Wickerson Jun 3 '14 at 13:15
10

I think you should rewrite to avoid plurals. For instance, don't write "Activities are used for...", but write "Activity objects are used for..." instead.

  • Thank you for your answer, this will probably give the cleanest look throughout the text. – RandomSort Jun 3 '14 at 21:16
3

If you write a macro that encapsulates the format you can change the format consistently at will. Here's an implementation that follows @JohnWickerson 's excellent suggestion.

\documentclass{article}

\newcommand{\class}[1]{%
\texttt{#1}%
}

\begin{document}

\class{Activity} objects capture \ldots

\end{document}
  • That doesn't actually allow changing the format at will. If the questioner wants to do that they should define both \activity and \activities, which they can then set as appropriate. – dbmag9 Jun 3 '14 at 19:34
  • @dbmag This does let the OP change the typography simultaneously for all words defining a \class . I agree with another comment that the class names shouldn't have plural versions, since they are part of compilable code the OP is describing. – Ethan Bolker Jun 3 '14 at 20:59
  • It's a good way of doing what others have said, yes. But your answer suggests it's a way to choose between different answers to the question (ie different conventions on how to pluralise the class name), which is isn't. – dbmag9 Jun 4 '14 at 8:38
1

Based on my previous comment, and inspired by the other two answers, this is my approach:

\documentclass{article}

\newcommand{\actone}{\texttt{Activity}(s)}
\newcommand{\acttwo}{\texttt{Activity}(-ies)}

\begin{document}

In the next \actone{} you'll see\ldots{}

In the next \acttwo{} you'll see\ldots{}

\end{document}

enter image description here

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.