I'm sorry for the pretty vague title. I've tried to make it as clear as I could.
In my documents, I'm setting up the language option with babel package and to avoid some troubles I had to load babel tikzlibrary too. Everything is fine for my drawings except with contents I want to display at the end. To achieve that, I load etoolbox package and use \AtEndDocument macro. And at this moment, pdfLaTeX gives the following error : File ended while scanning use of \pgfplots@addplotimpl@expression@curly.
After some researches it appears that it comes from the french option that I'm using. I've reduced the code to a MWE by troubleshooting the code but I can't find a solution. Either by using shorthanoff{;} nor by using other fixes from related posts.
Here are some observations :
- Commenting the
babeltikzlibrary solved the problem in the MWE but I want to keep it otherwise I've many others errors for my drawings ; - Remove the
frenchoption solved the problem but students have already some difficulties with physic stuffs in french. I prefer to keep that option :]
Can you help me to find how I can display my tikzdrawings at the end of my document ?
Thanks for any help.
M(N)WE :
\documentclass[french]{book}
\usepackage{babel}
\usepackage{etoolbox}
\usepackage{tikz}
\usetikzlibrary{babel}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\chapter{foo}
\section{bar}
You have to solve $P=NP$ problem. Good luck !
\AtEndDocument{%
\subsection*{Resolution of the homework}
Here is my resolution :
\begin{tikzpicture}
\begin{axis}
\addplot {x};
\end{axis}
\end{tikzpicture}
}
\end{document}
\AtEndDocument{...}before the\begin{document}command; it needs to be in the preamble. – Herb Schulz Apr 22 '20 at 18:05\shorthandoff{;}before the\AtEndDocumentto disable the shorthand. – Ulrike Fischer Apr 22 '20 at 18:06\AtEndDocument." -> This is the main point. I've tested \shorthandoff{;} but in the hook... I was focusing on thetikzpictureenvironment and only added the change of cat code before tikz environment. It solves my problem. If you want, turn it into an answer. Thank you ! – Piroooh Apr 22 '20 at 19:51