Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I tried to mimic the R logo in jpg format from R site only with LaTeX in order to make it scalable with the context without external files.

This is the result at tiny, normal and huge size, compared with the jpg at scale 25%, 50 and 100%:

MWE

Evidently, the LaTeX logotype is far from perfect in many areas even at normal size, but the worst is that the proportion between character R and the background circles (\bircirc) is not constant, although everything is defined in em units. Why?

Could be a better way to construct a pretty inline R logo? Of course, it should be not the jpg file nor a scalable vector graphics (SVG) converted to pdf, nor a simple format of the R character, like \newcommand{\R}{\textbf{\textup{R}}}

This is the MWE code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xspace}
\usepackage{xcolor}
\usepackage{graphicx}
\definecolor{Rcolor}{RGB}{150,160,190}

\newcommand{\R}{%
\raisebox{.3em}{\hspace{1.2em}%
\llap{\resizebox{1.09em}{.5em}{\color{black}$\bigcirc$}}%
\llap{\resizebox{1.199em}{.55em}{\color{darkgray}$\bigcirc$}}%
\llap{\resizebox{1.19em}{.52em}{\color{gray!50}$\bigcirc$}}%
\llap{\resizebox{1.1em}{.5em}{\color{gray}$\bigcirc$}}%
\llap{\resizebox{1.25em}{.55em}{\color{gray}$\bigcirc$}}%
}%
\hspace{-.85em}%
\textbf{%
%\resizebox{.55em}{1.5ex}{\textcolor{black!80}{\textsf{R}}}%
\textcolor{black}{\textsf{R}}%
\hspace{-.025em}\raisebox{.01em}{\llap{\textcolor{Rcolor}{\textsf{R}}}}%
}%
\xspace}

\begin{document}

Bitmap logo: 
\includegraphics[scale=.25]{Rlogo.jpg}
\includegraphics[scale=.5]{Rlogo.jpg}
\includegraphics[scale=1]{Rlogo.jpg}

\LaTeX\ logo:~~ 
\tiny{\R}  \normalsize{ \R}  \Huge{\R}


\end{document}
share|improve this question
1  
Scalable versions of the logo can be found as PDF or SVG. –  Heiko Oberdiek Sep 30 '12 at 18:02
    
@HeikoOberdiek. Thanks for the link. I excluded the svg solution to concretize the issue in the wrong LaTeX coding, but anyway it is useful. –  Fran Sep 30 '12 at 20:30

1 Answer 1

up vote 7 down vote accepted

Text and math fonts are not linearly scaled, LaTeX chooses (or can choose) the nearest design size font in each case, so the relative size of your math circle and text R are not guaranteed. Simplest is to save a normal size logo in a box and then scale the box to the current font size so it all scales together, so once you get it right for one size it will look the same at all sizes.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xspace}
\usepackage{xcolor}
\usepackage{graphicx}
\definecolor{Rcolor}{RGB}{150,160,190}

\newcommand{\Rx}{\fontsize{10pt}{12pt}\selectfont
\raisebox{.3em}{\hspace{1.2em}%
\llap{\resizebox{1.09em}{.5em}{\color{black}$\bigcirc$}}%
\llap{\resizebox{1.199em}{.55em}{\color{darkgray}$\bigcirc$}}%
\llap{\resizebox{1.19em}{.52em}{\color{gray!50}$\bigcirc$}}%
\llap{\resizebox{1.1em}{.5em}{\color{gray}$\bigcirc$}}%
\llap{\resizebox{1.25em}{.55em}{\color{gray}$\bigcirc$}}%
}%
\hspace{-.85em}%
\textbf{%
%\resizebox{.55em}{1.5ex}{\textcolor{black!80}{\textsf{R}}}%
\textcolor{black}{\textsf{R}}%
\hspace{-.025em}\raisebox{.01em}{\llap{\textcolor{Rcolor}{\textsf{R}}}}%
}}%

\newbox\rbox
\savebox\rbox{\scalebox{0.1}{\Rx}}

\makeatletter
\def\R{\scalebox{\f@size}{\usebox\rbox}\xspace}
\makeatletter

\begin{document}

Bitmap logo: 
%\includegraphics[scale=.25]{Rlogo.jpg}\includegraphics[scale=.5]{Rlogo.jpg}\includegraphics[scale=1]{Rlogo.jpg}

\LaTeX\ logo:~~ 
\tiny{\R}  \normalsize{ \R}  \Huge{\R}


\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.