Define new macros for logical markup

When you encounter some logical markup, i.e. some things that belong to the same “class” and should be displayed equally (like names etc.), don’t use \textit and the like to format them but instead define a new macro to format those things. Then you’ll be consistent and you can change things later on quite easy.

Example
In your text there are lots of names, that should be – at the moment – displayed in italics. Then define a macro \person (or what ever you consider a meaningful name for these things) to format the output:

This gives you the opportunity to change the styling later and even do some fancy stuff like highlighting only the first occurrence of a name or generating an index with those names etc.

Some will say: “But I can just search and replace \textit later.” Yes but not if you used it also to format book titles or other things that should keep the italic format ;-)

8 thoughts

    1. Why not my definition?

      I think it’s better when the redefinition uses the original argument structure. Furthermore that way at least my editor’s auto-completition recognizes \person as macro with one argument.

      1. If you do _not_ define an argument structure, then it is by default the same as for the original macro. And if someone changes \textit then \person also changes or maybe unusable, the reason why \let\person\textit is the save definition if \person should always be the original \textit.

  1. To add my Version:
    \newcommand{\ricoeur}{P.\,Ricœur\idxn{Ricœur, Paul}}
    \newcommand{\ricoeurs}{P.\,Ricœurs\idxn{Ricœur, Paul}}

    For me, this is more effective, when dealing with certain names.

    1. I’d use \newcommand{\ricoeur}[1][]{P.\,Ricœur#1\idxn{Ricœur, Paul}}. Then you can use the same macro and keep changes in one place, e.g. \ricoeur\ was born in … and \ricoeur[s] work is great.. Btw. I’d use a full non breakable space instead of \,

Leave a Reply

Your email address will not be published.