TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to create my own error message that is given if the main font size isn't set to 11pt and then the compilation of the document begin stopped?


I'm trying to write a package, and I use:

\documentclass{scrreprt}%or scrbook or scrartcl

share|improve this question
Isn't it easier to just set the font size, since you want to stop the compilation if it is something else? – Peter Grill Sep 26 '12 at 21:17
up vote 9 down vote accepted

If you're writing a package, say foo.sty then

      {Illegal font size option detected.\MessageBreak
       This is a fatal error, I'll stop the run}
      {You have specified a point size different from\MessageBreak
       the unique size this package supports, which is 11pt.\MessageBreak
       Correct your input file}

will do.

share|improve this answer
if could help, I have updated my question. Another thing, I haven't understand why I need to ensure that the 11pt option is correctly passed to the main class. And exactly where I must put that code. Thanks. – FormlessCloud Sep 26 '12 at 22:01
@FormlessCloud The code should be in your package. I've removed the references to a class. – egreg Sep 26 '12 at 22:10
Sure, but I was referring to the deleted code: \LoadClassWithOptions... – FormlessCloud Sep 26 '12 at 22:14
@FormlessCloud Since you're not writing a class, that code means nothing. – egreg Sep 26 '12 at 22:18
Ok thanks, it was only to know something more. – FormlessCloud Sep 26 '12 at 22:28

If you're using one of the standard document classes (article, book or report), the macro \@ptsize contains 1 if you're using 11pt:

  \newcommand{\@ptsizetest}{1}% Equivalent to 11pt for a document class option.
      {You need to use 11pt font size}% Error message
      {Add this as a document class option [11pt]}% Help text
Test document

This creates the error

LaTeX Error: You need to use 11pt font size.

If you're using other packages that define the font size, some more work is required.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.