I'm trying to tweak a style file, I have a 'def' as follows:

\def\logo#1{\gdef\@logo{#1}} \gdef\@logo{}

Inside of a custom 'make title':


I'm new to Tex/Macros, I was just wondering how I can add the scale parameter to the 'logo' def macro? i.e. I'd like to fully parameterise the call to \includegraphics.

Edit: As per below, I've added the logo into the 'maketitle', on a simple style, not sure if there is a better way to do that?


%% title
   \vskip -3em


      {\Large \bf \@title \par}\vspace*{24pt}{
        \lineskip 1em
            \@author \\
      \vskip 1em
  • Could you show what you mean by "fully parameterise"? – Werner Apr 18 '17 at 16:19
  • I mean, \logo{my-pic.png} will mean \includegraphics[scale=0.1]{my-pic.png} will get called in my 'maketitle'. I'd like to be able to specify the scale parameter too, i.e. \logo[0.7]{my-pic.png} thanks --Mike – Michael Lewis Apr 18 '17 at 16:24
  • Consider voting on the answers below, and accepting the one that helped you most. – Werner Apr 18 '17 at 16:37
  • hi, I've just signed up for tex stack exchange, lots of good answers, not sure how to vote yet, or if I have enough "reputation" to vote – Michael Lewis Apr 18 '17 at 17:00

Macro \logo can be defined with an optional parameter that takes the options for \includegraphics:


Usage for \includegraphics:


The options need to be expanded first, because the syntax characters comma and equal sign for the key value list must not be hidden inside macros.

Example for \logo:



\logo[width=2cm, angle=90]{example-image-a}

You can do


and use \make@logo at the point where you build the custom title, maybe like

  % code for no logo, maybe nothing
  % code before the logo, maybe \begin{center}
  % code after the logo, maybe \end{center}

So if the document preamble using your style file has


when the title is being typeset you'll get


Without a \logo command, you'll get nothing.

The \logo command accepts, in its optional argument, any options valid for \includegraphics, so for instance


and so on.

  • Thanks, switching having the logo optional is what I'm after. – Michael Lewis Apr 18 '17 at 16:51

If scale is all you're after and you're comfortable with an interface like \logo[0.7]{my-pic.png}, then a simple \newcommand with optional parameter works:


If you're not using the optional argument, it defaults to 1.

  • I think one point is to define the logo with \logo in one place and to use it with \@logo in another, like \author or \title. – gernot Apr 18 '17 at 16:29
  • @gernot: All title content are typically stored and only expanded with \maketitle. So there's no real need to use both \logo and \@logo somewhere else. Moreover, it requires additional \makeatletter...\makeatother delimiting (if not used inside a .sty). – Werner Apr 18 '17 at 16:36
  • How does one use your \logo command? How does one specify the image to be used, and how does \maketitle access it? In analogy to \author and \title, \logo should just store the image. – gernot Apr 18 '17 at 16:40
  • @gernot: You'd use \title{...\logo[.7]{my-pic.png}...} and then \maketitle in your document. – Werner Apr 18 '17 at 16:41
  • I'm including as per \author etc.. so that it gets 'built' by \maketitle, its just for a trivial style file, for some technical notes. – Michael Lewis Apr 18 '17 at 16:45

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.