I'm used to compile my .tex files with this command:
pdflatex '\AtBeginDocument{\newlength\DX \DX=3cm \paperwidth=\dimexpr\paperwidth-\DX\relax \hoffset=\dimexpr\hoffset-.5\DX\relax \newlength\DY \DY=3cm \paperheight=\dimexpr\paperheight-\DY\relax \voffset=\dimexpr\voffset-.1\DY-.5\footskip\relax \RequirePackage{xcolor}} \nonstopmode\input{test.tex}'
I'll write it here in a more readeable way:
pdflatex '\AtBeginDocument{\newlength\DX
\DX=3cm \paperwidth=\dimexpr\paperwidth-\DX\relax
\hoffset=\dimexpr\hoffset-.5\DX\relax
\newlength\DY \DY=3cm
\paperheight=\dimexpr\paperheight-\DY\relax
\voffset=\dimexpr\voffset-.1\DY-.5\footskip\relax \RequirePackage{xcolor}}
\nonstopmode\input{test.tex}'
See Trim margins of the entire document (by command line)
But after the last update to the October release of TeX Live 2020 it doesn't work anymore.
This is a MWE. My file contains:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{jheppub}
\usepackage{blindtext}
\begin{document}
\blindtext
\blindtext
\blindtext\footnote{\blindtext}
\end{document}
I want an output as if it were:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{blindtext}
\usepackage{jheppub}
\usepackage[pass]{geometry}
\newlength\DX \DX=3cm
\paperwidth=\dimexpr\paperwidth-\DX\relax
\hoffset=\dimexpr\hoffset-.5\DX\relax
\newlength\DY \DY=3cm
\paperheight=\dimexpr\paperheight-\DY\relax
\voffset=\dimexpr\voffset-.1\DY-.5\footskip\relax
\begin{document}
\blindtext
\blindtext
\blindtext\footnote{\blindtext}
\end{document}
but I don't want to change my .tex file. I need to do it by command line.
Now, after TeX Live 2020 update, I get:
where the trimmed margins are wrong. I think that the probles is caused by something in the jheppub.sty file.
You can find the jheppub.sty file here: https://jhep.sissa.it/jhep/help/JHEP/TeXclass/DOCS/jheppub.sty



\RequirePackage{xcolor}after\relaxbecause of other things I do. I updated my question. – Gabriele Feb 16 '21 at 21:11xcolorthere I also get the same output with those four versions (which is what I expected), but the output now looks like the output you want (including with TeX Live 2020). What I find odd is the presence ofxcolorchanging the margins... – Phelype Oleinik Feb 16 '21 at 21:16xcolor. – Gabriele Feb 16 '21 at 21:18xcolor– Phelype Oleinik Feb 16 '21 at 21:20jheppubthat I usually use in my editing work. But the different behaviour was introduced by the update. I need to heavily update my question. – Gabriele Feb 16 '21 at 21:27