TransWikia.com

Drawing and inserting mathematical symbols on a Dia generated graph

TeX - LaTeX Asked by Complex Guy on June 24, 2021

I use graph via Dia to draw graphs. But I want to insert an equation or symbol on the graph. Is there any way to put an equation symbol such as $alpha$ or $beta$ on the graph?

I have inserted latex into the dia directly, and it is showing like this: enter image description here

EDIT:enter image description here

5 Answers

Final

documentclass[pstricks,border=12pt,12pt]{standalone}
usepackage{amsmath}
usepackage{pst-plot,pst-node}
psset{algebraic,plotpoints=100,labelsep=3pt}

deff[#1,#2]{2*2^(-2.5*(#1-#2)^2)}

begin{document}
begin{pspicture}[showgrid=false](-3,0)(3.5,3)
    psaxes[axesstyle=frame,tickstyle=bottom,ticks=x,ticksize=0 4pt,xsubticks=5,xsubticksize=.5,labels=none](0,0)(-3,0)(3,3)
    uput[d](-1,0){$omega_{text{nl}}$}
    uput[d](1.5,0){$omega_{text{lin}}$}
    uput[d](0,0){tiny Frequency}
    psline{<-}(0,2)(1,2)
    psset{linecolor=gray}
    psline[linestyle=dashed](0,0)(0,3) 
    psplot[linecolor=red,linestyle=dashed]{-3}{1}{f[x,-1]}
    psplot[linecolor=red]{-.5}{3}{f[x,1.5]}
    pcline{<->}(*-1.5 {f[x,-1]})(*-.5 {f[x,-1]})nbput{$r_{text{nl}}$}
    pcline{<->}(*1 {f[x,1.5]})(*2 {f[x,1.5]})nbput{$r_{text{lin}}$}
end{pspicture}
end{document}

enter image description here

Correct answer by kiss my armpit on June 24, 2021

If you have the complete drawing in Dia, you can chose to export the picture as LaTeX PGF macros. You'll then have a .tex file, lets say yourDiaDrawing.tex, which you can include in your document by input{pathToFile/yourDiaDrawing.tex}. If you have added your labels in Dia, find the nodes containing your label texts in yourDiaDrawing.tex. When exporting to TikZ, Dia assumes that every special character you have inserted are supposed to be that way, and escapes the characters. So your math dollars will be escaped $, your backslashes will be escaped and so on. Remove the backslash, and LaTeX does the rest.

You'll probably find nodes in yourDiaDrawing.tex that'll look something like this

node[anchor=west] at (13.00du,8.00du){$ alpha $};

Answered by Holene on June 24, 2021

Alternatively you can input the respective Unicode characters:

In a text box in dia press Ctrl+Shift+U, release the U, then type the UTF-32 hex code for the characters you want. For example for alpha this would be 3b1.

Answered by Dimo on June 24, 2021

There is a patch to keep TeX formulae unescaped in PGF export. Hopefuly, it will be merged soon.

See https://bugzilla.gnome.org/show_bug.cgi?id=778836 and https://gitlab.gnome.org/GNOME/dia/merge_requests/3

Answered by Josef Kufner on June 24, 2021

In Dia, export the figure into "Latex PGF Macro". So the file becomes xxx.tex

Modify the tex file and find something like: if you have latex symbol in the figure "&" such as:

{smooth ensuremath{blackslash}&} change it to
{smooth ensuremath{&}}

In the head of latex document, add

usepackage{tikz}

In the document use :

begin{figure*}
    label{fig-flowchart}
     centerline{
            resizebox{6in}{!}{input{newfig/flowchart.tex}}
    }
           caption{ The general flowchart of similarity learning process for quality assurance. }
end{figure*}

It works for me.

You can also use inkspace's export to pdf_tex, however, you should have tex written in the inkspace A's box, otherwise, there's newline and font problem.

Answered by Juan Huo on June 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP