8

I have a tikz drawing that I made within the beamer document class. I would like to know how to produce this drawing within the article document class, but preserve the sans-serif font and font size used in the default beamer theme.

Here is the LaTeX code using the beamer document class:

\documentclass[notes=show,beamer,usenames,dvipsnames]{beamer}
\usepackage{tikz}

\setbeamertemplate{navigation symbols}{}

\setbeamersize{text margin left=1em,text margin right=1em}

\begin{document}

\begin{frame}

\begin{tikzpicture}[yscale=3.5,xscale=4.5]

\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};

\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};

\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);

\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);

\path (.15,.1) node[right] {slope = $1-t$};

\end{tikzpicture}

\end{frame}

\end{document}

And here is the drawing within the article document class:

\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}


\begin{document}

\begin{tikzpicture}[yscale=3.5,xscale=4.5]

\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};

\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};

\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);

\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);

\path (.15,.1) node[right] {slope = $1-t$};

\end{tikzpicture}

\end{document}

I would like the latter to use the same font and font size as the former, including within math mode.

1
  • Do you want this for the whole document or just for the picture? Jul 9, 2012 at 18:09

1 Answer 1

10

In the answer it is possible to see how to make a local change (just for the picture) or to set the sans serif font for the whole article.

Local change

To make a local change you can proceed as follow:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{sansmath} % math sans serif font
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{amsmath}


\begin{document}


\begin{sansmath}
\fontencoding{\encodingdefault}
\fontfamily{\sfdefault}
\fontseries{\seriesdefault}
\fontshape{\shapedefault}
\selectfont
\begin{tikzpicture}[yscale=3.5,xscale=4.5]

\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};

\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};

\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);

\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);

\path (.15,.1) node[right] {slope = $1-t$};

\end{tikzpicture}
\end{sansmath}
\fontencoding{\encodingdefault}
\fontfamily{\rmdefault}
\fontseries{\seriesdefault}
\fontshape{\shapedefault}
\selectfont

\lipsum[1]
\[x+y=\dfrac{z}{3}\]
\end{document}

Result:

enter image description here

Global change

If your purpose is to set the whole document in sans serif you could go as:

\documentclass{article}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\sfdefault} %%
\usepackage{sfmath}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{amsmath}



\begin{document}

\begin{tikzpicture}[yscale=3.5,xscale=4.5]

\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};

\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}

\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);

\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};

\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);

\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);

\path (.15,.1) node[right] {slope = $1-t$};

\end{tikzpicture}

\lipsum[1]
\[x+y=\dfrac{z}{3}\]
\end{document}

Result:

enter image description here

2
  • This works great. However, is there a way to increase the font size? In Beamer the font comes out a little larger.
    – profj
    Jul 9, 2012 at 18:46
  • 2
    If you want simply a 12pt you can say: \documentclass[12pt]{article} otherwise you can have a look to these answers. Jul 9, 2012 at 18:55

You must log in to answer this question.

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