Trim margins of the entire document (by command line)

Why don't you use crop package?!

As David Carlisle said you can also use geometry package, but I prefer crop in this case; for more details see the package's manual.

with setting width and height you can achieve your desired margins.

\documentclass[a4paper,11pt]{article}
\usepackage[a4,center,noinfo,cross, width=13.5cm,height=22.5cm]{crop}
\usepackage{blindtext}

\begin{document}

\section{Section}
\blindtext
\blindtext
\blindtext\footnote{\blindtext}
\end{document}

enter image description here


You can try

\AtBeginDocument{%
\edef\mt{\the\textwidth}%
\edef\mtt{\the\textheight}%
\RequirePackage{geometry}%
\geometry{paperwidth=\dimexpr\mt+1cm\relax,
paperheight=\dimexpr\mtt+1cm\relax,margin=.5cm}
\RequirePackage{xcolor} 
\pagecolor[HTML]{E4EDE9}}

\documentclass[a4paper,11pt]{article}

\usepackage{blindtext}

\begin{document}

\section{Section}
\blindtext

\blindtext

\blindtext\footnote{\blindtext}

\end{document}

Here I take the baseline article documentclass (using the pass option of geometry) and change the \paperwidth and \paperheight by the specified amount and then associated margins (actually \hoffset and \voffset) by one half of the page change dimensions.

\documentclass{article}
\usepackage{lipsum}
\usepackage[pass]{geometry}
\newlength\DX
\DX=3.5in
\paperwidth=\dimexpr\paperwidth-\DX\relax
\hoffset=\dimexpr\hoffset-.5\DX\relax
\newlength\DY
\DY=2.8in
\paperheight=\dimexpr\paperheight-\DY\relax
\voffset=\dimexpr\voffset-.5\DY-.5\footskip\relax
\begin{document}
\lipsum[1-10]
\end{document}

enter image description here

Without any changes:

enter image description here

Tags:

Crop