LaTeX forum ⇒ Graphics, Figures & TablesTools and best Practice for Diagrams

Information and discussion about graphics, figures & tables in LaTeX documents.
sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Tools and best Practice for Diagrams

Postby sachinrajsharma » Wed Jun 26, 2013 4:43 am

Hi,

I have been using LaTeX for the past two years and find it best for my mathematical research documentation. However, when it comes to drawing various diagram I am facing lot of problem. As it takes too much of time while making diagrams in latex. For that I have downloaded LaTeXDraw, and in that I am feeling more comfortable to draw various diagrams. But the issue which I am facing is that how to insert these diagrams (coding) in my source code. I have done the following efforts for making diagrams.

  1. I have used pgf/TikZ (found it more time consuming). However, I have made diagrams like triangle, circles etc. in it in more easier way.
  2. I have also used pstricks.
  3. Because I was unable to make these diagrams, then I started doing scan of these diagrams and inserted in my documentation but print out of these documents were not clear and I was not satisfied.
  4. I downloaded LaTeXDraw (which I have already mentioned)

Is there any way so that I can save my time by making diagrams in more easier way like using Latex draw and insert the same in the my mathematical research document. I have typed lot many equations and matter during the past two years but this is the only problem I am facing in LaTeX.

Request you to please guide, I will be grateful to you.

Regards,
Sachin Sharma

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4074
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Jun 26, 2013 8:35 am

What kind of diagrams are you creating? Simple diagrams can be edited and viewed using PGF/TikZ or PSTricks and an editor. Some people are more comfortable with those little editors.

As you already mentioned, there is LaTeXDraw. As far as I know, it supports the export of PSTricks code (which it uses internally) so you could just \input this code into your document. This would be similar to the way you are producing PSTricks pictures by hand. The export of PDF is possible, too. So you could put the PDF into your document using \includegraphics.

Jpgfdraw is similar to LaTeXDraw, but it uses TikZ instead. But the inclusion into your document would be the same.

Do you know the pgfplots package? This is very suitable if you want to plot some data.

If you need more help, please be aware to post a Minimal Working Example which helps us to verify the problem and help you faster.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Postby sachinrajsharma » Thu Jun 27, 2013 4:53 am

Hi,

Thanks for your reply, however I have two questions here.

  1. What is the use of LaTeXDraw, if we can't insert it's coding directly in a document?
  2. I have downloaded Jpgfdraw (ZIP file), I am unable to install this. Please help on this but before that please let me know whether I will be able to insert the coding of the output of diagrams of this in the document, if not then I think it will be of no use to me.

Below I add a code sample of LaTeXDraw for which I am unable to get the output in my document (this question I have raised in forum, but didn't get satisfactory answer).
  1. \documentclass[10pt,a4paper]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{tikz}
  4.  
  5. \begin{document}
  6. \begin{tikzpicture}
  7. \draw[help lines] (-2,0) grid (2,4);
  8. \draw[->] (-2.2,0) -- (2.2,0);
  9. \draw[->] (0,0) -- (0,4.2);
  10. \draw[green, thick, domain=-2:2] plot (\x, {4-\x*\x});
  11. \draw[domain=-2:2, samples=50] plot (\x, {1+cos(pi*\x r});
  12. \end{tikzpicture}
  13. \begin{tikzpicture}[domain=0:4]
  14. \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
  15. \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$};
  16. \draw[->] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
  17. \draw[color=red] plot (\x,\x) node[right] {$f(x) =x$};
  18. \draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x) = \sin x$};
  19. \draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x) = \frac{1}{20} \mathrm e^x$};
  20. \end{tikzpicture}
  21. \end{document}


Thanks for all of your support.

Regards,
Sachin Sharmaa

User avatar
Johannes_B
Site Moderator
Posts: 4074
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Jun 27, 2013 7:52 am

Concerning your first question: LaTeXDraw generates PSTricks code, shown on the right side of the window (at least on my machine). You can just copy&paste all this code into your LaTeX file, or export as as an ASCII text with the ending .tex. This makes it possible for you to \input the file (which is equivalent to copy&paste) and not getting confused with the shown code (it can be very long for complicated pictures).

(Almost) the same works for Jpgfdraw, but the generated code is PGF, the back-end of TikZ.

Installation directions are given on the Jpgfdraw homepage. You did not tell us what system you are using or if/what error occurs. Please be more specific.

I don't understand your last question, this is a perfectly fine minimal example. You can compile it using pdflatex. In order to include it into your document you need to delete lines which are not needed or allowed, meaning the whole preamble/everything but the tikzpicture environment.

You could also change the document class to minimal, compile the PDF and include the PDF into your document.

In order to help you we need precise information on what your trying to do or trying to accomplish.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Fri Jun 28, 2013 8:01 pm

sachinrajsharma wrote:[…] Below I add a code sample of LaTeXDraw for which I am unable to get the output in my document (this question I have raised in forum, but didn't get satisfactory answer). […]

If the answer to your other question was not satisfactory, you should ask follow-up questions. But giving feedback to proposed solutions has never been one of your qualities since you are a member here.

I recommend not to rely on bad export of third party tools but learn how to use one of the packages mentioned here. This is no sorcery. The packages have very good manuals. At the moment you have time consuming problems with those tools, too. Hence there is no benefit.

If you run into trouble, ask targeted questions here in the forum and learn to discuss problems with others in order to solve them. Your poor feedback is the main cause for unsatisfactory answers to your questions.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 11 guests