About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.


2 Building Up

With the building up approach, you start with the document:

\documentclass{article}
\begin{document}
\end{document}
and add to it until you encounter your problem. If your problem requires the use of \chapter, then replace article with either report or book.

This section illustrates the building up approach with an example. Suppose your problem document looks something like:

\documentclass{myuniversityscustomclass}

\usepackage[french,USenglish]{babel}
\usepackage[mmddyyyy]{datetime}
\usepackage{nonstandardpackage}
\usepackage{anothernonstandardpackage}
% lots of other packages that may or may not be standard

% lots of your own definitions

\author{John Doe}
\title{Astounding Discoveries}

\begin{document}
\maketitle
\tableofcontents
\listoffigures
\listoftables

% 300 or so pages of text, graphics, tables, bibliography and
% sundry other stuff

\end{document}

Let's suppose that your problem is that the date on the title page looks like November 14, 2008, but you are expecting it to appear in the form 11/14/2008. You have already checked that you used the option mmddyyyy when you loaded the datetime package, so what's gone wrong?

Since you haven't used \date, the date on the title page is generated using \today, so the fault must lie in the definition of \today. It looks like it might be a bug in the datetime package, so what should you do? This happens to be one of my packages,3 but if you send me your entire 300 page document plus several hundred graphics files and a large bibliography file, I won't be best pleased. Aside from filling up my inbox, I don't have your university's custom class file, nor am I likely to have the non-standard packages installed on my system, so I won't be able to test the document. At which point you'll either get a request for a minimal example, or I'll think “forget that, I'll look at it some other day” (or words to that effect) and then several days, or possibly weeks, later you'll get a request for a minimal example.4

You've already worked out that the problem must lie with the command \today. So that needs to go in the minimal example. You want to use the datetime package to change the format of this command, so that package needs to go in the minimal example, with the package options you have specified in your original document:

\documentclass{article}
\usepackage[mmddyyyy]{datetime}
\begin{document}
\today
\end{document}

Call this file, say, test.tex, and run LaTeX on it. Have a look at the output. The output looks fine, so perhaps one of the other packages you have loaded has caused the problem. One by one try each of the packages you have in your problem document, in the same order. If adding the package has no effect on the output, then delete that package from the test file, and go on to the next one. For example, the problem document loads the babel package, so add that package to the test file using the same options that you used in your problem document. The minimal example should now look like:

\documentclass{article}
\usepackage[french,USenglish]{babel}
\usepackage[mmddyyyy]{datetime}
\begin{document}
\today
\end{document}
Now run it through LaTeX, and check the result. The output has changed to November 14, 2008, instead of 11/14/2008. This test file now reproduces the error, but is only six lines instead of several hundred or possible thousand lines.

What next? Check the datetime documentation to see if it mentions the babel package. The datetime documentation comes in both PDF and HTML format. Most PDF and HTML viewers have a function that allows you to search the document or page for a given word, so search for the word “babel”. This should lead you to the sentence which states that the babel package must be loaded before the datetime package. Check the test file. In this test file, the babel package has been loaded first.

Now what? In this case, there is a FAQ for the datetime package (http://www.dickimaw-books.com/faqs/datetimefaq.html) so that's the next place to look. This FAQ covers the most commonly used packages that I have written.5 If you look at the table of contents for the datetime section, you should see the entry “The date is in another language or in the wrong format”. This fits the problem, so click on that link and have a look at the answer. The answer indicates that there was a bug in an earlier version of the datetime package that caused a problem when used in conjunction with the babel package, but the bug has been fixed. So the next thing to do is check which version you are using. Add the command \listfiles to the test file:

\listfiles
\documentclass{article}
\usepackage[french,USenglish]{babel}
\usepackage[mmddyyyy]{datetime}
\begin{document}
\today
\end{document}
At the end of the log file there should now be a list of all the files that have been loaded, along with their release dates and versions. Check the version of the datetime package. Is it the latest version? If not, download the latest version and try again. If it is the latest version, then send the author (me, in the case of the datetime package) the test file and its log file. If you check the package documentation, you should either find the author's contact details or a link to a bug reporting tool.

If the conflicting package is one that is not publicly available (for example, it's your university's custom package that can only be downloaded from a restricted site) then send your query to the author of that package. If the conflicting package is publicly available, but is not on CTAN, then specify from where it can be downloaded.



Footnotes

... packages,3
although it's now been replaced by datetime2
... example.4
Actually, these days I'll just ask you to post your bug report on my bug report form.
... written.5
or more precisely, it covers the packages that I get the most post about.

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs