diff options
author | Karl Berry <karl@freefriends.org> | 2012-01-01 23:05:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-01-01 23:05:44 +0000 |
commit | 23ab143d707b8fa83fb9c63646807bc43b9456af (patch) | |
tree | 9c240f06526e7d7c5e08a9f5bbbd39f0a1535370 /Master/texmf-dist/source/latex | |
parent | 053930a0ae346b5d7e31ad8e9e576cac0ea1bb70 (diff) |
typogrid 0.21 (1jan12)
git-svn-id: svn://tug.org/texlive/trunk@24994 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/typogrid/Makefile | 69 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/typogrid/typogrid.dtx | 279 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/typogrid/typogrid.ins | 4 |
3 files changed, 210 insertions, 142 deletions
diff --git a/Master/texmf-dist/source/latex/typogrid/Makefile b/Master/texmf-dist/source/latex/typogrid/Makefile deleted file mode 100644 index 6f6cfa0a53d..00000000000 --- a/Master/texmf-dist/source/latex/typogrid/Makefile +++ /dev/null @@ -1,69 +0,0 @@ - -SRCDIR=typogrid -INSTALLDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/tex/latex/typogrid -DOCDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/doc/latex/typogrid -VERSION=`grep '^\\\\def\\\\fileversion' typogrid.dtx | sed 's/^\\\\def\\\\fileversion{\\(.*\\)\\.\\(.*\\)}/\\1_\\2/'` - - -.SUFFIXES: .sty .ins .dtx .dvi .ps .pdf - -.ins.sty: - latex $< - -.dtx.dvi: - latex $< - latex $< - makeindex -s gind.ist $(*D)/$(*F) - makeindex -s gglo.ist -o $(*D)/$(*F).gls $(*D)/$(*F).glo - latex $< - -.dvi.ps: - dvips -o $(*D)/$(*F).ps $(*D)/$(*F) - - -all: typogrid.sty typogrid.dvi - - -clean: - @-rm -f typogrid.glo typogrid.gls typogrid.idx typogrid.ilg - @-rm -f typogrid.ind typogrid.aux typogrid.log typogrid.toc - @-rm -f testtypogrid.aux testtypogrid.log - @-rm -f *~ - -distclean: clean - @-rm -f typogrid.sty typogrid.dvi - @-rm -f testtypogrid.dvi - -tar: all clean - echo Lege typogrid-$(VERSION).tar.gz an - -rm -f typogrid-$(VERSION).tar.gz - tar czCf .. typogrid-$(VERSION).tar.gz \ - $(SRCDIR)/README \ - $(SRCDIR)/Makefile \ - $(SRCDIR)/typogrid.dtx \ - $(SRCDIR)/typogrid.ins \ - $(SRCDIR)/typogrid.dvi \ - $(SRCDIR)/testtypogrid.tex - -zip: all clean - -@rm -f typogrid-$(VERSION).zip - mkdirhier tex/latex/typogrid - mkdirhier doc/latex/typogrid - mkdirhier source/latex/typogrid - mv typogrid.sty tex/latex/typogrid - cp typogrid.dtx typogrid.ins typogrid.xml source/latex/typogrid - cp Makefile source/latex/typogrid - cp README typogrid.dvi testtypogrid.tex doc/latex/typogrid - zip -r typogrid-$(VERSION).zip tex doc source - rm -r tex/ doc/ source/ - -install: all - if [ ! -d $(INSTALLDIR) ]; then mkdirhier $(INSTALLDIR); fi - if [ ! -d $(DOCDIR) ]; then mkdirhier $(DOCDIR); fi - install -m644 typogrid.sty $(INSTALLDIR) - install -m644 typogrid.dvi $(DOCDIR) - texhash - - -typogrid.sty: typogrid.ins typogrid.dtx - diff --git a/Master/texmf-dist/source/latex/typogrid/typogrid.dtx b/Master/texmf-dist/source/latex/typogrid/typogrid.dtx index 4fb0af5ed09..4ea0c77c650 100644 --- a/Master/texmf-dist/source/latex/typogrid/typogrid.dtx +++ b/Master/texmf-dist/source/latex/typogrid/typogrid.dtx @@ -1,25 +1,27 @@ % \iffalse meta comment -% File: typogrid.dtx Copyright (C) 2003 Harald Harders +% File: typogrid.dtx Copyright (C) 2003, 2011 Harald Harders, Rolf Niepraschk % \fi % % \iffalse -% -%<*package> -\def\fileversion{0.10} -\def\filedate{2003/10/30} -\def\docdate{2003/10/30} -%</package> %<*driver> \listfiles \documentclass[a4paper]{ltxdoc} -\title{The \texttt{typogrid} package\thanks{This file has version - \fileversion\ last revised \filedate, documentation dated - \docdate.}} -\author{Harald Harders\\\texttt{h.harders@tu-bs.de}} -\date{File Date \filedate, Printed \today} \usepackage[T1]{fontenc} -%\def\meta@font@select{\normalfont\itshape} -\makeatother +\IfFileExists{typogrid.sty}{% + \usepackage[draft,columns=4,margin=false,headings=true]{typogrid} +}{% + \GenericWarning{typogrid.dtx}{Package file typogrid.sty not found + (Documentation will be messed up!^^J^^A + Generate typogrid.sty by (La)TeXing typogrid.ins, process + typogrid.dtx again)^^J}\stop +} +%% +\GetFileInfo{typogrid.sty} +\title{The \texttt{typogrid} package} +\author{% + Harald Harders (\texttt{h.harders@tu-bs.de}),\\ + Rolf Niepraschk (\texttt{rolf.niepraschk@ptb.de})} +\date{File Version \fileversion, \filedate, printed \today} %% \EnableCrossrefs \CodelineIndex @@ -31,16 +33,21 @@ \DoNotIndex{\ensuremath,\filedate,\fileversion,\docdate} \DoNotIndex{\mathit,\mathrm,\mathsf,\nprt@tmp,\nprt@tmpnum,\relax} \DoNotIndex{\protect,\renewcommand,\setlength,\settowidth,\stepcounter} -\DoNotIndex{\string} +\DoNotIndex{\string,\put,\multiput} \CodelineNumbered \RecordChanges -\CheckSum{111} +\CheckSum{219} \begin{document} \DocInput{typogrid.dtx} \end{document} %</driver> % \fi % +% \changes{0.21}{2011/12/31}{Update Makefile}% +% \changes{0.21}{2011/12/31}{Set date and version explicitly in +% \cs{ProvidesPackage}}% +% \changes{0.20}{2003/11/09}{Reimplementation with respect to +% \texttt{showframe.sty} by Rolf Niepraschk}% % \changes{0.10}{2003/10/30}{First version}% % % \maketitle @@ -57,7 +64,7 @@ % \tableofcontents % % \section*{Copyright} -% Copyright 2003 Harald Harders. +% Copyright 2003, 2011 Harald Harders, Rolf Niepraschk. % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN @@ -71,8 +78,9 @@ % \cs{usepackage}\oarg{options}|{typogrid}| % \end{quote} % command. -% Valid options are |final|, |draft|, and -% |columns=|\meta{value}. +% Valid options are |final|, |draft|, +% |columns=|\meta{value}, |headings=|\meta{true,false}, and +% |margin=|\meta{true,false}. % The options |final| and |draft| may be given explicitely or % implicitely from the document-class options. % @@ -82,40 +90,70 @@ % The |columns| option determines the number of columns printed. % If it is not given, a default of 12 is used. % +% If |headings=true| is given, a grid is printed for the head line and +% the foot line, too (this is the default, you may also omit it). +% If |headings=false| is given, no grid is printed for the headings. +% +% With |margin=false|, you can switch off printing a frame around the +% area for margin notes (default is to print the frame). +% % \DescribeMacro{\typogridsetup} -% There is a second possibility to change the number of columns. +% There is a second possibility to change the typographic grid. % You may use the \cs{typogridsetup} command that takes a keyval list % as argument. -% This version suports only |columns=|\meta{value}, e.g., +% The same keywords are allowed as in the \cs{usepackage} line, e.g., % \begin{quote} % |\typogridsetup{columns=4}| % \end{quote} -% You may also change the number of columns within the text. +% You may use this command within the text in order to change the grid +% at arbitrary position of the document. +% The change takes effect on the next page. % +% \DescribeMacro{\typogrid} +% If you have switched off printing of the grid, you may get a grid +% for single pages using +% \begin{quote} +% |\AddToShipoutPicture*{\typogrid}| +% \end{quote} +% +% The package defines the length \cs{gridwidth} which is as long as +% the space between too grid lines. +% You may use it to scale pictures to fit to the grid, for instance. +% +% +% \section{Shortcomings} +% +% \begin{itemize} +% \item Calculation of position and size of the headings and the +% margin works for standard cases, only. +% \item If the text width changes from one page to the next, the grid +% width is wrong on the first page after the change. +% \end{itemize} +% +% % \StopEventually{\PrintChanges \PrintIndex} % +% % \section{The implementation} % \iffalse %<*package> % \fi % Heading of the package: % \begin{macrocode} -\ProvidesPackage{typogrid}[2003/10/29 v\fileversion\space Typographic grid] -\RequirePackage{eso-pic}[2002/11/16] +\ProvidesPackage{typogrid} + [2011/12/31 v0.21 Typographic grid] \RequirePackage{calc} \RequirePackage{keyval} % \end{macrocode} % Introduce the used lengths. % \begin{macrocode} -\newlength{\tpg@left}% -\newlength{\tpg@top}% -\newlength{\tpg@bottom}% -\newlength{\tpg@gridwidth}% +\newlength{\gridwidth}% % \end{macrocode} % Introduce the used counters and set the default number of columns. % \begin{macrocode} -\newcounter{tpg@bloecke}% -\setcounter{tpg@bloecke}{12}% +\newcount\tpg@blocks% +\newcounter{tpg@blocks@new}% +\setcounter{tpg@blocks@new}{12}% % \end{macrocode} % \begin{macro}{\typogridsetup} % Declare a command that can be used to change the appearence of the @@ -129,81 +167,180 @@ % Define the key |columns| that takes the number of columns. % \begin{macrocode} \define@key{typogrid}{columns}{% - \setcounter{tpg@bloecke}{#1}% - \ifnum\arabic{tpg@bloecke}<1 + \setcounter{tpg@blocks@new}{#1}% + \ifnum\the\c@tpg@blocks@new<1\relax \PackageError{typogrid}{Less than 1 column given}{You have to declare at least 1 column.}% - \setcounter{tpg@bloecke}{1}% + \setcounter{tpg@blocks@new}{1}% \fi } % \end{macrocode} +% Define the key |headings| to switch on or off a frame around the +% headings. +% \begin{macrocode} +\newif\iftpg@headings +\newif\iftpg@headings@new +\tpg@headings@newtrue +\define@key{typogrid}{headings}[true]{% + \csname tpg@headings@new#1\endcsname +} +% \end{macrocode} +% Define the key |margin| to switch on or off a frame around the +% margin. +% \begin{macrocode} +\newif\iftpg@margin +\newif\iftpg@margin@new +\tpg@margin@newtrue +\define@key{typogrid}{margin}[true]{% + \csname tpg@margin@new#1\endcsname +} +% \end{macrocode} % Package options: % \begin{macrocode} \newif\iftpg@draft \DeclareOption{draft}{\tpg@drafttrue} \DeclareOption{final}{\tpg@draftfalse} +\DeclareOption{colorgrid}{\PassOptionsToPackage{\CurrentOption}{eso-pic}} +\DeclareOption{grid}{\PassOptionsToPackage{\CurrentOption}{eso-pic}} \DeclareOption*{\expandafter\typogridsetup\expandafter{\CurrentOption}} % \end{macrocode} -% +% Default is no grid. % \begin{macrocode} \ExecuteOptions{final} \ProcessOptions\relax % \end{macrocode} -% Start the grid with the first page (should not be necessary). +% Load this package after processing the options. % \begin{macrocode} -\AtBeginDocument{% +\RequirePackage{eso-pic}[2002/11/16] % \end{macrocode} -% Print the grid on any page. +% \begin{macro}{\typogrid} +% Define the command that produces the grid. % \begin{macrocode} - \iftpg@draft - \typeout{Typographic grid switched on}% - \AddToShipoutPicture{% +\newcommand*\typogrid{% % \end{macrocode} -% Set the unit length each time because the use may have changed it. -% Do everything inside a group to prevent the changes to be seen -% outside. +% Switch to black and thin lines. % \begin{macrocode} - \begingroup - \normalcolor - \setlength{\unitlength}{1pt}% - \thinlines + \begingroup + \normalcolor + \thinlines % \end{macrocode} -% Calculate the distance of the text block from the page corner. +% Calculate the number of lines to be printed. % \begin{macrocode} - \setlength{\tpg@top}{\paperheight-1in-\topmargin-\headheight-\headsep}% - \setlength{\tpg@bottom}{\tpg@top-\textheight}% - \setlength{\tpg@gridwidth}{\textwidth/\thetpg@bloecke}% + \@tempcnta=\tpg@blocks + \advance\@tempcnta by -1% % \end{macrocode} -% Calculate the number of vertical lines to be printed. +% Print a frame around the text block. % \begin{macrocode} - \@tempcnta=\thetpg@bloecke - \advance\@tempcnta by 1 + \AtTextLowerLeft{% + \put(0,0){% + \framebox(\LenToUnit{\textwidth},\LenToUnit{\textheight}){}}% % \end{macrocode} -% The left distance varies between odd and even pages. +% Print the vertical lines for the grid. % \begin{macrocode} - \ifodd\arabic{page}% - \setlength{\tpg@left}{\oddsidemargin+1in}% - \else - \setlength{\tpg@left}{\evensidemargin+1in}% - \fi + \multiput(\LenToUnit{\gridwidth},0)% + (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% + \line(0,1){\LenToUnit{\textheight}}}% + }% % \end{macrocode} -% Print horizontal lines. +% Print a frame around the head line if wanted. % \begin{macrocode} - \put(\strip@pt\tpg@left,\strip@pt\tpg@top){% - \line(1,0){\strip@pt\textwidth}}% - \put(\strip@pt\tpg@left,\strip@pt\tpg@bottom){% - \line(1,0){\strip@pt\textwidth}}% + \iftpg@headings + \AtTextUpperLeft{% + \put(0,\LenToUnit{\headsep}){% + \framebox(\LenToUnit{\textwidth},\LenToUnit{\headheight}){}}% % \end{macrocode} -% Print equidistant vertical lines. +% Print the grid. % \begin{macrocode} - \multiput(\strip@pt\tpg@left,\strip@pt\tpg@bottom)% - (\strip@pt\tpg@gridwidth,0){\the\@tempcnta}{% - \line(0,1){\strip@pt\textheight}}% - \endgroup - }% + \multiput(\LenToUnit{\gridwidth},\LenToUnit{\headsep})% + (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% + \line(0,1){\LenToUnit{\headheight}}}% + }% +% \end{macrocode} +% Print a line below the foot line if wanted (the height of the foot +% line is not available). +% \begin{macrocode} + \AtTextLowerLeft{% + \put(0,\LenToUnit{-\footskip}){% + \line(1,0){\LenToUnit{\textwidth}}}% +% \end{macrocode} +% Print the grid. +% \begin{macrocode} + \put(0,\LenToUnit{-\footskip}){% + \line(0,1){\LenToUnit{\baselineskip}}}% + \put(\LenToUnit{\textwidth},\LenToUnit{-\footskip}){% + \line(0,1){\LenToUnit{\baselineskip}}}% + \multiput(\LenToUnit{\gridwidth},\LenToUnit{-\footskip})% + (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% + \line(0,1){\LenToUnit{\baselineskip}}}% + }% + \fi +% \end{macrocode} +% Print a frame around the margin if wanted. +% \begin{macrocode} + \iftpg@margin + \AtTextLowerLeft{% + \@tempdima=\textwidth\advance\@tempdima\marginparsep% + \if@twoside% + \ifodd\c@page + \else + \@tempdima=-\marginparsep\advance\@tempdima-\marginparwidth% + \fi% + \fi% + \put(\LenToUnit{\@tempdima},0){% + \framebox(\LenToUnit{\marginparwidth},% + \LenToUnit{\textheight}){}}% + }% + \fi + \endgroup +% \end{macrocode} +% Calculate the width of each grid. +% Store it globally to be able to use it inside the document. +% \begin{macrocode} + \setlength\gridwidth{\textwidth/\arabic{tpg@blocks@new}}% + \global\gridwidth=\gridwidth + \global\tpg@blocks=\arabic{tpg@blocks@new}% + \iftpg@headings@new + \global\tpg@headingstrue + \else + \global\tpg@headingsfalse + \fi + \iftpg@margin@new + \global\tpg@margintrue + \else + \global\tpg@marginfalse + \fi +} +% \end{macrocode} +% \end{macro} +% Start the grid at \cs{begin\{document\}}. +% Do it that late to enable the author to switch between |draft| and +% |final| before that position. +% \begin{macrocode} +\AtBeginDocument{% +% \end{macrocode} +% Print the grid on any page if wanted. +% \begin{macrocode} + \iftpg@draft + \typeout{Typographic grid switched on}% + \AddToShipoutPicture{\typogrid}% \else \typeout{Typographic grid switched off}% \fi +% \end{macrocode} +% Declare width of grid for first page of document. +% \begin{macrocode} + \setlength\gridwidth{\textwidth/\arabic{tpg@blocks@new}}% + \global\tpg@blocks=\arabic{tpg@blocks@new}% + \iftpg@headings@new + \tpg@headingstrue + \else + \tpg@headingsfalse + \fi + \iftpg@margin@new + \tpg@margintrue + \else + \tpg@marginfalse + \fi } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/typogrid/typogrid.ins b/Master/texmf-dist/source/latex/typogrid/typogrid.ins index 1e19f6e146e..0320cbf8d03 100644 --- a/Master/texmf-dist/source/latex/typogrid/typogrid.ins +++ b/Master/texmf-dist/source/latex/typogrid/typogrid.ins @@ -3,14 +3,14 @@ typogrid package - Copyright 2003 Harald Harders + Copyright 2003, 2011 Harald Harders, Rolf Niepraschk This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version. - h.harders@tu-bs.de + h.harders@tu-bs.de, rolf.niepraschk@ptb.de \endpreamble |