summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-07-29 15:51:50 +0000
committerNorbert Preining <preining@logic.at>2008-07-29 15:51:50 +0000
commit053efa6f13982fba08efedcb6da18883fd312d6f (patch)
tree3d5a1f7c222508d27ed924d753b2a26280db8c18
parenta51ebdee895b5fbcada72092437712499f1be4ba (diff)
add context-typearea
git-svn-id: svn://tug.org/texlive/trunk@9886 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/context/third/typearea/typearea-demo.pdfbin0 -> 4125 bytes
-rw-r--r--Master/texmf-dist/doc/context/third/typearea/typearea-doc.pdfbin0 -> 75801 bytes
-rw-r--r--Master/texmf-dist/tex/context/third/typearea/t-typearea.tex99
-rw-r--r--Master/texmf-dist/tpm/t-typearea.tpm31
-rw-r--r--Master/tlpkg/tlpsrc/collection-context.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/context-typearea.tlpsrc4
6 files changed, 135 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/context/third/typearea/typearea-demo.pdf b/Master/texmf-dist/doc/context/third/typearea/typearea-demo.pdf
new file mode 100644
index 00000000000..abe8cee74b5
--- /dev/null
+++ b/Master/texmf-dist/doc/context/third/typearea/typearea-demo.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/context/third/typearea/typearea-doc.pdf b/Master/texmf-dist/doc/context/third/typearea/typearea-doc.pdf
new file mode 100644
index 00000000000..f3724f47eb0
--- /dev/null
+++ b/Master/texmf-dist/doc/context/third/typearea/typearea-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/context/third/typearea/t-typearea.tex b/Master/texmf-dist/tex/context/third/typearea/t-typearea.tex
new file mode 100644
index 00000000000..8d429100c82
--- /dev/null
+++ b/Master/texmf-dist/tex/context/third/typearea/t-typearea.tex
@@ -0,0 +1,99 @@
+%D \module
+%D [ file=t-typearea,
+%D version=2008.04.05,
+%D title=\CONTEXT\ User Module,
+%D subtitle=Something like KOMA-TypeArea,
+%D author=Peter Münster,
+%D date=\currentdate,
+%D copyright={Peter Münster}]
+%C This module is copyrighted by Peter Münster.
+%C Please send any comments to pmrb at free.fr.
+
+% This program is free software; you can redistribute it and/or
+% modify it under the terms of the GNU General Public License
+% as published by the Free Software Foundation; either version 2
+% of the License, or (at your option) any later version.
+
+% This program is distributed in the hope that it will be useful,
+% but without any warranty; without even the implied warranty of
+% merchantability or fitness for a particular purpose. See the
+% GNU General Public License for more details.
+
+\writestatus{loading}{Something like KOMA-TypeArea}
+
+\unprotect
+
+%D \macros{setupTypeArea}
+%D Setting up some values.
+%D
+%D Default setup:
+%D
+%D \starttyping
+%D \setupTypeArea[bcor=0pt,oneside=no,alphabets=2.6]
+%D \stoptyping
+%D
+%D Example:
+%D
+%D \starttyping
+%D \setupTypeArea[bcor=3mm,oneside=yes,alphabets=3.1]
+%D \stoptyping
+\def\setupTypeArea[#1]{\getparameters[TA@][#1]\doTypeArea}
+
+%D Some internal dimensions:
+\newdimen\PageWidth \newdimen\Back
+\doifundefined{Width}{\newdimen\Width}
+\doifundefined{Height}{\newdimen\Height}
+
+%D This internal macro does the whole work:
+\def\doTypeArea{
+
+%D Set visible page width:
+\PageWidth=\dimexpr\paperwidth-\TA@bcor\relax
+
+%D Determine the paper aspect ratio:
+\edef\Ratio{\withoutpt{\the\dimexpr2\paperheight/(\PageWidth/32768)\relax}}
+
+%D Set the textarea width to X alphabets:
+\setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}}
+\Width=\dimexpr\TA@alphabets\wd\scratchbox\relax
+\ifdim\Width<\PageWidth\else
+\writestatus{error}{line wider than page}\end\fi
+
+%D Set the textarea height proportional to the width:
+\Height=\dimexpr(\Ratio\Width)
+
+%D Set the margin/gutter widths to be equal on a full spread:
+\doifelse\TA@oneside{yes}
+ {\Back=\dimexpr(\PageWidth - \Width) / 2 + \TA@bcor\relax}
+ {\Back=\dimexpr(\PageWidth - \Width) / 3 + \TA@bcor\relax}
+
+%D Set the top and bottom margins in a 1:2 ratio, ignoring headers:
+\edef\Top{\the\dimexpr(\paperheight - \Height) / 3 - 3\lineheight\relax}
+
+%D Redefine \type{\Height} to include header and footer space:
+\Height=\dimexpr(\Height + 8\lineheight)
+
+%D Set up the page layout using the calculated parameters:
+\setuplayout[
+ backspace=\the\Back,
+ height=\the\Height,
+ width=\the\Width,
+ header=2\lineheight,
+ headerdistance=\lineheight,
+ footer=2\lineheight,
+ footerdistance=3\lineheight,
+ topspace=\Top]
+}
+\protect
+
+\setupTypeArea[bcor=0pt,oneside=no,alphabets=2.6]
+
+\doifnotmode{demo}{\endinput}
+
+%D Usage example:
+\usemodule[typearea]
+\setupTypeArea[bcor=0mm,alphabets=3.1]
+\setuppagenumbering[alternative=doublesided]
+\starttext
+\dorecurse4{\framed[width=\textwidth,height=\textheight]{test}\page}
+\stoptext
diff --git a/Master/texmf-dist/tpm/t-typearea.tpm b/Master/texmf-dist/tpm/t-typearea.tpm
new file mode 100644
index 00000000000..8057e01e758
--- /dev/null
+++ b/Master/texmf-dist/tpm/t-typearea.tpm
@@ -0,0 +1,31 @@
+<!DOCTYPE rdf:RDF SYSTEM "tpm.dtd">
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:TPM="http://texlive.dante.de/">
+ <rdf:Description about="http://dl.contextgarden.net/modules/t-typearea.zip">
+ <TPM:Name>t-typearea</TPM:Name>
+ <TPM:Type>Package</TPM:Type>
+ <TPM:Date>2006/09/12 00:00:00</TPM:Date>
+ <TPM:Version>2008.04.05</TPM:Version>
+ <TPM:Creator>Peter</TPM:Creator>
+ <TPM:Title>Something like KOMA-TypeArea</TPM:Title>
+ <TPM:Description>
+This module provides a command that tries to calculate the page layout as
+the LaTeX package "typearea" does.
+ </TPM:Description>
+ <TPM:Author>Peter Münster</TPM:Author>
+ <TPM:Size>84058</TPM:Size>
+ <TPM:Build/>
+ <TPM:RunFiles size="4132">
+tex/context/third/typearea/t-typearea.tex
+tpm/t-typearea.tpm
+ </TPM:RunFiles>
+ <TPM:DocFiles size="79926">
+doc/context/third/typearea/typearea-doc.pdf
+doc/context/third/typearea/typearea-demo.pdf
+ </TPM:DocFiles>
+ <TPM:Requires>
+ <TPM:Package name="context"/>
+ </TPM:Requires>
+ <TPM:Provides>Package/t-typearea</TPM:Provides>
+ </rdf:Description>
+</rdf:RDF>
diff --git a/Master/tlpkg/tlpsrc/collection-context.tlpsrc b/Master/tlpkg/tlpsrc/collection-context.tlpsrc
index 6a340623848..628b1625442 100644
--- a/Master/tlpkg/tlpsrc/collection-context.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-context.tlpsrc
@@ -16,5 +16,6 @@ depend context-letter
depend context-lettrine
depend context-lilypond
depend context-mathsets
+depend context-typearea
depend collection-metapost
depend collection-basic
diff --git a/Master/tlpkg/tlpsrc/context-typearea.tlpsrc b/Master/tlpkg/tlpsrc/context-typearea.tlpsrc
new file mode 100644
index 00000000000..e874787989f
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/context-typearea.tlpsrc
@@ -0,0 +1,4 @@
+name context-typearea
+category Package
+runpattern d texmf-dist/tex/context/third/typearea
+docpattern d texmf-dist/doc/context/third/typearea