I'm very new to LaTeX and keep getting "Undefined Control Sequence" with the very first line of my attempt to test creating my own .sty package. Here's the code:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{blah}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{EB Garamond 12}
\linespread{1.6}
\endinput

The error is in line 1. I've retyped the command faithfully from examples and even copied it straight, but same error. I noticed that the 'X' in "NeedsTeXFormat" needs to be capitalized. I just can't figure out what's going wrong.

  • Are you actually running latex? Show the complete log-file. – Ulrike Fischer Nov 9 at 12:24
  • 6
    Make sure you are not actually trying to compile the sty file itself. That won't work. – Steven B. Segletes Nov 9 at 12:25
  • 4
    the only purpose of the \NeedsTeXFormat{LaTeX2e} command is to generate an error if the file is used with a format other than LaTeX2e, so most likely you are using plain TeX rather than LaTeX. (pdftex command rather than pdflatex) – David Carlisle Nov 9 at 12:43
  • 1
    Are you trying to run TeX on the .sty file? – egreg Nov 9 at 13:40

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.