[texhax] A Self-Referential Logo

Martin Heller mr_heller at yahoo.dk
Wed Oct 12 11:06:50 CEST 2011


Iraj Kalantari wrote, on 11-10-2011 22:05:
>
> I am afraid it does not work for me.
>
> I get:
>
> ! Undefined control sequence.
> l.583 \pgfkeys
>                {/pgf/foreach/.cd,
>
You can use \@for instead of \foreach from the pgffor package

% test.tex
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{lipsum}
\headheight=3cm

\def\realjobname{test}% <- change to match filename
\newcounter{logopage}
\rhead{\rule{0.1\paperwidth}{0.1\paperheight}}%
\ifx\logolevel\undefined
\gdef\logolevel{0}%
\makeatletter
\def\runnos{0,1,2,3,4,5}
\@for \runno:=\runnos \do
{%
   \immediate\write18{%
     pdfLaTeX --jobname="\jobname\runno"
     \gdef"\string\logolevel{\runno}\string\input\space\jobname"
   }%
}%
\makeatother
\fi
\ifnum\logolevel>0
     \setcounter{logopage}{\logolevel}%
     \addtocounter{logopage}{-1}%
     \rhead{%
         \setlength{\fboxsep}{0pt}%
 
\fbox{\includegraphics[scale=0.1,page=\thepage]{\realjobname\thelogopage.pdf}}}%
\fi
\pagestyle{fancy}

\begin{document}

\lipsum

\end{document}



> Question: How does one "enable escape/write18"?
>
> (Mac user; OS 10.6.8; TeXlive-2009; TeXShop)

You need to use

pdflatex --shell-escape test.tex

This will generate

testX.pdf where X = 0,1,...,5

Test5.pdf has your document with a 6-level self-referential logo.



More information about the texhax mailing list