# Revision history [back]

### Why can't I use the sagesilent environment in AtBeginDocument?

I'm trying to write a latex sty file to change the default behavior of sagetex.

My file is

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{examplepackage}[2018/12/24 examplepackage]

\RequirePackage{sagetex}
\RequirePackage{etoolbox}

\AtBeginDocument{%
\begin{sagesilent}
A = 3
\end{sagesilent}
}

\endinput


However, attempting to use this sty file in the following latex file produces the error ! File ended while scanning use of \next.

\documentclass[12pt]{article}

\usepackage{stupid}

\begin{document}
hello world!
\end{document}


What's wrong with my sty file?

### Why can't I use the sagesilent environment in AtBeginDocument?

I'm trying to write a latex sty file to change the default behavior of sagetex.

My file is

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{examplepackage}[2018/12/24 examplepackage]

\RequirePackage{sagetex}
\RequirePackage{etoolbox}

\AtBeginDocument{%
\begin{sagesilent}
A = 3
\end{sagesilent}
}

\endinput


However, attempting to use this sty file in the following latex file produces the error ! File ended while scanning use of \next.

\documentclass[12pt]{article}

\usepackage{stupid}
\usepackage{examplepackage}

\begin{document}
hello world!
\end{document}


What's wrong with my sty file?