So I have a list of acronyms defined with the glossaries package, like such:

\newacronym{mac}{MAC}{Medium Access Control}

but also some of these:

\newcommand{\mk}{Master Key}

because the latter one shall not be abbreviated but I don't want to type it all the time (can that be achieved with the glossaries package? Would be neat).

What I'm trying to achieve is, that both usecases print the word on first usage in italic. The acronyms (\newacronym) are then supposed to print the abbreviation (as it is per default) and the other like they are.

Any suggestions on how to do that in the glossaries package? And something more elegant for the other macros then toggles for each one?

I ended up defining meta commands


\newcommand*{\firstitacr}[4][]{{\it{#4#1} (#3)}\expandafter\gdef\csname#2\endcsname{#3}}

which are used to define the acronyms and proper names

\newcommand*{\mk}[1]{\firstit[#1]{mk}{Master Key}}

\newcommand*{\mac}[1]{\firstitacr[#1]{mac}{MAC}{Medium Access Control}}

these can then be used like this:

First usage of proper name: \mk{}
Second usage: \mk{}

First usage of acronym: \mac{}
Second usage: \mac{}

which would be rendered to something like this

First usage of proper name: Master Key
Second usage: Master Key

First usage of acronym: Medium Access Control (MAC)
Second usage: MAC

I'm pretty sure, that there is a more elegant solution, but this works for me.

  • Why use glossaries for the second one? Just use \newcommand\mk{\textit{Master Key}\gdef\mk{Master Key}} and it will be italic for the first time and every following usage will just print it in the current font. – Skillmon Jan 16 at 15:54
  • Thanks @Skillmon thats a neat solution I haven't thought of! – fhred Jan 16 at 16:00
  • But that only works very limited. 1. I can't simply append an 's' that is italic if and only if the word is, or is there a command to read out the font-style of the previous word? 2. I still don't have a solution to make the first use of \gls italic, and I still want to use \glsreset Any ideas? – fhred Jan 17 at 13:14
  • Go read the manual of glossaries, it's the same what I'd do. You can change the definition of \mk to \newcommand\mkFormatting[1]{\textit{#1}\gdef\mkFormatting#1{#1}}\newcommand\mk[1][]{\mkFormatting{Master Key#1}}. After that you can use \mk[s] to get "Master Keys" in the correct formatting. – Skillmon Jan 17 at 13:21
  • I can't really grasp what happens there, can you explain that? – fhred Jan 17 at 14:10

Your Answer

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

Browse other questions tagged or ask your own question.