Saltar al contenido

Cambiar el tamaño del papel en medio del documento

Solución:

Los siguientes trabajos en PDFLaTeX:

documentclass{article}
begin{document}
Normal page
eject pdfpagewidth=3in pdfpageheight=10in
Tall page
eject pdfpagewidth=10in pdfpageheight=3in
Wide page
end{document}

Eso debería funcionar con Xelatex. Consulte SO qn, ¿Cambiar el tamaño del papel en medio de un documento de látex ?, para obtener más información.

Puedes usar el typearea paquete (paquete KOMA-Script) para cambiar el tamaño del papel y también recalcular todos los márgenes dependientes, posiciones de encabezado y pie de página, etc. El siguiente código demuestra la técnica pero genera algunas advertencias relacionadas con las reglas de composición tipográfica ofendidas (no se recomienda colocar la fuente de 10 puntos en A3) . Es posible que deba ajustar un poco más typearea ajustes para obtener mejores resultados.

documentclass{article}
usepackage[paper=A4]{typearea}
usepackage{lipsum}% dummy code

begin{document}
lipsum% Placed on A4

KOMAoptions{paper=A3}
recalctypearea
lipsum% Placed on A3

KOMAoptions{paper=A4}
recalctypearea
lipsum% Placed on A4 again

end{document}

Algunas opciones de KOMA-Script activan un nuevo cálculo del área de tipo y la “configuración de página” automáticamente, pero paper no. Sin embargo, un recálculo a mitad de documento da como resultado una nueva página, por lo que no clearpage, newpage o eject es necesario aquí.

Aquí hay un ejemplo abreviado que cambia entre dos tamaños de página personalizados con diseños correspondientes (márgenes), que se pueden compilar con pdflatex – para obtener más detalles, consulte mi respuesta en Problema con la configuración del tamaño de página personalizado correcto con ‘geometría’ en xelatex:

documentclass{article}


% reminder: US letter: 596pt x 795pt

newlength{pagewidthA}
newlength{pageheightA}
setlength{pagewidthA}{300bp}
setlength{pageheightA}{400bp}

newlength{pagewidthB}
newlength{pageheightB}
setlength{pagewidthB}{400bp}
setlength{pageheightB}{500bp}

% stockwidth and stockheight - from memoir,
% here just for cheating `layouts` warnings
newlength{stockwidth}
newlength{stockheight}


usepackage{geometry}

% this command will take effect into L1 layout just after begin{document}
% but the L1 geometry will otherwise be ignored
geometry{twoside,inner=50bp,outer=30bp,top=50bp,bottom=50bp}

usepackage{tikz,enumitem}
usepackage{fix-cm}

usepackage{layouts}
usepackage{etoolbox}
patchcmd{drawpage}{ifdrawparameters}{iftrue}%
  {typeout{^^J*******stringdrawpage fixed*******^^J}}%
  {typeout{^^J*******stringdrawpage not fixed*******^^J}}

usepackage{lipsum}



makeatletter
newcommand{printpagevalues}{%
  % from geometry.sty:
  * paper: ifx[email protected]@undefined<default>else[email protected]fi \%
  * layout: [email protected]<custom>else<same size as paper>fi \%
  @ifundefined{[email protected]}{}{%
  [email protected]
  * layout(width,height): (the[email protected],the[email protected]) \%
  fi
  * layoutoffset:(h,v)=(the[email protected],the[email protected]fset) \%
  }%
  pagevalues % from package layouts
}
makeatother


newcommand{generatePageLayouts}{%
  newgeometry{layoutwidth=pagewidthA,layoutheight=pageheightA,left=1mm,right=5mm,bottom=1mm,top=1mm}
  savegeometry{LayoutPageA}

  newgeometry{layoutwidth=pagewidthB,layoutheight=pageheightB,twoside,inner=2.5cm,outer=0.5cm,top=1.5cm,bottom=1.5cm}
  savegeometry{LayoutPageB}
}


newcommand{switchToLayoutPageA}{%
  % switch page size first:
  pdfpagewidth=pagewidthA pdfpageheight=pageheightA % for PDF output
  paperwidth=pagewidthA paperheight=pageheightA     % for TikZ
  stockwidth=pagewidthA stockheight=pageheightA % hyperref (memoir)?!
  loadgeometry{LayoutPageA} % note; loadgeometry may reset paperwidth/h!
}

newcommand{switchToLayoutPageB}{%
  % switch page size first:
  pdfpagewidth=pagewidthB pdfpageheight=pageheightB % for PDF output
  paperwidth=pagewidthB paperheight=pageheightB     % for TikZ
  stockwidth=pagewidthB stockheight=pageheightB % hyperref (memoir)?!
  loadgeometry{LayoutPageB} % note; loadgeometry may reset paperwidth/h!
}



begin{document}
  % here geometry layout L1 is instantiated;
  % without anything else, paper size defaults to US letter!
  % restoregeometry command restores L1!!

  fontsize{8}{9}selectfont % this nowork in preamble!


  % generate page layouts first based on layoutwidth as page size;
  % don't switch actual page sizes yet:
  generatePageLayouts{}


  %%% start with content

  % start with LayoutPageA (includes switching page size)
  switchToLayoutPageA{}


    pagestyle{empty} % no page numbers here
    \
     thepaperwidth
    lipsum[1]
    printpagevalues{}
    clearpage

  % switch to LayoutPageB (includes switching page size)
  switchToLayoutPageB{}


    % start page numbering here ("this will reset the page number"):
    pagenumbering{arabic}
    % make page numbers visible
    pagestyle{plain}


    thepaperwidth
    lipsum[1]

    Trying

    some

    text

    printpagevalues{}
end{document}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *