6

I often have the situation that I want to link a term to the glossary but state the term in plural.

So normally you do something like this in singular:

Some text before the term :term:`important word` then the stuff after the term

This is considered a completely different term:

Some text before the term :term:`important words` then the stuff after the term

This doesn't get parsed:

Some text before the term :term:`important word`s then the stuff after the term

And this is very redundant (but the only choice I have with my current knowledge):

Some text before the term :term:`important words<important word>` then the stuff after the term

Is there another way to write a term in plural without needing to state the term twice?

erikbstack
  • 12,878
  • 21
  • 81
  • 115

1 Answers1

17

I'm facing the same problem. I'm no expert, but here's what I've found (partially overlapping your own findings):

.. won't resolve to "foo"
:term:`foos`

.. reST doesn't parse the string
:term:`foo`s

.. ugly markup and gives different formatting for "foo" and "s"
:term:`foo`\ s

.. redundant and verbose, but most versatile
:term:`foos<foo>`

While the penultimate pattern will work, kinda, the last one really is what you want. Not only does it format the plural "s" the same as the rest of the word (unlike :term:`foo`\ s, which may give you something like foos), but it works when the plural isn't just a simple concatenation. E.g. consider directory/directories, or datum/data. For these cases, a full rewrite mechanism is best.

You can make your document less verbose by defining substitutions:

.. |foos| replace:: :term:`foos<foo>`

Then anywhere you want the plural "foos", you can write the substitution reference (see the previous link) |foos|, and the document processor will treat it like :term:`foos<foo>`


References:

https://sourceforge.net/p/docutils/mailman/message/31536488/

goodmami
  • 962
  • 15
  • 26
  • I used reST for my complete thesis and I found many such instances where it is not designed well for heavy usage. I can only advice to look at other formats. I heard ASCIIdoc many times as suggestion for long texts. – erikbstack May 28 '14 at 13:07
  • I added the link I referred to, now that I have enough reputation to do so. And If the answer was useful, would you mind accepting it? – goodmami Sep 28 '16 at 18:05
  • Yes, I would do that. While I agree that you probably listed the only workarounds that exist, neither of them is a real solution. Not your fault though. – erikbstack Sep 29 '16 at 09:57
  • 1
    True. The substitution solves the problem at hand (writing plurals without being redundant), but I'd agree it's annoying to have to create all the substitutions beforehand. You might have a programmatic solution, like feeding a list of terms to a script that looks up the plural forms in a dictionary and spits out substitution directives, but that seems overkill. – goodmami Sep 30 '16 at 17:18
  • For me the penultimate does exactly what I want. To me it shows that we're talking about multiple items of the object instead of a slightly differently named object. – AlcaDotS Jan 21 '19 at 19:34