2

I am trying to compile this code with "latex" (not pdflatex).

I got the code itself from a collegue, so it should work. Except maybe the way I compile it and the usepackage options?

Right now, I am getting the error:

" ...graphics[width = 0.54\textwidth]{SVM2.eps ! Undefined control sequence."

I shouldn't use graphics in Latex right? Since it is an eps figure. Any ideas?

The eps file is available here.

UPDATE

I forget to include some newcommands, as was remarked below. This is the corrected code. It compiles, but the substitutions appear next to the graph. I thought they were supposed to come inside the graph.

\documentclass{article} 
%  \usepackage{graphicx}
\newcommand{\vecbeta}{\boldsymbol{\beta}}
\newcommand{\vecX}{\mbox{\boldmath$x$}}
\newcommand{\vecW}{\boldsymbol{w}}
\newcommand{\natnumbers}{\ensuremath{\mathbb{R}}}
\newcommand{\varphibold}{\mbox{\boldmath$\varphi$}}\newcommand{\vecvarphi}{\mbox{\boldmath$\varphi$}}
\newcommand{\xibold}{\mbox{\boldmath$\xi$}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\ul}{\underline}
\newcommand{\nubold}{\mbox{\boldmath$\nu$}}
\newcommand{\alphabold}{\mbox{\boldmath$\alpha$}}
\def\bkRrm{{\rm I\kern-.17em R}}
\usepackage{tikz}
 \usepackage{pstool}
\usepackage{psfrag}
\begin{document}   
\begin{psfrags}
\psfrag{x}[][]{x}
\psfrag{+}[][]{+}
\psfrag{E1}[][]{\ \ \ \footnotesize{${\bf w}^T\varphibold({\bf x})+b=-1$}}
\psfrag{E2}[][]{\ \ \ \ \footnotesize{${\bf w}^T\varphibold({\bf x})+b=0$}}
\psfrag{E3}[][]{\ \ \ \ \footnotesize{${\bf w}^T\varphibold({\bf x})+b=+1$}}
\psfrag{E4}[][]{$\varphibold_1({\bf x})$}
\psfrag{E5}[][]{$\varphibold_2({\bf x})$}
\psfrag{E6}[][]{$2/||{\bf w}||$}
\psfrag{E7}[][]{Class +1}
\psfrag{E8}[][]{Class -1}
  \includegraphics[width = 0.54\textwidth]{SVM2.eps}
  \end{psfrags}
\end{document}

enter image description here

  • You can use graphicx in latex or pdflatex however you don't need to explicitly refer to it as it is loaded by psfrag – David Carlisle Jun 28 '13 at 10:59
4

You don't show the important part of the error message. The undefined command is \varphibold.

From the name I guess you want a definition like

\usepackage{bm}
\newcommand\varphibold{\bm{\varphi}}

using latex, dvips, ps2pdf`, on the posted code I get the expected result:

enter image description here

  • Oh, you are absolutely right, I forgot to paste my newcommands in the file. I have edited my original question. This time, no compile errors, but the substitutions appear next to the picture. – dorien Jul 1 '13 at 8:49
  • 1
    @dorien works for me, see update. – David Carlisle Jul 1 '13 at 9:26
  • Thanks, apparently the dvips is a necessary step, that fixed it! – dorien Jul 1 '13 at 9:37

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.