0

I use JaxoDraw 2.1 to draw Feynman Diagrams as eps files for a document I am working on. In turn, JaxoDraw uses the axodraw4j package.

My problem is that when I include the eps figures in a document and compile through LaTeX+dvips+ps2pdf it works fine, but when I compile through PdfLaTeX the figure is out of place, with huge blank spaces and occupies a whole page.

Here is a MWE. The TeX code for the diagram generated by JaxoDraw is

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%     LaTex file generated by JaxoDraw-2.1-0
%%%         CreationDate: 6/2/2018
%%% Make sure you have the axodraw4j package installed in order to proceed!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[a4paper]{article}

\usepackage{axodraw4j}
\usepackage{pstricks}
\usepackage{color}

\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\headheight}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\footskip}{0pt}
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-2in}
\setlength{\textheight}{\paperheight}
\addtolength{\textheight}{-2in}

\pagestyle{empty}

\begin{document}

%%JaxoComment:
%%JaxoScale{1.0}

\begin{center}
\fcolorbox{white}{white}{
  \begin{picture}(116,150) (31,-27)
    \SetWidth{1.0}
    \SetColor{Black}
    \Photon(96,102)(96,38){7.5}{3}
    \Line[arrow,arrowpos=0.5,arrowlength=5,arrowwidth=2,arrowinset=0.2](32,-26)(96,38)
    \Line[arrow,arrowpos=0.5,arrowlength=5,arrowwidth=2,arrowinset=0.2](96,38)(144,-26)
    \Text(112,102)[lb]{\Large{\Black{$p_\mu$}}}
  \end{picture}
}
\end{center}

\end{document}

I compile this file using LaTeX+dvips+ps2pdf and generate an eps file, say "simple_diagram.eps". Then I use GSview to convert to eps again in order to get the correct bounding box. When I look at the final eps, it seems to have the right bounding box indeed.

Then I try to include the eps figure in a document,

\documentclass[a4paper,12pt]{article}

\usepackage{graphicx}

\begin{document}

Some text goes here, perhaps referring to a simple Feynman diagram, Fig.~\ref{simple_diagram}.

%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[ht]
\begin{center}
    \includegraphics[scale=1]{./simple_diagram}
    \caption{A simple Feynman diagram.}\label{simple_diagram}
    \end{center}
    \end{figure}
%%%%%%%%%%%%%%%%%%%%%

\end{document}

This compiles fine using LaTeX+dvips+ps2pdf, but if I want to use PdfLaTeX then hell breaks loose.

I tried the clip option of includegraphics, and many other things without success. I need a simple and portable solution, since the document I am working on has multiple authors.

I am sorry if the question is silly, I just do not understand much about how to use eps with pdflatex. Thanks in advance!

  • 1
    if you generate eps then you rely on pdflatex calling out to ghostview to generate pdf, you may as well generate pdf version of your image, or you could use the pstricks directly with pdflatex using the package that automates the calls to latex/dvips and ghostscript – David Carlisle Feb 6 '18 at 11:14
  • Thank you for your attention. I tried to include the pdf version of the figure which is generated from the above code compiled with LaTeX+dvips+ps2pdf. But this did not solve the problem. I also tried to compile the figure using pdflatex right away, but then the diagram does not show in the corresponding pdf, only the text $p_\mu$. But maybe I did not understand your suggestion right. – maunarciso Feb 6 '18 at 11:27
  • to use pstricks with pdflatex (there are some restrictions) you can use the auto-pst-pdf packagem several examples on this site tex.stackexchange.com/search?q=auto-pst-pdf – David Carlisle Feb 6 '18 at 12:09
1

You code seems to work correctly neither with xelatex nor with auto-psttdf + pdflatex.

I managed to obtain a .pdf file with a correct bounding box in this way:

  • Compile via latex+dvips
  • Convert the resulting .ps file to .pdf with Siep Kroonenberg epspdftk excellent tool, asking for computing a tight bounding box, like this:

enter image description here

  • You're welcom. Always glad to hep! – Bernard Feb 6 '18 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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