GeneralCommand 'caption@box'

LaTeX specific issues not fitting into one of the other forums of this category.
mimi04
Posts: 13
Joined: Tue Sep 03, 2019 1:17 pm

Command 'caption@box'

Post by mimi04 »

I am using packages and document class at preamble and at running time, latex editor gives following error. No idea what is happening:
'''''! LaTeX Error: Command \captionbox already defined.
Or name \end... illegal, '''''

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Command 'caption@box'

Post by Stefan Kottwitz »

This can be a conflict of the caption package with your document class. Which document class are you using?

Stefan
LaTeX.org admin
mimi04
Posts: 13
Joined: Tue Sep 03, 2019 1:17 pm

Command 'caption@box'

Post by mimi04 »

Stefan Kottwitz wrote:This can be a conflict of the caption package with your document class. Which document class are you using?

Stefan
\documentclass[12pt,twoside,a4paper,english]{book}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Command 'caption@box'

Post by Stefan Kottwitz »

And what is your document code, preamble, up to \begin{document}?

Stefan
LaTeX.org admin
mimi04
Posts: 13
Joined: Tue Sep 03, 2019 1:17 pm

Command 'caption@box'

Post by mimi04 »

Stefan Kottwitz wrote:And what is your document code, preamble, up to \begin{document}?

Stefan
\captionsetup[subfigure]{labelfont=rm}
\usepackage{fancyhdr}
\headsep = 1.0cm
\renewcommand{\headrulewidth}{0.2pt}% Default \headrulewidth is 0.4pt

\begin{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Command 'caption@box'

Post by Stefan Kottwitz »

The document class line and you code brings the error:

Code: Select all

! Undefined control sequence.
<recently read> \captionsetup 
                              
l.2 \captionsetup
                 [subfigure]{labelfont=rm}
The command \captionsetup is unknown. That's because you did not load the caption package. Add

\usepackage{caption}

before \captionsetup.

Stefan
LaTeX.org admin
mimi04
Posts: 13
Joined: Tue Sep 03, 2019 1:17 pm

Command 'caption@box'

Post by mimi04 »

Stefan Kottwitz wrote:The document class line and you code brings the error:

Code: Select all

! Undefined control sequence.
<recently read> \captionsetup 
                              
l.2 \captionsetup
                 [subfigure]{labelfont=rm}
The command \captionsetup is unknown. That's because you did not load the caption package. Add

\usepackage{caption}

before \captionsetup.

Stefan
-------------------------------------------------------------------
The problem not fixed yet, This what I have done:
-----------------------------------------------------------------------
\documentclass[12pt,twoside,a4paper,english]{book}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{cite}
\usepackage{babel}
\usepackage{empheq}
\usepackage{setspace}
\setstretch{1,3}
\usepackage{placeins}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\usepackage[left=2.5cm,right=2.5cm,top=1.5cm,bottom=4.5cm,includeheadfoot]{geometry}
\usepackage{amsmath,amsthm,amscd,latexsym, mathtools, eucal,epsfig,enumitem,bbold,color}
\usepackage{thmtools}
\usepackage{cases}
\usepackage{amssymb}
\usepackage{float}
\usepackage{txfonts}
\usepackage{pxfonts}
\usepackage{graphicx}
\pagestyle{myheadings}
\usepackage{arial}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage[pdfencoding=auto]{hyperref}

%\RenewDocumentCommand{\chapterbelowskip}{}{\vspace*{0pt}}
\titlespacing{\part}{0pt}{*0}{2ex}
\titlespacing{\section}{0pt}{2pt}{1ex}
\titlespacing{\subsection}{0pt}{2pt}{1ex}
\titlespacing{\subsubsection}{0pt}{*0}{1ex}

% suck up extra white space
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}

\renewcommand{\labelitemi}{$\bullet$}

\newcommand{\mb}{\mathbb}

\newtheorem{theorem}{Theorem}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{question}[theorem]{Question}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{exempl}[theorem]{Example}
\theoremstyle{remark}
\newtheorem{rem}{Remark}[section]
\def\ONE{{\mathbb{1}}}%\mathds{1} with package dsfont

\captionsetup[subfigure]{labelfont=rm}

\usepackage{fancyhdr}
\headsep = 1.0cm
\renewcommand{\headrulewidth}{0.2pt}% Default \headrulewidth is 0.4pt

\begin{document}

\bibliographystyle{plain}
\setcounter{tocdepth}{2}
\renewcommand\thepage{\roman{page}}
\renewcommand\thepage{\arabic{page}}

\setcounter{page}{1}

\newpage
\tableofcontents
\thispagestyle{empty}
\hfill
\renewcommand{\contentsname}{Contents}
\newpage

\pagestyle{fancy}
\renewcommand\chaptermark[1]{\markboth{\thechapter\ #1}{}}
\fancyhf{}
\fancyhead[L]{\bfseries\leftmark}
\fancyhead[R]{\bfseries\thepage}
\setcounter{page}{1}
\addcontentsline{toc}{chapter}{\large{Introduction}}
\begin{center}\LARGE{\textbf{Introduction}}\end{center}
---------------------------------------------------------------------------------------
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Command 'caption@box'

Post by Stefan Kottwitz »

There's no error in this code.

Can you post the .log file, as attachment here? The attachment link is below the text edit field, when writing a post.

Stefan
LaTeX.org admin
mimi04
Posts: 13
Joined: Tue Sep 03, 2019 1:17 pm

Command 'caption@box'

Post by mimi04 »

.log file is as follows:
Attachments
ESAY2019.log
(77.46 KiB) Downloaded 318 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Command 'caption@box'

Post by Stefan Kottwitz »

Do you have a file caption.sty in your document directory? If yes, then delete it or rename it. Seems there is an old version. From the .log file:

Code: Select all

(caption.sty
Package: caption 2012/02/19 v3.2f Customizing captions (AR)

("C:\Users\...\AppData\Local\Programs\MiKTeX 2.9\tex/latex/caption\caption3.sty
"
Package: caption3 2018/09/12 v1.8c caption3 kernel (AR)
First, a current caption package would print "Package: caption 2019/09/01 v3.3d Customizing captions (AR)". Second, there is no C:\Users\...\AppData\Local\Programs\MiKTeX 2.9 path for caption.sty.

Stefan
LaTeX.org admin
Post Reply