2

I'm using tkz-base and trying to plot inequation on x axis. I wanted to show arrowheads on both sides but when drawing X axis I get arrowhead only on right side. How do I get on both sides?

I tried to search the docs but couldn't understand. I tried to use the usual <-> option, but it didn't work.

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz,pgfplots}
\usepackage{tkz-base,tkz-euclide}
\begin{document}
    \begin{center}
        \begin{tikzpicture}
            \tkzInit[xmin=-3, xmax=9]
            \tkzDrawX[left space=0.5,label={}]
            \tkzDrawSegment[latex-latex,color=black]({-3.5,0},{9.5,0}) % workaround to get arrow at left side
        \end{tikzpicture}
    \end{center}
\end{document}

PS: I have achieved it by using a workaround i.e. by drawing a segment on the axis which has arrows on both sides. But I would prefer, if there is a solution which allows us to given option to the \tkzAxeX or \tkzDrawX.

  • I have added part of the code from whole document which is large. – August Apr 5 at 7:40
  • 2
    Okay, I'll update it. I'm a little new to this. Thanks for letting me know. :) – August Apr 5 at 7:43
  • 1
    I have updated the code which is compilable and can be copied immediately for checking. – August Apr 5 at 7:47
  • Great. Upvoted your question. Now you only have to wait for answers :)) – user156344 Apr 5 at 7:47
  • Oh, thank you very much. :) – August Apr 5 at 7:51
3

You can use xaxe style to customize x axis, the original definition of this style is

\tikzset{xaxe style/.style ={>=latex,->}}

You can redefine it like this

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz,pgfplots}
\usepackage{tkz-base,tkz-euclide}

\tikzset{xaxe style/.style ={>=latex,<->}}

\begin{document}
    \begin{center}
        \begin{tikzpicture}
            \tkzInit[xmin=-3, xmax=9]
            \tkzDrawX[left space=0.5,label={}]
         \end{tikzpicture}
    \end{center}
\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.