Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know how I would go about labeling the Euclidean vectors in a diagram. For example, if I use the code provided below to draw a diagram which depicts three vectors, how would I label the appropriate vectors as, say, u, v, and u - v?

I am disappointed by the lack of antialiasing and quality of rasterization of the lines when I view the generated postscript or PDF file using the GNU Document Viewer (for reference, I am using Ubuntu 10.10, 64-bit at the time of this writing). Would using an EPS file instead of providing the following inline commands result in a higher-quality output? If so, could you please recommend an application that can generate these kinds of vector diagrams?

\setlength{\unitlength}{1cm}
\begin{picture}(5,5)
\linethickness{1pt}
\put(0,0){\vector(3,2){3}}
\put(0,0){\vector(2,3){2}}
\put(2,3){\vector(1,-1){1}}
\end{picture}
share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

My solution to this would be to use PGF/Tikz, which is way nicer with rasterization. You could achieve the same drawing like this :

\begin{tikzpicture}[auto]
    \node (a) at (0,0)  {};
    \node (b) at (2,3)  {};
    \node (c) at (3,2)  {};

    \draw[->] (a) to node {u} (b);
    \draw[->] (b) to node {u-v} (c);
    \draw[->] (a) to node {v} (c);
\end{tikzpicture}

Or something of the sort, you can consult the PGF/Tikz manual which is full of nice examples (for instance summing coordinates).

And no, an EPS file won't give a nicer result, since it has to be scaled at some point, and second it is not easy to change your diagram once you've included it with the EPS method.

share|improve this answer
    
Just tried out TikZ, and it works beautifully -- thanks! –  void-pointer May 6 '11 at 1:05
add comment
\documentclass{article}  
\usepackage{pstricks-add}

\begin{document}
\begin{pspicture}(5,5)
\psStartPoint[A](0,0)% name prefix A for the vectors
\psVector(3,2)\psVector(1,-1)
\psline[linecolor=red,arrowscale=2]{->}(A0)(A2)
\end{pspicture}

enter image description here

share|improve this answer
    
Ah, this also looks very pleasing, and the code is compact and easily manageable. Thanks! –  void-pointer May 5 '11 at 23:20
add comment

If you were almost satisfied with picture environment, probably you could just add

\usepackage{pict2e} 

to the preamble. It turns latex picture into real vector pictures from pseudo-graphics and removes some strange limitations. For instance, you may plot circles of any radius and lines with any slope. Read package manual for the details.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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