2

I have a problem with pstricks. I am not able to control the cartesian coordinate for the y-axis. I don't understand why. For example, I am drawing a line going from (x=1,y=4) to (x=6,y=4). I can control the x-coordinate, but not the y. Anyone can explain me where I am wrong?

Here is my code:

\documentclass[12pt]{article}

\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{pst-tree}
\usepackage{pst-plot}
%\usepackage{pst-math}
\begin{document}

\psgrid
\psset{xunit=1cm,yunit=1cm, fillstyle=solid}

\psline[linewidth=.05cm,arrowsize=0.25]{->}(1,4)(6,4)

\end{document}

And here what I get:

Line is not at y=4

2

That is the correct behaviour. You didn't reserve any space for the image, the reason why all macros place its contents into a box of zero width and height. You have an empty line between \psset and \psline. For TeX it is the same as \par, which starts a new line and your current reference point (coordinate system) is moved down. Compare it with:

\documentclass[12pt]{article}
\usepackage{pstricks}
\begin{document}

\psgrid
\psset{xunit=1cm,yunit=1cm, fillstyle=solid}%
%   
\psline[linewidth=.05cm,arrowsize=0.25]{->}(1,4)(6,4)

\end{document}

However, you are looking for something like

\documentclass[12pt]{article}
\usepackage{pstricks}

\begin{document}

\begin{pspicture}[showgrid](7,5)
\psset{xunit=1cm,yunit=1cm, fillstyle=solid}%

\psline[linewidth=.05cm,arrowsize=0.25]{->}(1,4)(6,4)
\end{pspicture} 
\end{document}

The environment pspicture reserves a box of width 7 and height 5. Empty lines are now not valid.

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.