# Custom LaTeX logo

I'm trying to get this "logo"

At the moment I use the following command

\mbox{%
M\hspace{-0.25ex}%
\raisebox{0.18ex}{\tiny A}\hspace{-0.65ex}%
T\hspace{-0.65ex}%
\raisebox{0.18ex}{\tiny E}\hspace{-0.4ex}%
X%
}


But does not fit when I change the font size as '\TeX' or '\LaTeX'. I tried to modify this code, but I can not find the necessary changes

\makeatletter
\DeclareRobustCommand{\MaTeX}{%
M\kern-.09em %
{%
\setbox0\hbox{T}%
\vbox to\ht0{%
\hbox{%
\csname S@\f@size\endcsname
\fontsize\sf@size\z@
\math@fontsfalse\selectfont
A%
}%
\vss
}%
}
\kern-.40em
\hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125ex X}}
\makeatother


and this (modification)

-
I don't know if you've already seen this (from your attempt it looks like you may have), but this may be of interest: tex.stackexchange.com/a/17888/12774 –  JohnReed Jun 20 '12 at 5:03
Thanks, I'll check –  Pablo González L Jun 20 '12 at 11:29
Just a note: it might be better to use em for the horizontal spacing, since it measures the "width" of the font, whereas ex measures its height. (Actually, em refers to the width of M and ex refers to the height of x.) –  tohecz Jun 20 '12 at 21:42

## 3 Answers

Here is an attempt at creating something that stretches with the font size:

\documentclass[10pt]{article}
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\makeatletter
\DeclareRobustCommand{\aMaTeX}{%
M\kern-.09em {\setbox0\hbox{T}%
\vbox to\ht0{\hbox{%
\csname S@\f@size\endcsname\fontsize\sf@size\z@ \math@fontsfalse\selectfont A}%
\vss}%
}\kern-.40em \hbox{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125ex X}}
\newcommand{\bMaTeX}{\mbox{%
M\hspace{-0.25ex}%
\raisebox{0.18ex}{\tiny A}\hspace{-0.65ex}%
T\hspace{-0.65ex}%
\raisebox{0.18ex}{\tiny E}\hspace{-0.4ex}%
X%
}}
\newsavebox{\MaTeXbox}
\savebox{\MaTeXbox}{\normalsize%
M\hspace{-0.25ex}%
\raisebox{0.18ex}{\tiny A}\hspace{-0.65ex}%
T\hspace{-0.65ex}%
\raisebox{0.18ex}{\tiny E}\hspace{-0.4ex}%
X%
}%
\newcommand{\cMaTeX}{%
\settoheight{\@tempdima}{M}%
\resizebox{!}{\@tempdima}{\usebox{\MaTeXbox}}%
}

\makeatother

\begin{document}

\begin{tabular}{lllll}
Original 1 & Original 2 & New & \verb|\TeX| & \verb|\LaTeX| \\
\hline
\footnotesize\aMaTeX & \footnotesize\bMaTeX & \footnotesize\cMaTeX & \footnotesize\TeX & \footnotesize\LaTeX \\
\small\aMaTeX & \small\bMaTeX & \small\cMaTeX & \small\TeX & \small\LaTeX \\
\aMaTeX & \bMaTeX & \cMaTeX & \TeX & \LaTeX \\
\large\aMaTeX & \large\bMaTeX & \large\cMaTeX & \large\TeX & \large\LaTeX \\
\Large\aMaTeX & \Large\bMaTeX & \Large\cMaTeX & \Large\TeX & \Large\LaTeX \\
\LARGE\aMaTeX & \LARGE\bMaTeX & \LARGE\cMaTeX & \LARGE\TeX & \LARGE\LaTeX \\
\Huge\aMaTeX & \Huge\bMaTeX & \Huge\cMaTeX & \Huge\TeX & \Huge\LaTeX
\end{tabular}
\end{document}


In the above MWE, \cMaTeX stores a \normalsize version of MaTeX in a box, and resizes the box based on the height of M in the prevailing font. Resizing (while maintaining aspect ratio) is done using \resizebox{!}{<height>}{<stuff>} from the graphicx package.

-
A comprehensive solution (and a code easy to read and understand) thank you very much –  Pablo González L Jun 20 '12 at 11:39
@PabloGonzález: I removed the construction of \MaTeXbox from the command \cMaTeX, since it is not needed to reconstruct \MaTeXbox with every use of \cMaTeX. –  Werner Jun 20 '12 at 19:23

This seems to work reasonably well in all sizes

\documentclass{article}

\usepackage{relsize}
\makeatletter
\def\matex@ssize{\larger[-2]\scshape}
\DeclareRobustCommand{\MaTeX}{%
\mbox{%
M\kern-0.1em
\raisebox{0.18ex}{\matex@ssize a}\kern-0.27em
T\kern-0.27em
\raisebox{0.18ex}{\matex@ssize e}\kern-0.1em
X%
}%
}
\makeatother

\begin{document}
\MaTeX

\large\MaTeX

\Large\MaTeX

\LARGE\MaTeX

\huge\MaTeX

\Huge\MaTeX

\end{document}


Don't use ex for horizontal measurements, but rather em. I've used \kern instead of \hspace, just for personal preference.

-
He had completely forgotten the package "relsize" I made some attempts to scalebox, but unsuccessful. «Don't use ex for horizontal measurements...» why? –  Pablo González L Jun 20 '12 at 11:41
@PabloGonzález ex is "vertically oriented" and won't necessarily be connected with the character widths. A rule of thumb is that 1em is the width of a capital "M", while 1ex is the height of a lowercase "x". –  egreg Jun 20 '12 at 11:51
\documentclass{article}
\usepackage{graphicx}
\DeclareRobustCommand\MaTeX{%
M\kern-.09em%
\makebox[0pt][l]{\raisebox{0.075em}{\scalebox{0.5}{A}}\kern-.25em T%
\kern-.25em%
\makebox[0pt][l]{\raisebox{0.075em}{\scalebox{0.5}{E}}\kern-.08em X}}}
\begin{document}

\MaTeX

\huge\MaTeX

\tiny\MaTeX

\end{document}


-
which simply goes to show what i established, to my own satisfaction ages ago, that these ghastly bumpy-road logos don't work if you scale the font(s) they use. the \huge example is obviously too loose (could do with smaller horizontal spacing), and the \tiny example is too crushed (could possibly work by reducing the size of the snuck-in letters). i actually published a tugboat article about this effect (and the hideous technique i used to get around the problem). it happens with any bumpy-road logo you define. –  wasteofspace Jun 20 '12 at 8:38
Thanks Herbert, but its solution does not respect the spaces after writing \MaTEX (mounting the words on the logo) –  Pablo González L Jun 20 '12 at 11:36