0

I'm trying to make a .sty file with all the packages and things that I use often, but I'm getting an egregious number of errors. Most of them are to do with the specific packages I am using

(for instance: Package geometry Error: \paperwidth (0.0pt) too short.) even though these packages cause no problems in my other documents,

but the one that I think is crucial is "Emergency stop. <*> main.sty *** (job aborted, no legal \end found)"

Here is the code:

\RequirePackage[utf8]{inputenc}
\RequirePackage{ upgreek }
.... %a whole bunch of packages
\newcommand{\R}{\mathbb{R}}
.... %a whole bunch of commands
\endinput

I've tried various random things such as removing \endinput and putting \begin{document} \end{document} at the end, and adding a \documentclass{article} at the top, but I don't really know what I'm doing and none of them have worked.

I am using overleaf, if that makes a difference.

2
  • 1
    that (most likely) means that you are running latex on main.sty instead of running it on a document that does \usepackage{main} (and has \end{document} which that error is telling you is missing) Mar 27, 2020 at 17:06
  • This worked!! Thank you so much.
    – push33n
    Apr 2, 2020 at 1:32

2 Answers 2

1

That error (most likely) means that you are running latex on main.sty instead of running it on a document that includes the package via

\documentclass{article}
\usepackage{main}
\begin{document}
...
\end{document}

The error is basically saying that it reached the end of the input without seeing \end{document}.

0

You must remove the ... from your sty, then it works:

\documentclass{article}

\begin{filecontents*}[overwrite]{mypackages.sty}
\RequirePackage[utf8]{inputenc}
\RequirePackage{ upgreek }
%.... %a whole bunch of packages
\newcommand{\R}{\mathbb{R}}
%.... %a whole bunch of commands
\endinput
\end{filecontents*}

\usepackage{mypackages}

\begin{document}

test

\end{document}
1
  • 2
    what you say is true but I suspect it doesn't answer the actual question, the ... % bunch of packages were an attempt t shorten the example for this website not literally the code in the package file. Mar 27, 2020 at 17:34

You must log in to answer this question.

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