When I compile the following LaTeX code on my computer (macOS 10.14.5, running MacTeX-2019 which I just updated):




        \question[12] Why is the earth round?
        \question[12] Why is the sky blue?


I get the following output, with the "Total:" column incorrectly right-aligned and everything else correct.

total points misaligned

If I compile exactly the same code on ShareLatex, I get this:

total points correctly aligned

with the "Total:" column correctly centered.

Any idea what might be causing this? Here is the pdftex output from my local machine:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2018-12-01>
Document Class: exam 2017/12/17 Version 2.603 by Philip Hirschhorn
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size11.clo))) (./bad.aux)
This exam contains 2 questions with 0 parts, 0 subparts, and 0 subsubparts.
This exam has a total of 24 points.
This exam has a total of 0 bonus points.
(./bad.aux) )</usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm
Output written on bad.pdf (1 page, 15814 bytes).
Transcript written on bad.log.

1 Answer 1


The different behavior must be caused by using different versions of exam.cls. The log file from your local machine has the line

Document Class: exam 2017/12/17 Version 2.603 by Philip Hirschhorn 

near the top. I think I've spotted the bug in that version of exam.cls, but I'd like to be sure before I describe it here. Could you find the version of exam.cls that sharelatex is using, and show us that line from the log file on sharelatex?

Edit: Yes, I'm pretty sure that I've identified the bug. After I get a night's sleep and do some testing, I'll post a bugfix.

My apologies to all.

Further edit: I just created version 2.607beta of exam.cls, which fixes this bug. You can get this new version of exam.cls from my web page, at http://www-math.mit.edu/~psh/#ExamCls (you want the betatest version available there). You can either put this new version into the same directory with your latex file, or just use this version to replace the version of exam.cls that's installed on your system.

In case you're curious: when I reworked the table code for version 2.602beta, I left in an \hspace*{\fill} that had no business being there. I then managed not to have noticed the error through all the testing I did. (In some tables it's really obvious, but in others it either disappears or is very subtle.) The fix was to delete that \hspace*{\fill}.

@wolfson: Thanks very much for finding this bug. Again, my apologies to all.

  • I copy it to you: Document Class: exam 2015/05/07 Version 2.5 by Philip Hirschhorn. Yup, Overleaf hasn't update exam document class since 2015.
    – manooooh
    Jul 21, 2019 at 5:06
  • 1
    @manooooh Thank you! Yes, I'm more certain that I've identified the error, which was introduced in version 2.603. Let me test this tomorrow (after I've had a night's sleep) before I post the bugfix. Jul 21, 2019 at 5:15
  • 1
    @manooooh you beat me to it! thank you!
    – wolfson
    Jul 21, 2019 at 6:22
  • 1
    @PhilHirschhorn thank you for such a fast response! amazing!
    – wolfson
    Jul 21, 2019 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .