1

I want to be able to put .png images in my document and as well drawings with the package axodraw2. The problem is that to draw a picture and see it in the document I have to compile with LaTeX + dvips + ps2pdf + View Pdf and to see and ordinary .png image I have to compile with Pdf LaTeX + View Pdf.

For example, if I write the following things, which includes an image and a drawing with axodraw2

\documentclass{article}
\usepackage{amsmath}
\usepackage{axodraw2}
\usepackage{slashed}
\usepackage{amsmath}

\begin{document}

\begin{figure}
\includegraphics[scale=0.5]{lightcone}
\end{figure}

\begin{center}
\begin{axopicture}(130,150)
\SetColor{Black}
\Text(70,130){\begin{small}$Im\{p^0\}$\end{small}}
\Text(180,30){\begin{small}$Re\{p^0\}$\end{small}}
\Text(45,40){$\times$}
\Text(95,20){$\times$}
\Text(130,90){$\Gamma$}
\Arc[arrow](70,27)(80,0,90)
\Arc[arrow](70,27)(80,90,180)
\Line[arrow](-10,27)(70,27)
\Line[arrow](70,27)(150,27)
\SetWidth{2}
\LongArrow[arrowscale=0.8](70,20)(70,120)
\LongArrow[arrowscale=0.8](-20,30)(160,30)
\end{axopicture}
\end{center}

\end{document}

And try to compile with Pdf LaTeX + View Pdf I get (the drawing should appear below the image but only the letters that are in the drawing appear)

enter image description here

If I doesn't include the image and I compile with LaTeX + dvips + ps2pdf + View Pdf I get the drawing with axodraw2 right

enter image description here

And including both and trying to compile with LaTeX + dvips + ps2pdf + View Pdf yields and error message

enter image description here

Is there a way to include .png images and use axodraw drawings in the same document? I would really appreciate some help. Thanks for the attention.

Slayer147
  • 197

1 Answers1

0

Yes, see the axodraw manual section 4.3.3.

By running an auxiliary program, similar to the way you run BibTeX or Biber for bibliographies, you can use axodraw2 with pdflatex. The compilation sequence becomes

pdflatex filename
axohelp filename
pdflatex filename

I think it should be possible to run axohelp from Texmaker (User -> User commands), but I couldn't make it work. But running from a terminal should work.

Torbjørn T.
  • 206,688
  • When I write axohelp it appears command not found, but I have axohelp.exe in my folder. Am I doing right? I haven't much experience with the ubuntu terminal. – Slayer147 Jul 21 '18 at 18:09
  • @Slayer147 Ehm, I'd expect that axohelp was installed along with the axodraw2 package in TeX Live, you shouldn't need to manually place an executable somewhere (I didn't at least). I'd also expect that a .exe file was a Windows executable, don't know if it would work on Linux. (I've never used axodraw/axohelp before, I just opened the manual, found the section I referred to, and tested it successfully with your example, so I don't really know much about it. Personally I'd use TikZ for a diagram like that.) – Torbjørn T. Jul 21 '18 at 20:14
  • I download this files for axodraw2 https://ctan.org/tex-archive/graphics/axodraw2 – Slayer147 Jul 21 '18 at 21:27
  • For Ubuntu, if you downloaded the files manually, you also need to create the executable manually (the axohelp.exe file is only for Windows and does not work in Ubuntu). See the INSTALL file on CTAN (i.e., the link you mentioned) for instructions. – Marijn Jul 21 '18 at 21:43
  • Note that, instead of downloading manually from CTAN, it is easier to install packages using the TeX Live package manager, called tlmgr, or using Ubuntu packages with apt (see e.g. https://packages.ubuntu.com/search?keywords=texlive&searchon=names&suite=bionic§ion=all for a list). That takes care of package installing, dependencies, search paths etc. – Marijn Jul 21 '18 at 21:47
  • I think the problem is that I need to compile the axohelp.c file, but typing the given commands (for example, gcc -o axohelp -Wall -O3 axohelp.c) doesn'to do nothing. – Slayer147 Jul 21 '18 at 22:06
  • Trying to compile axohelp.c gives me a lot of errors like axohelp.c:(.text+0x17fb): undefined reference to sqrt' /tmp/ccbAyYFj.o: In functionArcSegment': axohelp.c:(.text+0x1911): undefined reference to tan' axohelp.c:(.text+0x1944): undefined reference tocos' axohelp.c:(.text+0x1960): undefined reference to sin' axohelp.c:(.text+0x19d0): undefined reference tocos' axohelp.c:(.text+0x19ec): undefined reference to sin' /tmp/ccbAyYFj.o: In functionLengthBezier': axohelp.c:(.text+0x2650): undefined reference to sqrt' axohelp.c:(.text+0x2722): undefined reference tosqrt' – Slayer147 Jul 21 '18 at 22:21
  • @Slayer147 Debugging things like that is beyond me, I can't help there. As Marjin said though, it's usually better to install packages via a package manager. I never had to compile axohelp because a compiled version was part of the installation of TeX Live (which I installed following https://tex.stackexchange.com/a/95373/, more or less). – Torbjørn T. Jul 22 '18 at 07:10
  • 1
    @Slayer147 those errors look like a problem with finding libraries, this is a rather complex topic which is out of scope for this site. You could search on Stack Overflow for 'c undefined reference to' it you feel like spending more time on it. On topic: there is an alternative solution to first compile the the axodraw figure with LaTeX-dvips-ps2pdf as a standalone document, and then include that pdf with \includegraphics in your main document (which is probably more or less what axohelp will do for you automatically). – Marijn Jul 23 '18 at 11:09
  • Thanks for the comments, I will try this week to do the installation with TeX Live as mentioned in the previous comments. If it works I will close the post. Regards. – Slayer147 Jul 24 '18 at 14:38