Open main menu

Wolfgang Schuster

Joined 12 September 2007
Revision as of 09:48, 25 December 2007 by Wolfgang Schuster (talk | contribs) (Added new section Links to my page)

Sample Code

Full page figures

The following macro allows me to include figures in my document and adjust them to have the size of a normal page.

\unprotect

\definesystemvariable{xx}

\def\fullpagebox
  {\dosingleempty\dofullpagebox}

\def\dofullpagebox[#1]%
  {\bgroup
   \getparameters[\??xx][\c!nx=1,\c!ny=1,#1]%
   \dowithnextbox
     {\!!widtha\dimexpr\paperwidth/\nextboxwd\relax
      \!!widthb\dimexpr\paperheight/\nextboxht\relax
      \ifdim\!!widtha>\!!widthb
        \setbox\nextbox\vbox\!!to\@@xxny\paperheight{\vss\expanded{\scale[\c!width=\@@xxnx\paperwidth]{\flushnextbox}}\vss}%
      \else
        \setbox\nextbox\hbox\!!to\@@xxnx\paperwidth{\hss\expanded{\scale[\c!height=\@@xxny\paperheight]{\flushnextbox}}\hss}%
      \fi
      \setbox\nextbox\hbox{\clip[\c!width=\@@xxnx\paperwidth,\c!height=\@@xxny\paperheight]{\flushnextbox}}%
      \startTEXpage
      \flushnextbox
      \stopTEXpage
      \egroup}%
   \hbox}

\def\fullpagefigure
  {\dodoubleempty\dofullpagefigure}

\def\dofullpagefigure[#1][#2]%
  {\ifsecondargument
     \fullpagebox[#1]{\externalfigure[#2]}%
   \else
     \fullpagebox[]{\externalfigure[#1]}%
   \fi}

\protect

\starttext

\fullpagefigure[image]

\fullpagefigure[nx=2][image]

\fullpagefigure[ny=2][image]

\stoptext

Feature Requests

  • grid=yes option for \definelayout,
  • temporary user variable for privat macros (see above),
  • macro \defineuvervariable{...} to define namespaces for third party modules.

Links