20

I have a logo in vector format (Adobe Illustrator) that I would like to use in my LaTeX documents. How do I create a latex symbol such that I can include this logo inline with the text, similarly to the symbol \LaTeX for example:

enter image description here

UPDATE

My logo contains a 'y' character and the solution outlined works but the baselines do not match (as the logo baseline is the bottom of 'y'). So I fixed it this way:

\usepackage{scalerel}
\def\mylogo{\kern0em\raise-.1667em\hbox{\scalerel*{\includegraphics{mylogo.pdf}}{X}}}

UPDATE 2

An update on the answer seems to be a better way of accomplishing this.

1
  • 2
    Metapost? Or include the symbol as a graphic.
    – user31729
    Jan 22, 2015 at 12:01

2 Answers 2

31

See UPDATE below, for graphics with descenders.

Here, \scalerel* scales the image to take the same vertical footprint as a capital letter "X". That also means the logo will automatically scale with font size. EDITED to make the process a macro (thanks to Maarten).

\documentclass{article}
\usepackage{scalerel}
\def\mylogo{\scalerel*{\includegraphics{ARL_Logo_March2012_BlackGold}}{X}}
\begin{document}
Can I insert my \mylogo{} inline?

\tiny Can I insert my \mylogo{} inline?
\end{document}

enter image description here

Because the original was a vector image stored in PDF, it zooms without loss of resolution:

enter image description here

UPDATE:

If the original graphic has descenders, one has two options.

One can vertically shift (with a \raisebox) the \includegraphics to match the natural baseline of the graphic with the LaTeX baseline and then "fool" \scalerel* but turning off the depth of shifted graphic:

\documentclass{article}
\fboxsep=-\fboxrule
\usepackage{scalerel}
\def\theirlogo{\scalerel*{%
  \setbox0=\hbox{\raisebox{-52pt}{\includegraphics{GoogleLogo}}}\dp0=0pt\box0}{X}}
\begin{document}
Can I insert my \theirlogo{} inline?

\tiny Can I insert my \theirlogo{} inline?
\end{document}

enter image description here

Alternately (and perhaps more efficiently), one could leave the \includegraphics unaltered and add a appropriately sized negative rule (in scalable units) to the second argument of the \scalerel*.

\documentclass{article}
\fboxsep=-\fboxrule
\usepackage{scalerel}
\def\theirlogo{\scalerel*{\includegraphics{GoogleLogo}}{X\rule[-.6ex]{0pt}{1pt}}}
\begin{document}
Can I insert my \theirlogo{} inline?

\tiny Can I insert my \theirlogo{} inline?
\end{document}
10
  • 2
    Using this solution you could easily create your Latex symbol (command) by putting \newcommand{\mylogo}{\scalerel*{\includegraphics{ARL_Logo_March2012_BlackGold}}{X}\ } in the preamble. Now you can use the command \mylogo wherever you want inside your document. Jan 22, 2015 at 12:13
  • @MaartenDhondt Yes, that would be recommended. I shall revise my MWE to reflect that. Jan 22, 2015 at 12:14
  • Yes @StevenB.Segletes, do it so that your answer is complete.
    – aaragon
    Jan 22, 2015 at 15:01
  • 1
    @aaragon See tex.stackexchange.com/questions/31091/…, for example, for more discussion of this issue. And lest you think xspace is an alternative, see this: tex.stackexchange.com/questions/86565/drawbacks-of-xspace. Jan 22, 2015 at 15:09
  • 1
    My logo has a 'y' letter in it, so the baseline of the characters do not align (it's as if the bottom of the 'character' is the baseline for the logo). Is there a way to get around this?
    – aaragon
    Feb 6, 2015 at 10:16
2

Why do not use

\def\mylogo{{\includegraphics[height=1.4ex]{ARL_Logo_March2012_BlackGold}}}
\begin{document}
Can I insert my \mylogo{} inline?

ex is the height of the "x" character, and changes with the font size.

You must log in to answer this question.

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