I want to define some variable for my IPE template, such as the title, affiliation and author etc. The code is listed below. However when I compile it using pdflatex, it does not show the result what the \def variable should be. When I remove the \makeatletter and \makeatother, it issued a error message "! Use of \@ doesn't match its definition."

Any solutions ?


\def\title#1{\def\@title{#1}} % Title 
\def\displaytitle#1{\def\@displaytitle{#1}} % Display Title
\def\displayauthor#1{\def\@displayauthor{#1}} % Display author
\def\displayaffiliation#1{\def\@displayaffiliation{#1}} % Display affiliation

\title{This is a presentation}%
\displayauthor{Liu Benyuan}%
\displayaffiliation{The Automatic Target Recognition (ATR) Laboratory}%
\displaytitle{Compressive Sensing via Block Sparse Bayesian Learning : Theory and Applications}%


{\bf \@displayauthor{}}~~$\cdot$~~{\bf \@displayaffiliation{}}~\hfill$\cdot$\hfill~{\bf NUDT}} \\
\bf \@displaytitle{}\hfill \today{}}

  • 1
    Beside using \makeatletter before the minipage: You could also simply use command names without @. E.g. instead of \def\@displayaffiliation{#1} do \def\displayaffiliationcontent{#1}. Jun 26, 2013 at 7:34
  • Welcome to TeX.SX! You can have a look on our our starter page to familiarize yourself further with our format. Jun 26, 2013 at 7:37
  • @ulrike Fischer, Yes, your method can also work ! Thanks !
    – liubenyuan
    Jun 26, 2013 at 7:49

1 Answer 1


While your use of the \makeatletter...\makeatother pair in creating the definitions is done perfectly, you need to do the same if you reference these definitions elsewhere. So, "scoping" the minipage with another \makeatletter...\makeatother pair solves your problem.

As reference, see What do \makeatletter and \makeatother do?

Some other considerations:

  • Use predefined lengths, rather than absolute ones. Perhaps using \linewidth rather than 736pt would be more appropriate.
  • For back-end macros, using @ in the definitions are fine. However, if you're going to use definitions inside your document content, avoid the use of macros containing @, or build a user interface for that. For example,

    \def\printtitle{\@title}% Display title
    \def\printdisplaytitle{\@displaytitle}% Display title
    \def\printdisplayauthor{\@displayauthor}% Display author
    \def\printdisplayaffiliation{\@displayaffiliation}% Display affiliation

    Now you can use

      \textbf{NUDT} \
  • Don't use the old font switches like \bf and \it. See Does it matter if I use \textit or \it, \bfseries or \bf, etc. and Will two-letter font style commands (\bf, \it, …) ever be resurrected in LaTeX?
  • yes! it works like a magic when I put \makeatletter and \makeatother around the minipage. But what if I want to reference the definitions somewhere in the main document, I had to wrapper around, say \@displaytitle, with \makeatletter ... \makeatother, is there any way of working around this extra constrains ?
    – liubenyuan
    Jun 26, 2013 at 7:36
  • And that fixed width is for the layout of IPE for making representations. Thanks for the suggestions !
    – liubenyuan
    Jun 26, 2013 at 7:38
  • @liubenyuan: As mention in my answer, you should avoid that by creating "user interface macros" like \printdisplaytitle.
    – Werner
    Jun 26, 2013 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .