Graphics, Figures & TablesRenewing a command

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
albart
Posts: 13
Joined: Mon Jul 06, 2009 12:54 pm

Renewing a command

Post by albart »

Hello,

Hopefully my question is not to obvious, at least I have been struggling with it for a long time and did not find a solution.

I am finishing a manuscript for one of the BMCMed journals. The journal requires me to place tables and figures at the end of the manuscript, as described in this article: http://www.latex-community.org/index.ph ... Itemid=112 . I am trying to follow his suggestions but repeatedly I am having problems that Latex tells me that \begin{document} is missing. The following code works runs well:

Code: Select all

\documentclass[10pt]{article}

\usepackage[english]{babel}
\usepackage{endfloat}

\begin{document}
\title{Example}
\maketitle

\begin{table}[p]
  \caption{Caption}
  \begin{center}
    \begin{tabular}{ll}\hline
      0.01&2 (1)\\
      0.25&19 (9)\\
    \end{tabular}
    
  \end{center}
  
\end{table}

\end{document}
Now, following the example described in http://www.latex-community.org/index.ph ... Itemid=112, I try to adapt the list of tables at the end of my article by renewing the following commands:

Code: Select all

\documentclass[10pt]{article}

\usepackage[english]{babel}
\usepackage{endfloat}

\renewcommand{\@makecaption}[2]{{\centering\vskip\abovecaptionskip \bfseries #1} #2}
\newcommand{\@makecaptionZ}[2]{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{#1}%
  \ifdim \wd\@tempboxa >\hsize
    #1\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}


\begin{document}
\title{Example}
\maketitle

\begin{table}[p]
  \caption{Caption}
  \begin{center}
    \begin{tabular}{ll}\hline
      0.01&2 (1)\\
      0.25&19 (9)\\
    \end{tabular}
    
  \end{center}
  
\end{table}

\end{document}

where I simply copied the code from the mentioned article. If I compile this, latex tells me " missing \begin{document}, which is clearly in the document.

Hopefully you can indicate what I am doing wrong in this example. I am using latex Version 3.141592-1.40.3 on a Fedora Core 11 system.

Thanks in advance,

Albart Coster

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: Renewing a command

Post by josephwright »

You need to make @ a letter to alter \@makecaption. Surround your adaptations with \makeatletter ... \makeatother.
Joseph Wright
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Renewing a command

Post by localghost »

For standard classes the sidecap package does exactly the same thing. Other classes like memoir or those of the KOMA Script bundle have built-in features.


Best regards and welcome to the board
Thorsten
albart
Posts: 13
Joined: Mon Jul 06, 2009 12:54 pm

Re: Renewing a command

Post by albart »

Thanks for your help and for the welcome to the forum. Adding \makeatletter before the definition and \makeatother after the definition solved the problem.

Albart
Post Reply