[OS X TeX] Several page layouts in the same document

Alain Matthes alain.matthes at mac.com
Wed Jun 9 13:11:16 CEST 2010


Le 9 juin 2010 à 09:03, Ewan Delanoy a écrit :

> 
>   Thanks Alan and Alain ... your solution almost works,
> although for some reason the new geometry package
> behaves slightly differently from the old one : with
> the old one I got an exact paving of the page, with
> the new one the paving overlaps and is too far left.
> 
>   the natural fix to this would be to change the coordinates
> of the rectangle, e.g. 
>   
> \draw[xstep=1.75cm,ystep=2.47,gray!50] (a,b) grid (21,29.65);
> 
> instead of
> 
> \draw[xstep=1.75cm,ystep=2.47,gray!50] (0,0) grid (21,29.65);
> 
> where a and b are ad hoc values.
> Not surprisingly, the paving's location in the page stays the same whatever 
> values I put for a and b. Any ideas on how to fix this ?

hi

This is normal. (0,0) or (a,b) are used inside the picture and not
 with the coordinates of the page.

I have not your problem with the new geometry __ I work only with pdflatex
but perhaps  you work with dvi-ps-pdf  ?__

A better solution is to use the size of a4paper 21 cm and 29.7 cm. 
I think you want 144 rectangles so (29.7/12=2.475)

\draw[xstep=\paperwidth/12,ystep=\paperheight/12,gray!50] (0,0) grid (\paperwidth,\paperheight);  

you don't need [x=1cm,y=1cm] by default, you have x=1cm,y=1cm ! 


Another possibility is  to avoid geometry and to use absolute position with tikz.
In this case, you need to compile twice !!

This solution is interesting because the picture is on the first page but
 there is a BUT : I have a problem with "grid" . 

I don't get the good result and I don't know why. The grid is misplaced.
I make a grid but with the use of current page nodes.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{article}  
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc}
\def\maketitle{%
\null%
\thispagestyle{empty}%
\noindent%
\begin{tikzpicture}[overlay,remember picture]
\draw[red] (current page.south west) -- (current page.north east); 
\foreach \x in {0,1,...,11}
{\draw[gray!50] ($(current page.south west) +(0,\x*\paperheight/12)$)%
       -- ($(current page.south east) +(0,\x*\paperheight/12)$); 
\draw[gray!50] ($(current page.south west) +(\x*\paperwidth/12,0)$)%
       -- ($(current page.north west) +(\x*\paperwidth/12,0)$); 
}
\end{tikzpicture}%
\clearpage%
}

\begin{document}
\maketitle   
\lipsum[1-2]
\end{document}  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Best Regards 

Alain Matthes

PS :  I give you two other examples to see
 how to make a picture  with or without geometry. 


%%%%%%%%%%% Annexe one %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{book}
\usepackage{tikz}
\usetikzlibrary{calc,fadings}
\usepackage{geometry}
\usepackage{lipsum}


\def\maketitle{%
  \thispagestyle{empty}%
  \noindent\begin{tikzpicture}
\shade[top color=blue!50!black, bottom color=blue!50]%
 (current page.south west) rectangle (current page.north east);
\draw[red] (current page.south west) -- (current page.north east);
\end{tikzpicture}
  \clearpage
}


\begin{document}

\newgeometry{hmargin=0cm,vmargin=0cm}
\maketitle
\restoregeometry

\lipsum

\end{document}    

%%%%%%%%%% Annexe two %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt,a4paper,openany]{book}
\usepackage{tikz}
\usetikzlibrary{calc,fadings}
\usepackage{geometry}
\usepackage{lipsum}

\def\maketitle{%
  \null
  \thispagestyle{empty}%
  \noindent\begin{tikzpicture}[overlay,remember picture]

\shade[top color=blue!50!black, bottom color=blue!50]%
 (current page.north west) rectangle (current page.south east);
\draw[red] (current page.south west) -- (current page.north east);  
\end{tikzpicture}
\clearpage
}

\begin{document}

\maketitle

\lipsum

\end{document}


More information about the macostex-archives mailing list