diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/typogrid |
Initial commit
Diffstat (limited to 'macros/latex/contrib/typogrid')
-rw-r--r-- | macros/latex/contrib/typogrid/ChangeLog | 10 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/Makefile | 68 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/README | 47 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/getversion.tex | 7 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/testtypogrid.tex | 53 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/typogrid.dtx | 351 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/typogrid.ins | 25 | ||||
-rw-r--r-- | macros/latex/contrib/typogrid/typogrid.pdf | bin | 0 -> 293839 bytes |
8 files changed, 561 insertions, 0 deletions
diff --git a/macros/latex/contrib/typogrid/ChangeLog b/macros/latex/contrib/typogrid/ChangeLog new file mode 100644 index 0000000000..6b791a7128 --- /dev/null +++ b/macros/latex/contrib/typogrid/ChangeLog @@ -0,0 +1,10 @@ +2011/12/31 0.21 Harald Harders (harald.harders@gmx.de) + - Change Makefile in order to produce pdf documentation + - Set date and version explicitly in \ProvidesPackage + +2003/11/09 0.20 Harald Harders (harald.harders@gmx.de), Rolf Niepraschk + - Reimplementation, provide grid for headings and a frame for + the margin + +2003/10/30 0.10 Harald Harders (harald.harders@gmx.de) + - First version diff --git a/macros/latex/contrib/typogrid/Makefile b/macros/latex/contrib/typogrid/Makefile new file mode 100644 index 0000000000..8ea95b17b8 --- /dev/null +++ b/macros/latex/contrib/typogrid/Makefile @@ -0,0 +1,68 @@ + +SRCDIR=typogrid +INSTALLDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/tex/latex/typogrid +DOCDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/doc/latex/typogrid +VERSION=`latex getversion | grep '^VERSION' | sed 's/^VERSION \\(.*\\)\\.\\(.*\\)/\\1_\\2/'` + + +.SUFFIXES: .sty .ins .dtx .pdf .ps .pdf + +.ins.sty: + pdflatex $< + +.dtx.pdf: + pdflatex $< + pdflatex $< + makeindex -s gind.ist $(*D)/$(*F) + makeindex -s gglo.ist -o $(*D)/$(*F).gls $(*D)/$(*F).glo + pdflatex $< + +all: typogrid.sty typogrid.pdf + + +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.pdf + @-rm -f testtypogrid.pdf + +tar: all clean + -rm -f typogrid-$(VERSION).tar.gz + tar czCf .. typogrid-$(VERSION).tar.gz \ + $(SRCDIR)/README \ + $(SRCDIR)/ChangeLog \ + $(SRCDIR)/Makefile \ + $(SRCDIR)/typogrid.dtx \ + $(SRCDIR)/typogrid.ins \ + $(SRCDIR)/typogrid.pdf \ + $(SRCDIR)/getversion.tex \ + $(SRCDIR)/testtypogrid.tex + rm -f getversion.log + +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 ChangeLog typogrid.pdf testtypogrid.tex doc/latex/typogrid + zip -r typogrid-$(VERSION).zip tex doc source + rm -r tex/ doc/ source/ + rm -f getversion.log + +install: all + if [ ! -d $(INSTALLDIR) ]; then mkdirhier $(INSTALLDIR); fi + if [ ! -d $(DOCDIR) ]; then mkdirhier $(DOCDIR); fi + install -m644 typogrid.sty $(INSTALLDIR) + install -m644 typogrid.pdf $(DOCDIR) + texhash + + +typogrid.sty: typogrid.ins typogrid.dtx + diff --git a/macros/latex/contrib/typogrid/README b/macros/latex/contrib/typogrid/README new file mode 100644 index 0000000000..2b2f4478ce --- /dev/null +++ b/macros/latex/contrib/typogrid/README @@ -0,0 +1,47 @@ +typogrid.sty +============ + +This package produces a typographic grid on every page of the +document. That grid consists of vertical lines that devide the +text block into columns. This may be useful to get the horizontal +measures (distances etc.) into good values. + + +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. + + + +Installation: + +automatic: - run make + - run make install + or + - run make + - copy typogrid.sty to a place where LaTeX can find it + - run texhash or the corresponding command of your distribution + +by hand: - execute latex on typogrid.ins + - copy typogrid.sty to a place LaTeX can find it + - run texhash or the corresponding command of your distribution + If you also want to re-compile the documentation which should not + be necessary do the following items, too: + - execute: + latex typogrid.dtx + latex typogrid.dtx + makeindex -s gglo.ist -o typogrid.gls typogrid.glo + makeindex -s gind.ist typogrid + latex typogrid.dtx + - copy typogrid.dvi to the documentation tree of your + TeX implementation + - run texhash or the corresponding command of your distribution, + again + + +2011-12-31 +Harald Harders +harald.harders@gmx.de diff --git a/macros/latex/contrib/typogrid/getversion.tex b/macros/latex/contrib/typogrid/getversion.tex new file mode 100644 index 0000000000..689da0b89c --- /dev/null +++ b/macros/latex/contrib/typogrid/getversion.tex @@ -0,0 +1,7 @@ +\documentclass[english]{ltxdoc} +\nofiles +\usepackage{typogrid} +\GetFileInfo{typogrid.sty} +\typeout{VERSION \fileversion} +\begin{document} +\end{document} diff --git a/macros/latex/contrib/typogrid/testtypogrid.tex b/macros/latex/contrib/typogrid/testtypogrid.tex new file mode 100644 index 0000000000..532dbb142a --- /dev/null +++ b/macros/latex/contrib/typogrid/testtypogrid.tex @@ -0,0 +1,53 @@ +\documentclass[draft,a4paper]{article} +%\usepackage[columns=4,headings=false,margin=false]{typogrid} +\usepackage[columns=4,colorgrid]{typogrid} +\usepackage[dvips]{geometry} +\flushbottom +\long\def\text{This is a sample text without any meaning. It contains + some arbitrary text. But I don't know more. I really have no idea + what I could now write. This is the next try to build a new + sentence. Somehow, I have to fill the page with arbitrary text.\par} + +\pagestyle{headings} + +\begin{document} +\text +\text +\text +\text +\text +\section{Test} +\text + +\noindent\rule{\gridwidth}{2pt} + +\text +\text +\marginpar[This is left margin text.]{This is right margin text.} +\text +\text +\text +\text +\text +\text +\typogridsetup{columns=6,margin=false}% +\text + +\noindent\rule{\gridwidth}{2pt} + +\text +\text +\text +\text +\text +\text +\text +\begin{figure} + \centering + \thicklines + \framebox[2\gridwidth][c]{Hello}% + \caption{A figure fitting into the grid}% + \label{fig:grid}% +\end{figure} + +\end{document} diff --git a/macros/latex/contrib/typogrid/typogrid.dtx b/macros/latex/contrib/typogrid/typogrid.dtx new file mode 100644 index 0000000000..4ea0c77c65 --- /dev/null +++ b/macros/latex/contrib/typogrid/typogrid.dtx @@ -0,0 +1,351 @@ +% \iffalse meta comment +% File: typogrid.dtx Copyright (C) 2003, 2011 Harald Harders, Rolf Niepraschk +% \fi +% +% \iffalse +%<*driver> +\listfiles +\documentclass[a4paper]{ltxdoc} +\usepackage[T1]{fontenc} +\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 +\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter} +\DoNotIndex{\setcounter,\space,\if,\else,\fi,\empty,\@empty,\ifx,\fi} +\DoNotIndex{\ifnum,\fi,\expandafter,\csname,\endcsname,\the} +\DoNotIndex{\MessageBreak,\message,\newlength,\newif,\xdef,\newcount} +\DoNotIndex{\begingroup,\endgroup,\,,\@tempcnta,\@tempdima,\advance} +\DoNotIndex{\ensuremath,\filedate,\fileversion,\docdate} +\DoNotIndex{\mathit,\mathrm,\mathsf,\nprt@tmp,\nprt@tmpnum,\relax} +\DoNotIndex{\protect,\renewcommand,\setlength,\settowidth,\stepcounter} +\DoNotIndex{\string,\put,\multiput} +\CodelineNumbered +\RecordChanges +\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 +% \begin{abstract} +% \noindent +% This package produces a typographic grid on every page of the +% document. +% That grid consists of vertical lines that devide the text block into +% columns. +% This may be useful to get the horizontal measures (distances etc.) +% into good values. +% \end{abstract} +% +% \tableofcontents +% +% \section*{Copyright} +% 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. +% +% \section{Usage} +% +% Load the package using the +% \begin{quote} +% \cs{usepackage}\oarg{options}|{typogrid}| +% \end{quote} +% command. +% 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. +% +% When |draft| is given the typographic grid is switched on; if +% |final| or none of the above is given it is switched off. +% +% 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 typographic grid. +% You may use the \cs{typogridsetup} command that takes a keyval list +% as argument. +% The same keywords are allowed as in the \cs{usepackage} line, e.g., +% \begin{quote} +% |\typogridsetup{columns=4}| +% \end{quote} +% 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} + [2011/12/31 v0.21 Typographic grid] +\RequirePackage{calc} +\RequirePackage{keyval} +% \end{macrocode} +% Introduce the used lengths. +% \begin{macrocode} +\newlength{\gridwidth}% +% \end{macrocode} +% Introduce the used counters and set the default number of columns. +% \begin{macrocode} +\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 +% typographic grid. +% The argument takes a list of keyval options. +% \begin{macrocode} +\newcommand*\typogridsetup[1]{% + \expandafter\setkeys\expandafter{typogrid}{#1}} +% \end{macrocode} +% \end{macro} +% Define the key |columns| that takes the number of columns. +% \begin{macrocode} +\define@key{typogrid}{columns}{% + \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@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} +% Load this package after processing the options. +% \begin{macrocode} +\RequirePackage{eso-pic}[2002/11/16] +% \end{macrocode} +% \begin{macro}{\typogrid} +% Define the command that produces the grid. +% \begin{macrocode} +\newcommand*\typogrid{% +% \end{macrocode} +% Switch to black and thin lines. +% \begin{macrocode} + \begingroup + \normalcolor + \thinlines +% \end{macrocode} +% Calculate the number of lines to be printed. +% \begin{macrocode} + \@tempcnta=\tpg@blocks + \advance\@tempcnta by -1% +% \end{macrocode} +% Print a frame around the text block. +% \begin{macrocode} + \AtTextLowerLeft{% + \put(0,0){% + \framebox(\LenToUnit{\textwidth},\LenToUnit{\textheight}){}}% +% \end{macrocode} +% Print the vertical lines for the grid. +% \begin{macrocode} + \multiput(\LenToUnit{\gridwidth},0)% + (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% + \line(0,1){\LenToUnit{\textheight}}}% + }% +% \end{macrocode} +% Print a frame around the head line if wanted. +% \begin{macrocode} + \iftpg@headings + \AtTextUpperLeft{% + \put(0,\LenToUnit{\headsep}){% + \framebox(\LenToUnit{\textwidth},\LenToUnit{\headheight}){}}% +% \end{macrocode} +% Print the grid. +% \begin{macrocode} + \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} +% +% \iffalse +%</package> +% \fi +% \Finale + diff --git a/macros/latex/contrib/typogrid/typogrid.ins b/macros/latex/contrib/typogrid/typogrid.ins new file mode 100644 index 0000000000..0320cbf8d0 --- /dev/null +++ b/macros/latex/contrib/typogrid/typogrid.ins @@ -0,0 +1,25 @@ +\input docstrip.tex +\preamble + + typogrid package + + 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, rolf.niepraschk@ptb.de + +\endpreamble + +\askforoverwritefalse + +% Files +%%%%%%%%%%%%%%%%%%%%%% +\generate{% + \file{typogrid.sty}{\from{typogrid.dtx}{package}}% +}% + +\endbatchfile diff --git a/macros/latex/contrib/typogrid/typogrid.pdf b/macros/latex/contrib/typogrid/typogrid.pdf Binary files differnew file mode 100644 index 0000000000..9a50141f9b --- /dev/null +++ b/macros/latex/contrib/typogrid/typogrid.pdf |