2

After getting the suggestion to use the layouts package for visual debugging of lengths, I came up with the following example, which I compile with xelatex test.tex:

\documentclass[12pt,a4paper]{article}

\usepackage[pass]{geometry}
\usepackage{tikz,enumitem}

\usepackage{fix-cm}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Junicode}

\usepackage{layouts}

\begin{document}

\pdfpagewidth=148mm \pdfpageheight=210mm % for PDF output
\paperwidth=148mm \paperheight=210mm     % for TikZ


\begin{tikzpicture}[overlay,remember picture,inner sep=0pt,yscale=-1,outer sep=0pt,anchor=north west]

  \begin{scope}[shift={(-\oddsidemargin,-\topmargin-\headheight-\headsep-\marginparsep)}]% layer1

%   \path[anchor=north west] (0,0) node[below right] (dbg) {% this goes to (0,0) but after margin
  \path[anchor=north west] (current page.north west) node[below right] (dbg) {%
      \begin{minipage}{\paperwidth}%
        \setlayoutscale{1.0} %
        \drawdimensionstrue %
        \pagedesign %
      \end{minipage}
  }%path
  ;

  \end{scope}

\end{tikzpicture}
\end{document}

 

This is what I get as output (upper/left/right edges of image correlate to corresponding edges of the pdf page):

test.pdf output

 

Notably, all lengths being read are reported as zeroes; I was otherwise hoping that I could force the layouts page diagram to be scaled to one, and overlaid over the current page using a tikz node - but that apparently fails.

Is it possible at all that I get a layouts page diagram overlaid over a page as I intended to? If so, how?

Many thanks in advance for any answers,
Cheers!

2

I guess it's a bug of layouts. The current maintainer of the package is Will Robertson. I think you should send a bug report.

At the moment the following patch using etoolbox seems to work:

\documentclass[12pt,a4paper]{article}
\usepackage[pass]{geometry}
\usepackage{layouts}
\usepackage{etoolbox}
\patchcmd{\drawpage}{\ifdrawparameters}{\iftrue}%
  {\typeout{^^J*******\string\drawpage fixed*******^^J}}%
  {\typeout{^^J*******\string\drawpage not fixed*******^^J}}

\begin{document}
\pagedesign
\end{document}

Of course you must setup the tikz environment by your self ;-)

  • Many thanks for that, @MarcoDaniel - your fix works great, also for my example above (to my surprise, with \setlayoutscale{0.68}, I get the page edges on layout to scale almost to pdf page edges). I've seen @WillRobertson around this site, so hopefully tex.se will issue a bump - else, by looking at CTAN webpage, I should email to submit a bug. Many thanks again - cheers! – sdaau May 13 '12 at 11:39

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.