3

I am trying to compile the following code that contains a biography at the end such that

\newif\iffinal
\finaltrue 
%\finalfalse
\iffinal
\documentclass[]{IEEEtran} %
\else
\documentclass[11pt,onecolumn,draftcls]{IEEEtran} %
\fi

\usepackage[ruled,vlined,linesnumbered]{algorithm2e}

\usepackage{ifpdf}
\ifpdf
\usepackage[]{graphicx}
\else
\usepackage[draft]{graphicx}
\fi

\SetKw{return}{return}
\SetKw{throw}{throw}
\SetKw{event}{event}
\SetKw{break}{break}

\begin{document}

......

\begin{IEEEbiography}{Name} 
received his B.S degree from.......
\end{IEEEbiography}

\end{document}

I keep getting an error

use of \\ieeebiography doesnt match its definition. 
Argument of \@break has an extra }
Runaway argument?
Extra }, or forgotten \endgroup.

After trying so many times, I realized that what's causing this issue is the \SetKw{break}{break} which I use as a keyword in my algorithms.

How can I define the word break without causing this issue?

  • 1
    Welcome to TeX.SX! The example doesn't stop for me. – egreg Aug 27 '18 at 17:46
  • 1
    The culprit is \SetKw{break}{break}, which defines \break to give 'break' in pseudocode listings. But IEEEbiography needs \break with a different meaning. Hence the clash. If you can live without \break in your pseudocode just drop \SetKw{break}{break}, if you absolutely need 'break' rename the macro \SetKw{algbreak}{break} lets you use \algbreak. – moewe Aug 28 '18 at 10:06
1

A minimal example that reproduces the issue is

\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage{duckuments}

\usepackage{algorithm2e}

\SetKw{break}{break}

\begin{document}
\begin{algorithm}
\While{condition}{%
  \break
}
\end{algorithm}

\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{example-image-duck}}]{Prof.\ van Duck}
Prof.\ van Duck is an esteemed scientist at the University of Quackland.
\end{IEEEbiography}
\end{document}

The issue is that \SetKw{break}{break} redefines \break which is defined in latex.ltx as \def\break{\penalty-\@M} without further warning. The documentation of algorithm2e documentation mentions this briefly in §11.

The IEEEbiography environment uses \break, but since it has been redefined to mean something completely different that command now causes an error.

A simple solution would be to pick a different command name for your break instruction in algorithm2e

\documentclass{IEEEtran}
\usepackage{graphicx}
\usepackage{duckuments}

\usepackage{algorithm2e}

\SetKw{algobreak}{break}

\begin{document}
\begin{algorithm}
\While{condition}{%
  \algobreak
}
\end{algorithm}

\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{example-image-duck}}]{Prof.\ van Duck}
Prof.\ van Duck is an esteemed scientist at the University of Quackland.
\end{IEEEbiography}
\end{document}

condensed screenshot of the output

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.