# LaTeX/Inserting diagrams

keywords
LaTeX, diagrams, pictures, drawing

You may use the picture environment in latex and "programme" the picture with your keyboard like

%drawing a line "/" in latex
%this is a compilable file!
\documentclass[12pt]{article}
\begin{document}

\begin{picture}{100,100}
\put(20,20){\line(1,1){50}}
\end{picture}
\end{document}


If you have a picture which is a little more sophisticated, such programming would be a nightmare and you may wish to use your mouse to help. There is a number of free CAD tools for TeX. jPicEdt [1] is one which is easy to install - you would need Java if you haven't got it yet, but the installation of java is straightforward, and you will find it useful in the future anyway.

You can download the .jar file, install it, and draw a picture with it, and save the file (e.g. with the title "jPic-test1.tex") in the same directory of your other .tex files. To embed the picture in your LaTeX/helloworld.tex, simply insert the following code in your helloworld.tex:

\input{jPic-test1.tex}


or, if you like

\begin{center}
\input{jPic-test1.tex}
\end{center}


And then compile your helloworld.tex as before : type "latex helloworld".

If you get error messages, you may need to remove the offending (and redundant) lines. A typical problem is such a line as "\qbezier(80,80)(80,80)(80,80)" which tries to draw a quadratic bezier curve on the same point, which crashes the compiler.