# tikz doesn't work with L7x encoding in beamer

In my beamer document I use L7x encoding and I want to import tikz picture, however, it doesn't work, so what's the best way to import it in my presentation? My idea is to make a printscreen of this picture in the document, produced by other document class, and then input it as a picture, but I believe there is a better solution.

The example of document, which doesn't work in beamer

\documentclass{beamer}

\usepackage[utf8x]{inputenc}
\usepackage[L7x]{fontenc}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\frame{

\tikzstyle{c}=[draw, shape=circle, minimum size=25pt,inner sep=0pt]

\begin{tikzpicture}[auto,>=latex']
\node at (0,0) (d02) {$x(k)$};
\node at (-1,0) [coordinate] (p1) {};
\node at (-4,-1) [c, line width=1pt] (d12) {$\uparrow 2$};
\node at (-5,-1) [coordinate] (p2) {};
\node at (-8,-2) [c, line width=1pt] (d22) {$\uparrow 2$};
\node at (-9,-2) [coordinate] (p3) {};
\node at (-12,-3) [c, line width=1pt] (d32) {$\uparrow 2$};

\begin{scope}[line width=1pt]
\foreach \j/\i in {0/1,1/2,2/3}
{\draw[<-]  (d\j2) -- (p\i);}
\end{scope}

\end{tikzpicture}
}
\end{document}

-
Sorry, but without an example it's impossible to tell something. –  egreg May 30 '12 at 15:22
ok, I posted an example which doesn't work when document class is beamer. –  Pavasaris May 30 '12 at 15:45
With the preamble I suggested in the other answer I have no problem. –  egreg May 30 '12 at 15:54
Yes, but I prefer not to change my font. –  Pavasaris May 30 '12 at 15:58
Nothing to do with TikZ: you get the same error if you do not load tikz and have any math mode content in a frame. –  Joseph Wright May 30 '12 at 16:09

## 2 Answers

The problem is not tikz but the math:

\documentclass{beamer}
\usepackage[L7x]{fontenc}
\begin{document}
$x$
\end{document}


beamer defines quite a lot math alphabets using \encodingdefault which is L7x in your document. When starting the math some substituation fails as L7x is not setup properly.

You can declare an error font:

\usepackage[L7x]{fontenc}
\DeclareErrorFont{L7x}{lmr}{m}{n}{10}


(but I have no idea if the all the math alphabets will work correctly with your encoding)

You can also (additionally or instead) activate your encoding only at \begin{document}. Then beamer will use the normal math setup:

\usepackage[L7x,T1]{fontenc}
\AtBeginDocument{\renewcommand\encodingdefault{L7x}\normalfont}


You can also suppress the math setup of beamer with \usefonttheme{professionalfonts}.

-
Wonderful. Thanks a lot! –  Pavasaris May 30 '12 at 16:30
\documentclass{beamer}
\usefonttheme{professionalfonts}% now beamer didn't modify math fonts
\usepackage[L7x]{fontenc}
\begin{document}
$x$
\end{document}

-