Graphics, Figures & Tablespdftricks, subfig | Possible Package Incompatibility

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
lsolano
Posts: 1
Joined: Tue Sep 11, 2012 2:16 am

pdftricks, subfig | Possible Package Incompatibility

Post by lsolano »

I am using pdftricks to do some graphics, and everything works fine. My problem is when I need to put 2 pstricks graphics side by side using subfig, it doesn't compile and got the following error:

Code: Select all

./test.tex:30: Argument of \next has an extra }.
<inserted text> 
                \par 
l.30 }

Code: Select all

\documentclass[10pt, conference, compsocconf]{IEEEtran}

\usepackage[caption=false]{subfig}

\usepackage{ifpdf}
\ifpdf%
  \usepackage{pdftricks}
  \begin{psinputs}
    \usepackage{pstricks}
    \usepackage{pst-plot}
    \usepackage{pstricks-add} % <- added this line!
  \end{psinputs}
\else
  \usepackage{pstricks}
  \usepackage{pst-plot}
  \usepackage{pstricks-add} % <- added this line!
  \newenvironment{pdfpic}{}{}
\fi

\begin{document} 
\begin{figure}% 
\centering 
\subfloat[Capt 1]{
\begin{pdfpic}
\begin{pspicture}(-1,-1)(6,6)
\pspolygon(2.65,3.75)(3,3.35)(2.65,2.95)(2.65,3.175)(2.15,3.175)(2.15,3.525)(2.65,3.525) 
\end{pspicture}
\end{pdfpic}
} 
\qquad 
\subfloat[Capt2 2]{\includegraphics[scale=0.3]{tool}} 
\caption{Here are the first two figures of a continued figure.}% 
\label{fig:cont}%
\end{figure}
\end{document} 
The pdfpic code works if tested in a figure environment.

I would appreciate any help on this issue, because I've spend 2 days in this thing and no luck yet.

Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pdftricks, subfig | Possible Package Incompatibility

Post by localghost »

Instead of pdftricks I would use the auto-pst-pdf package to allow PSTricks code with PDFLaTeX.

An alternative that works natively with PDFLaTeX would be to use the pgf/tikZ package.


Best regards and welcome to the board
Thorsten
dllud
Posts: 1
Joined: Wed Jul 01, 2015 7:37 pm

pdftricks, subfig | Possible Package Incompatibility

Post by dllud »

Currently the best option to use PSTricks code with PDFLaTeX is:
\usepackage[pdf]{pstricks}

It is compatible with subfig. The following code works flawlessly:

Code: Select all

\documentclass{article}
\usepackage[pdf]{pstricks}
\usepackage{pst-plot}
\usepackage{pstricks-add}
\usepackage[caption=false]{subfig}
\begin{document}
	\begin{figure}
		\centering
		\subfloat[Capt 1]{
			\begin{pspicture}(-1,-1)(6,6)
				\pspolygon(2.65,3.75)(3,3.35)(2.65,2.95)(2.65,3.175)(2.15,3.175)(2.15,3.525)(2.65,3.525)
			\end{pspicture}
		}
		\qquad
		\subfloat[Capt2 2]{
			\begin{pspicture}(-1,-1)(6,6)
				\pspolygon(2.65,3.75)(3,3.35)(2.65,2.95)(2.65,3.175)(2.15,3.175)(2.15,3.525)(2.65,3.525)
			\end{pspicture}
		}
		\caption{Here are the first two figures of a continued figure.}
		\label{fig:cont}
	\end{figure}
\end{document}
Remember to compile it with -shell-escape
Post Reply