3

I am trying to setup an abbreviation/acronym list for my document as described in http://wiki.contextgarden.net/Command/definesynonyms . Some of my abbreviations are names of microorganisms like E.coli which stands for Escherichia coli. These abbreviations have to be in italics and also contain dots and sometimes spaces. Both these things cause problems for me:

\definesynonyms[abbreviation][abbreviations][\infull]
\abbreviation{\it{E.coli}}{\it{Escherichia coli}} % This throws an error

\starttext
Blablabla \E.coli % and this doesn't work either.
\placelistofabbreviations
\stoptext

How is it done right?

4

There are two mistakes in your code. Firstly, the use of \it: it is a toggle, and so the proper usage is {\it ...}, or you can use the command \italic instead which does take an argument, like \italic{...}.

The other is to do with the synonyms. Having done

\definesynonyms[abbreviation][abbreviations][\infull]

You now have \abbreviation which takes the arguments

\abbreviation[<optional>]{<shortform>}{<longform>},

and can of course do \shortform to get the short form and \infull{<shortform>} to get the long form.

We have a problem though, if <shortform> (under normal catcode regimes) doesn't work as a control sequence name. Ours is just such a case. That is the purpose of the optional argument, to supply a more suitable shorthand. Then you can do \optional for the short form and \infull{optional} for the long one.

All in all, the MWE becomes

\definesynonyms[abbreviation][abbreviations][\infull]
\abbreviation[ECOLI]{{\it E.coli}}{{\it Escherichia coli}}

\starttext
Blablabla \ECOLI 
\placelistofabbreviations
\stoptext

For making things italic, there is a better way. Just put the content you want in each \abbreviation, and set the style using \setupsynonyms. Now we can nicely control the style in the "list" separately, although presumably you want the same style again. MWE with these changes:

\definesynonyms[abbreviation][abbreviations][\infull]
\setupsynonyms[abbreviation][synonymstyle=\it, textstyle=\it]
\abbreviation[ECOLI]{E.coli}{Escherichia coli}

\starttext
Blablabla \ECOLI
\placelistofabbreviations[headstyle=\it, style=\it]
\stoptext
  • 1
    I'd apply slanting by setting textstyle and synonymstyle for the newly created abbreviation. – Henri Menke Jul 26 '17 at 10:49
  • @HenriMenke I was just looking into that, can't figure out how to also apply the same style in the list. – 9tTn9B Jul 26 '17 at 10:56
  • Cool, thank you! Is there, by any chance, a simple way to make the acronyms in the text link to the corresponding entry in the list so that you can click on them to see what they stand for? – DP. Jul 26 '17 at 11:04
  • @DP. I don't know whether there is an easy to do that. – 9tTn9B Jul 26 '17 at 11:10

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.