4

i am using this wonderful tool that tkz-fct is for creating nice documents but I have a weird result from recently. This is my document :

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{calc}
\usepackage{color}
\usepackage{pifont}                     %pour utiliser la police Ding
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry} %marges du document
\usepackage[french]{babel}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage[L]{thmbox}
\usepackage{eurosym}
\usepackage{enumitem}               %pour modifer itemize et enumerate
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{mathrsfs}               %pour utiliser mathscr
\usepackage{array,multirow,makecell}
\usepackage{fancyhdr}               %package pour modifier les en-têtes
\usepackage{fancybox}               %pour boîtes spéciales
\usepackage{tikz,tkz-tab,tkz-fct}
\usepackage{tikz-dependency}        %permet de créer des schemas
\usepackage{sectsty}                %permet de modifier les styles des sections (voir \sectionfont l.21)
\usepackage{fourier-orns}
\usepackage{shadethm}               %pour theoremes en gris
\setcellgapes{1pt}
\makegapedcells
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}}   %pour redéfinir les colonnes dans tabular
\newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}
\renewcommand{\thesection}{\Roman{section}} %permet de changer la numérotation en chiffres romains des sections
\newshadetheorem{defi}{Définition}  %crée un nouveau type de théorème
\newshadetheorem{thm}{Théorème}
\newshadetheorem{ppte}{Propriété}
\sectionfont{\sectionrule{3ex}{3pt}{-1.5ex}{1pt}} %mettre un trait de séparation dans les sections (package sectsty)
\pagestyle{fancy} %style en-têtes
\lhead{} %en-tête gauche
\chead{Lois à densité} %en-tête centrale
\rhead{T\up{ale}} %en-tête droite
\begin{document}
\begin{tikzpicture}
     \tkzInit[xmin=-4,xmax=4,ymax=1]
     \tkzDrawX[label={},noticks]
     %\tkzDrawY
     \tkzFct[domain=-2:2]{exp(-x**2)}
     \tkzDrawArea[color=blue, domain = -0.5:1]
     \tkzText(-1,0.75){$\mathscr{C}_{f}$}
\end{tikzpicture}
\end{document}

But from now, it doesn't produce the result I would like as the surface start from the point (-0.5,f(-0.5)) and not as an integral from -0.5 to 1. This is a picture of the result : result

Which is obviously not what I would like and this extends now to all my "old" docs which were "normal" before. I don't think I have done anything special except updating my Tex distribution ... If someone has an idea ??

  • 2
    Hi, welcome to TeX.SX. Great that you added the example code, but generally it's nice if the code is minimal as well, most of your code isn't necessary to show the problem. \documentclass{article} \usepackage{tkz-fct} \begin{document} \begin{tikzpicture} \tkzInit[xmin=-4,xmax=4,ymax=1] \tkzFct[domain=-2:2]{exp(-x**2)} \tkzDrawArea[color=blue, domain = -0.5:1] \end{tikzpicture} \end{document} is enough I guess. pgf/TikZ recently had a large update, perhaps there are some changes that has influenced tkz-fct (but don't take my word for it, it's a wild guess). – Torbjørn T. Mar 11 '14 at 22:36
  • Thank you, I edited my code which was too long indeed. ;-) – yg60 Mar 12 '14 at 5:54
3
\documentclass[10pt,a4paper]{article}
\usepackage{tkz-fct}
\begin{document}
\begin{tikzpicture}
     \tkzInit[xmin=-4,xmax=4,ymax=1]
     \tkzDrawX[label={},noticks]
     \tkzFct[domain=-2:2]{exp(-x**2)}
     \tkzDrawArea[color=blue, domain = -0.5:1]
\end{tikzpicture}
\end{document}

The problem appears with pgf 3.0. The result is correct with pgf 2.1. I need to make some investigations to find the bug

Here a solution but I don't know why the result is different with pgf 3.0

The problem comes from the code in tkz-fct.sty:

        (\tkz@ba,0)--plot [id = \tkz@fct@id]%
       function{(\tkzFctgnuLast)/\tkz@init@ystep}--(\tkz@bb,0);

you need to remplace this code by

    plot [id = \tkz@fct@id]%
    function{(\tkzFctgnuLast)/\tkz@init@ystep} -- (\tkz@bb,0) -- (\tkz@ba,0) ;

or

     plot [id = \tkz@fct@id]%
     function{(\tkzFctgnuLast)/\tkz@init@ystep} -- (\tkz@bb,0) -- (\tkz@ba,0) -- cycle;

Possible is to to find tkz-fct 1.16 c and to replace the code or you can download the version 1.18 c from my site:

tkz-fct 1.18 c

Now I need to understand why ?

| improve this answer | |
  • Thank you a lot for your efforts. Maybe I could switch back to pgf 2.1 ... I replaced the code as you indicate and it worked indeed, there's just a weird result with 1.18c that I sent you. Big thanks again anyway – yg60 Mar 12 '14 at 22:06

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.