6

I have a document that uses the KOMAscript srcrprt document class. For some pages I need to setup custom margins using absolute values. I tried to use the geometry package for that, as follows:

\newgeometry{..options..}

..custom page..

\restoregeometry

However this does not work as expected. As soon as I add \usepackage{geometry} to the preamble, the KOMAscript document layout is thrashed.

Is it possible to fix this?

  • 1
    You can try \usepackage[pass]{geometry} – egreg Jan 20 '17 at 9:23
9

The geometry package has a very useful option, namely pass.

If you call

\usepackage[pass]{geometry}

the package will not set any pagination parameter, but just load itself and make the \newgeometry command available.

An example of usage is in the package documentation:

\documentclass{book}
\usepackage[pass]{geometry}
   % ’pass’ disregards the package layout,
   %  so the original ’book’ layout is memorized here.
\begin{document}
\newgeometry{margin=1cm}% changes the first page dimensions.
   Page 1
\restoregeometry % restores the original ’book’ layout.
   Page 2 and more
\end{document}
|improve this answer|||||
6

For several release KOMA-Script provides an undocumented option usegeometry to interact with package geometry. Since KOMA-Script 3.22 this is an documented option (of package typearea). It translates the page settings of package typearea into page settings of package geometry and passes them, e.g., as options to geometry.

\documentclass[usegeometry]{scrreprt}
\usepackage{geometry}
\usepackage{showframe}
\begin{document}
\newgeometry{margin=1cm}% changes the first page dimensions.
   Page 1
\restoregeometry % restores the original typearea layout.
   Page 2 and more
\end{document}

The cooperation makes it even possible to change page size or page orientation using typearea and then change the margins using geometry, something current geometry does not provide using \newgeometry. But in this case you should use typearea's commands to store and restore the geometries.

|improve this answer|||||
  • Good to know! although the possibility to use the pass option in the geometry package already did the trick for me. – Grodriguez Feb 10 '17 at 9:24
  • @Grodriguez: Understand and that's OK. I wanted only to show another perspective. – Schweinebacke Feb 10 '17 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.