Sunday, July 3, 2011

LaTeX article Documentclass and the \abstract Command

Recently a friend on mine asked me to take a look at one of her LaTeX documents and specifically try to work out why the caption text width and font size was different to that of the paragraphs. After a quick look at the source, I realised this wasn't going to be as straightforward as I thought. A bit of searching around on the Internet didn't help either - I only came across information stating that caption text is formatted the same way as the paragraph text by default. While I was able to verify this was the case for simple documents, I was unable to get this working within the document in question. So, switching to debugging mode, I stepped through each of the packages in use and removed them to verify that they weren't the cause of the problem. However, after having removed all of the packages, the problem remained. Satisfied that we weren't providing any funky configuration anywhere, I tried to cut out the noise from the source and reproduce it using the least LaTeX source possible. After a bit of trial and error, I was able to identify the cause of the problem -- a humble \abstract{...} command. The below source will reproduce the problem we were encountering: \documentclass[11pt \begin{document} \title{\LaTeX\ atricle Documentclass and the \\abstract Command} \author{Kevin} \maketitle \abstract{This is the abstract} \section{This is a section} Here is the beginning of a section which will show that the caption text of a figure is wider and formatted differently than the normal paragraph text. \begin{figure} \centering \caption{We don't even need to include a graphic in order to demonstrate that the caption text is wider and formatted differently than the normal paragraph text.} \end{figure} \end{document} Once I had identified that the abstract was causing the problem, I replace \abstract{...} with \begin{abstract}...\end{abstract} and the problem was resolved. I tried to find any on-line references explaining the different between the two approaches for creating abstracts but was unable to find any (if anyone can point me to a good reference, please comment). Anyway, a note to self (and anyone else) to use \begin{abstract}...\end{abstract} rather than \abstract{...}.

No comments:

Post a Comment