welcome: please sign in
location: Diff for "Computer/Latex/ConvertingPsfrag"
Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2019-05-20 13:06:32
Size: 844
Editor: leif
Comment:
Revision 5 as of 2019-05-22 12:50:28
Size: 1716
Editor: leif
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
The package `{psfrag}` only works with the route latex -> dvipdf (or latex -> dvips -> ps2pdf), and not directly with pdflatex or lualatex. One way to get around this problem is to convert the whole figure, including `{psfrag}`, to a .pdf figure, which can then be included directly. In order to do that, start with the following template:
{{{
The package `{psfrag}` only works with the route latex -> dvipdf (or latex -> dvips -> ps2pdf), and not directly with pdflatex or lualatex. One way to get around this problem is to convert the whole figure, including `{psfrag}`, to a .pdf figure, which can then be included directly. In order to do that, start with the template `psfragmall.tex`: [[attachment:psfragmall.tex|Download psfragmall.tex|&do=get]]
{{{latex
Line 16: Line 16:
  \includegraphics[width=0.9\textwidth]{figure.eps}   \includegraphics[width=0.9\textwidth]{psfragmall.eps}
Line 18: Line 18:
}}}
xxx
latex}}}
After renaming to a suitable name, and replacing font and width, move the `\psfrag`-statements from the original figure to this file. Process it with latex -> dvips -> ps2pdf. The result is a complete pdf-figure, which can be included in the original place, typically with statements like:
{{{latex
\centering
\includegraphics{figure}
\caption{...}
latex}}}
Note that there should be no `[width=...]` specification, because this should be taken care of in the conversion file. As a quick reference, the following table shows the `\textwidth` for some typical documents.
||<style="font-weight: bold;width:200px;">Document type||<style="font-weight: bold;width:200px;">\textwidth||
||LTHthesis||117mm||
||Beamer presentation||108mm||
||Two column journal or conference article||80mm||

Converting psfrag for use with pdflatex and lualatex

The package {psfrag} only works with the route latex -> dvipdf (or latex -> dvips -> ps2pdf), and not directly with pdflatex or lualatex. One way to get around this problem is to convert the whole figure, including {psfrag}, to a .pdf figure, which can then be included directly. In order to do that, start with the template psfragmall.tex: Download psfragmall.tex

\documentclass{standalone}
\usepackage{graphicx,psfrag}
\usepackage{schoolbook}   % Choose the same font as your document.
\textwidth=117mm          % Set the same width as your document.
\begin{document}
  \psfrag{M}[l][l]{Mätsignal}
  \psfrag{S}[l][l]{Styrsignal}
  \psfrag{L}[][]{$L$}
  \includegraphics[width=0.9\textwidth]{psfragmall.eps}    
\end{document}

After renaming to a suitable name, and replacing font and width, move the \psfrag-statements from the original figure to this file. Process it with latex -> dvips -> ps2pdf. The result is a complete pdf-figure, which can be included in the original place, typically with statements like:

\centering
\includegraphics{figure}
\caption{...}

Note that there should be no [width=...] specification, because this should be taken care of in the conversion file. As a quick reference, the following table shows the \textwidth for some typical documents.

Document type

\textwidth

LTHthesis

117mm

Beamer presentation

108mm

Two column journal or conference article

80mm

Computer/Latex/ConvertingPsfrag (last edited 2019-05-22 15:15:38 by leif)