Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I took the STY files(elsarticle.zip) from the following link - http://www.elsevier.com/wps/find/authorsview.authors/elsarticle#models

I am using program package and I want to include the keywords in my paper. However, whenever I include the program package, I get an error.

! Extra }, or forgotten \endgroup.
\endkeyword ->\par \egroup                            
l.34 \end{keyword}

Here is my latex code, which I have stripped down to see if there was any error. If I remove the program package, it works perfectly fine. Or otherwise if I remove the Keywords part, then also it compiles just fine. However, I need both of them. Could anyone please help?

\documentclass[preprint,1p]{elsarticle}
\usepackage{etex}
\usepackage{amssymb,amsmath}
\usepackage{cite}
\usepackage{array}
\usepackage{url}
\usepackage{multirow}
\usepackage{listings}
\usepackage{epstopdf}
\usepackage{color}
\usepackage{tikz}
\usepackage{program}
\usepackage{pgfplots}
\usepackage[tight,footnotesize]{subfigure}
\usepackage{comment}
\usepackage{soul}
\graphicspath{{./Figures/}}
\journal{Microprocessors and Microsystems}
\begin{document}
\begin{frontmatter}

\title{Title of my report}

\begin{keyword}
 keyword1 \sep keyword2 \sep keyword3 \sep keyword4
\end{keyword}

\end{frontmatter}
\end{document}
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

You can keep the syntax with the following trick for loading program:

\makeatletter
\let\elsarticle@keyword\keyword
\g@addto@macro\frontmatter{\let\keyword\elsarticle@keyword}
\makeatother
\usepackage{program}

Then you can still say

\begin{frontmatter}

\title{Title of my report}

\begin{keyword}
 keyword1 \sep keyword2 \sep keyword3 \sep keyword4
\end{keyword}

\end{frontmatter}

and use \keyword as defined by program in the body of your document. I think that the copy editors of the journal you're submitting the paper to will be happier if the syntax is not modified.

share|improve this answer
add comment

The keyword environment macros can be saved with a different name, before you load the program package, which defines its own \keyword macro:

\let\elskeyword\keyword
\let\endelskeyword\endkeyword
\usepackage{program}
...
\begin{frontmatter}
\title{Title of my report}
\begin{elskeyword}
  keyword1 \sep keyword2 \sep keyword3 \sep keyword4
\end{elskeyword}
\end{frontmatter}
share|improve this answer
    
Thanks a lot Stefan ! The answer worked perfectly fine. Just a doubt that the command keyword was modified by the program package? –  Raj Aug 28 '12 at 13:54
    
program.sty uses \keyword for markup, such as bold or uppercase. For example, from program.sty: ... \def\keyword##1{\mbox{\normalshape\bf\sf ##1}}% ... –  Stefan Kottwitz Aug 28 '12 at 14:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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