[Tex/LaTex] How to build a variation table with tkz-tab

tikz-pgftkz-tab

TikZ: variable in calc syntaTikZ: variable in calc syntax 1
x 1
enter image description here

Best Answer

A quick tutorial to make a variation table with the tkz-tab package. If you want supplements say so.

Initialization of the table: \tkzTabInit

For example the first braces define the data in the left column of the table, the second braces define the data in the first row of the second column. (example from tkz-tab manual)

\tikz \tkzTabInit{$x$ /.8 , $f(x)$ /.8}{$0$ , $+\infty$};

tkz-tab-1

In these two columns:

  • the rows are separated by commas.
  • The first line is defined by $x$. The slash / separator separates the contents of the line from its height. Thus, here, both lines have a height of 0.8.

To obtain a three-line table, write:

\begin{tikzpicture}
\tkzTabInit{$x$ /1,
            $f'(x)$ /1,
            $f(x)$ /1}% end of the first left column 
           {$-\infty$,$-2$,$0,$,$+\infty$} % first line of right column
\end{tikzpicture}

image2

Add content with the \tkzTabLine macro

To add the data from the second line, we'll use the \tkzTabLine

  • z places a dotted line and a zero centered
  • t places a dotted line centered
  • d places a double centered bar

example:

\documentclass{article}
\usepackage{tkz-tab}
\begin{document}
\tkzTabInit{$x$ /1,$f'(x)$ /1,$f(x)$ /2}
           {$-\infty$,$-2$,$0$,$+\infty$}
\tkzTabLine{,+,z,-,z,-}
\end{document}

Output :

tkz-tab-3

Add the variation line with \tkztabVar macro:

\documentclass{article}
\usepackage{tkz-tab}
\begin{document}
\begin{tikzpicture}
\newcommand*{ \E}{ \ensuremath{ \mathrm{e}}}.
\tkzTabInit{$x$ /1,$f'(x)$ /1,$f(x)$ /2}
{$-\infty$,$-2$,$0$,$+\infty$}
\tkzTabLine{,+,z,-,z,-}
\tkzTabVar{-/$-\infty$,
            +/$2$,
            R/,
            -/$-\infty$}
\tkzTabIma{2}{4}{3}{$0$}            
\end{tikzpicture}
\end{document}

tkz-tab-4

the \tkzTabIma macro is used to position a value on a variation arrow \tkzTabIma[ 〈 local options 〉 ]{Beginning}{End}{Position}{Back}{Image}

  • Beginning rank of arrow origin
  • End rank of arrow end
  • Position rank of the antecedent corresponding to the image
  • Image image value if necessary

Translated with www.DeepL.com/Translator

Related Question