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 am still working on my template for stackexchange like resume, and I noticed that if I issue the \LaTeX macro inside a Tikz box, the A gets trimmed.

The header of my document contains:

\usetikzlibrary{shapes.geometric}
\newcommand{\tagf}[2][]{
{
\scalefont{0.8}
\begin{tikzpicture}[baseline={(TAG.base)}]
\node[draw,#1] (TAG) {#2};
\node[font=\tiny,draw,#1] (TAG) {#2\strut};
\end{tikzpicture}
}
}

I want to do the following:

 \tagf[blue!80, fill=blue!20,  rounded corners, font=\fontsize{0.1}{.1}]{Makefile}\hspace{-0.25cm}
 \tagf[blue!80, fill=blue!20,  rounded corners, font=\fontsize{0.1}{.1}]{GCC}\hspace{-0.25cm}
 \tagf[blue!80, fill=blue!20,  rounded corners, font=\fontsize{0.1}{.1}]{Python}\hspace{-0.25cm}
 \LaTeX
 \tagfb[blue!80, fill=blue!20,  rounded corners, font=\fontsize{0.1}{.1}]{\LaTeX}\hspace{-0.25cm}

The odd result is:

Latex trimmed

Update

I compiled a complete snippet, which works:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{scalefnt}
\usepackage{times} %if use this, the macro is broken.
%\usepackage{times} %commenting this lines out works 
\usetikzlibrary{shapes.geometric}

\newcommand{\tagf}[2][]{%
\begin{tikzpicture}[baseline={(TAG.base)}]
\node[draw,#1] (TAG) {#2};
\node[font=\tiny,draw,#1] (TAG) {#2\vphantom{y}};
\end{tikzpicture}
}

\newcommand{\tagfb}[2][]{%
\begin{tikzpicture}[baseline={(TAG.base)}]
\node[draw,#1] (TAG) {#2};
\node[font=\tiny,draw,#1] (TAG) {#2\strut};
\end{tikzpicture}
}

\tikzset{My Tag Style/.style={blue!80, fill=blue!20,  rounded corners, , font=\fontsize{0.1}{.1}}}

\begin{document}
\foreach \x in {SAMBA, Red Hat, Windows, NFS, Python, Shell, \LaTeX, MySQL} {%
    \tagf[My Tag Style]{\x}
}

\foreach \x in {SAMBA, Red Hat, Windows, NFS, Python, Shell, \LaTeX, MySQL} {%
    \tagfb[My Tag Style]{\x}
}
\end{document} 

Original question is: is this a bug? If not, how can I fix this behavior?

Updated question:
I think this is not a 100% bug, and if so, not sure that it is in Tikz, maybe in the times package. So, how can I cause just the tags to have the correct font, and the rest of document have the font times?

enter image description here

share|improve this question
    
Please submit the compilable complete code rather than code snippets. –  stalking is prohibited Nov 13 '12 at 17:29
    
I think is something related to tex.stackexchange.com/questions/82523/…, but anyway having here a minimal working examples will help in any case. :) –  Claudio Fiandrino Nov 13 '12 at 17:44

1 Answer 1

up vote 6 down vote accepted

This has nothing to do with TikZ and everything to do with a rather odd command in your tag style: \fontsize{0.1}{.1}. This says "Next time you select a font, make it of size .1pt." (and something else with the second .1 - I think that's related to line size). Inside the \LaTeX macro is a \selectfont command (for the A) and that picks up the declared font size. However, as you haven't invoked the \selectfont yourself then the L TEX are still set in the current font size, whence visible. The reason that this occurs with times and not without it is that times is a scalable font but computer modern (the default) bottoms out at around 8pt so when times is asked "Set the font size to .1pt" then it does so but when computer modern is asked it then it says, "Nah, I'm using 8pt" instead.

The following code demonstrates the problem (note that I'm using pgffor just for the loop, there's no TikZ involved here).

\documentclass{article}
%\url{http://tex.stackexchange.com/q/82601/86}
\usepackage{pgffor}
\usepackage{times} %<-- comment out or not to see the difference

\begin{document}

\foreach \fnt in {1,2,...,16} {

  \fnt:\fontsize{\fnt}{\fnt}\selectfont\LaTeX
}

\end{document}

Result with times:

scaled font with times

Result with CM:

computer modern version

share|improve this answer
    
thanks man! I was actually wondering about those font size. That was just a legacy from my (lame) tries to control the box size before I started using scalefnt. –  Oz123 Nov 13 '12 at 18:21

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.