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.

Please Help me to get rid of the following error:

    ("C:\Program Files\MiKTeX 2.9\tex\latex\mytheorem\demonstration.sty"
Package: demonstration 


! LaTeX Error: Command \openbox already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.13   \vrule\hfil}}

Giving by this code source:

\documentclass[12pt,a4paper]{book}
    \usepackage{geometry}
    \usepackage{lipsum} 
    \usepackage[calcwidth,raggedright,bf,sf]{titlesec}
    \usepackage{blindtext}
    \usepackage{slashbox}
    \usepackage{tabularx}
    \usepackage{fancyhdr}
    \usepackage{fancybox}
    \usepackage{turnstile}
    \usepackage{bbding}
    \usepackage{shadethm}
    \usepackage{framed}
    \usepackage[Lenny]{fncychap}
    \geometry{left=-1cm, right=1cm, top=1.5cm, bottom=1.5cm}  
    \setlength{\shadeboxrule}{.4pt}
    \setcounter{tocdepth}{3}
    \def\mathbi#1{\textbf{\em #1}}
    \newlength{\shadowbaseline}
    \newcommand{\shadowbaselinebox}[1]{%
      \leavevmode
      \setlength{\shadowbaseline}
                        {\fboxsep+\fboxrule+\heightof{#1}}%
      \hbox{\vbox to \shadowbaseline{%
                  \hbox{\protect\shadowbox{#1}}}}%
    }
    \setlength{\paperwidth}{21cm}
    \setlength{\paperheight}{29.7cm}
    \setlength{\evensidemargin}{0cm}
    \setlength{\oddsidemargin}{0cm}
    \setlength{\topmargin}{-2.5cm}
    \setlength{\headsep}{0.7cm}
    \setlength{\headheight}{1cm}
    \setlength{\textheight}{25cm}
    \setlength{\textwidth}{17cm}
    \renewcommand{\theenumi}{\textbf{\arabic{enumi}}}
    \renewcommand{\labelenumi}{\textbf{\theenumi.}}
    \renewcommand{\theenumii}{\textbf{\alph{enumii}}}
    \renewcommand{\labelenumii}{\textbf{\theenumii.}}
    \everymath{\displaystyle\everymath{}}
    \pagestyle{fancy}
    \makeatletter
    \renewcommand{\chaptermark}[1]{%
       \markboth{%
         \ifnum \c@secnumdepth >\m@ne
           \if@mainmatter
             \@chapapp\nobreakspace
             \shadowbaselinebox{\thechapter}\nobreakspace
           \fi
         \fi
       #1}{}}
    \makeatother
    \fancyhead{}
    \fancyhead[RE]{ \scshape \leftmark}
    \fancyhead[LO]{\scshape  \nouppercase \rightmark }
    \fancyfoot{}
    \fancyfoot[RE]{ \scshape  \textsc{ My institut}} 
    \fancyfoot[LO]{ \scshape \textsc{Title} }
    \fancyfoot[LE,RO]{\shadowbaselinebox{\thepage}}
    \renewcommand{\headrulewidth}{0.5pt}
    \renewcommand{\footrulewidth}{0.5pt}
    \begin{document}
    \chapter{one}
    \limpsum
    \chapter{Two}
    \lipsum
    \end{document}
share|improve this question
    
Without a MWE is vey difficult to answer and it's not easy to find demonstration.sty. Surprise ! there are 121 packages inside the mytheorem's folder. The problem is simple : demonstration.sty uses \newcommand{\openbox} and openbox is already defined but where ? –  Alain Matthes Jan 19 '12 at 7:21
1  
As Altermundus pointed out, there is actually nothing wrong with the \vrule\hfil, it's just the code which follows on line 13 in that file. The real error message is ! LaTeX Error: Command \openbox already defined. of course. You should change the title of your question accordantly. –  Martin Scharrer Jan 19 '12 at 8:49
4  
Your example shows a lot of typical problems: Your preamble includes a bunch of packages you probably don't need (you forgot the kitchen sink), you have code you most likely don't need (redefining \chaptermark), and code that should be left to packages (you include geometry and set the page dimens directly). Start again with a minimal document. –  Martin Schröder Jan 19 '12 at 9:54
    
I do not seem to have the slashbox package, and is \limpsum intended to be \lipsum? Once I remove the slashbox package, add the calc package, and correct \limpsum, your example compiles for me. Please provide a [MWE]((meta.tex.stackexchange.com/questions/228/…)) that actually illustrates the problem. –  Peter Grill Jan 19 '12 at 19:51
add comment

2 Answers

The code tries to define the command \openbox, which is already defined. This leads to that error message. Check your file C:\Program Files\MiKTeX 2.9\tex\latex\mytheorem\demonstration.sty for this.

Very probably you already loaded a package, which defines \openbox. For example, amsthm and ntheorem both define it, and both in the same way:

\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}

You can see the commands

\vrule\hfil}}

from your error message.

Remove the package(s) from your preamble, which you don't need. And if you need it and you would like to keep it, don't define the same command again or use \renewcommand instead of \newcommand if it's your intention to change a macro definition.

share|improve this answer
add comment

try

\let\openbox\relax
\usepackage{demonstration}
share|improve this answer
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.