3

I have installed the package tkz-tab to make sign and variation tables of a function. Signs are okay but when I try to make a variation table, for example like this:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tkz-tab} %loads tikz

\begin{document}
\begin{tikzpicture}
   \tkzTabInit{$x$ / 1 , $f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
   \tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}
\end{document}

It writes:

Package pgf error: No shape named F11 is known. See the pgf package for details.

What should I do?

  • 3
    Welcome! Please add \usetikzlibrary{babel} under \usepackage{tikz,tkz-tab}. – user194703 Feb 14 '20 at 19:46
  • Thank you very much! It works! – Michal Döme Feb 15 '20 at 8:05
  • @Schrödinger'scat tkz--tabloads TikZ – Alain Matthes Apr 9 '20 at 8:19
3

New answer

Disabling the - character shorhand with the \shorthandoff macro in the babel package makes it work.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tkz-tab} %loads tikz

\begin{document}
\shorthandoff{-}
\begin{tikzpicture}
   \tkzTabInit{$x$ / 1 , $f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
   \tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}
\shorthandon{-}
\end{document}

Old answer

It works by adding tikz's babel library: \usetikzlibrary{babel}

screenshot

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tkz-tab}
\usetikzlibrary{babel}
\begin{document}
\begin{tikzpicture}
   \tkzTabInit{$x$ / 1 , $f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
   \tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}
\end{document}
  • This precisely my comment which you are repeating here. – user194703 Feb 14 '20 at 22:52
  • @Schrödinger'scat As it seems to be an answer, posting it as such is reasonable, although I might have gone for pinging you to ask you to do so yourself – Joseph Wright Feb 14 '20 at 23:55
  • @JosephWright Well, I'd agree with that if that was the first occasion. Unfortunately this is a repeating theme. (The reason why I did not write an answer is that Alain Matthes is around, he would be a good choice for writing this answer, but not the current OP.) – user194703 Feb 15 '20 at 0:04
  • @Schrödinger'scat be calm please! just a small thing. Btw, what do you think about my way of drawing variation tables? a bit long but flexible – Black Mild Feb 15 '20 at 12:24
2

You have the solution ... Your problem appears with babel and the option czech. You have three solutions. The best \usetikzlibrary{babel} or you can avoid using babel and finally another solution is to use lualatex with polyglossia.

In the code below, I used the `help' option to show you all the nodes created by my package. This allows you to customize the table easily.

% !TEX TS-program = lualatex
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage{polyglossia}
\setmainlanguage{czech}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{tkz-tab}
\begin{document}

\begin{tikzpicture}
   \tkzTabInit[help]{$x$ / 1 , $f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
   \tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}
\end{document}

enter image description here

You can like Black Mild use xscale and yscale

\begin{tikzpicture}[yscale=.5,xscale=.8]
\tkzTabInit{$x$ / 1 ,$f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
\tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}

enter image description here

You can also add style like in TikZ because it's Tikz behind tkz-tab

\begin{tikzpicture}[yscale=.5,xscale=.8]
  \tikzset{h style/.append style = {%
 pattern=north east lines,pattern color=purple}}
\tkzTabInit{$x$ / 1 ,$f(x)$ / 2}{$-\infty$, $-5$, $-3$, $2$, $+\infty$}
\tkzTabVar{-/ $-\infty$, +C/ $0$, +H/ $0$, D-/ $-10$, +/ $+\infty$}
\end{tikzpicture}

enter image description here

1

In case one likes plain TikZ. I adjust a bit the positions of nodes 0 and -10. Use xscale and yscale as you think fit.

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}[yscale=.8,xscale=1.75]
\begin{scope}[shift={(-.5,.5)}]
\fill[pattern=north east lines,pattern color=violet] (3.5,-1) rectangle +(1,-3);
\draw (0,0) rectangle +(6,-4) (0,-1)--+(0:6) (1,0)--+(-90:4);
\draw[gray] (2.5,-1)--+(-90:3) (3.5,-1)--+(-90:3) (4.5,-1)--+(-90:3);
\end{scope}
\path
(0,0)    node{$x$}          % <<< line 1
++(0:1)  node{$-\infty$}
++(0:1)  node{$-5$}
++(0:1)  node{$-3$}
++(0:1)  node{$2$}
++(0:1)  node{$+\infty$};
\path[nodes={fill=white,inner sep=2pt}]
(0,-2)   node{$f(x)$}          % <<< line 2
++(0:1)  +(-90:1) node (A) {$-\infty$}
++(0:1)  +(90:.5) node (B) {$0$}
++(0:1)  +(90:.5) node (C) {$0$}
++(0:1)  +(-90:.5) node (D) {$-10$}
++(0:1)  +(90:1) node (E) {$+\infty$};
\draw[-stealth,blue] (A)--(B);
\draw[-stealth,blue] (B)--(C);
\draw[-stealth,blue] (D)--(E);
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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