From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/contour/ChangeLog | 24 + macros/latex/contrib/contour/Makefile | 83 +++ macros/latex/contrib/contour/README | 40 ++ macros/latex/contrib/contour/contour.dtx | 871 +++++++++++++++++++++++++++ macros/latex/contrib/contour/contour.ins | 64 ++ macros/latex/contrib/contour/contour.pdf | Bin 0 -> 180950 bytes macros/latex/contrib/contour/contourtest.tex | 49 ++ 7 files changed, 1131 insertions(+) create mode 100644 macros/latex/contrib/contour/ChangeLog create mode 100644 macros/latex/contrib/contour/Makefile create mode 100644 macros/latex/contrib/contour/README create mode 100644 macros/latex/contrib/contour/contour.dtx create mode 100644 macros/latex/contrib/contour/contour.ins create mode 100644 macros/latex/contrib/contour/contour.pdf create mode 100644 macros/latex/contrib/contour/contourtest.tex (limited to 'macros/latex/contrib/contour') diff --git a/macros/latex/contrib/contour/ChangeLog b/macros/latex/contrib/contour/ChangeLog new file mode 100644 index 0000000000..2d08304a63 --- /dev/null +++ b/macros/latex/contrib/contour/ChangeLog @@ -0,0 +1,24 @@ +2004/11/18 v2.14 Harald Harders (h.harders@tu-bs.de) + - Add support for DVIPSONE. + +2004/11/04 v2.13 Harald Harders (h.harders@tu-bs.de) + - More robust mechanism to change Postscript internals for dvips. + +2004/08/29 v2.12 Harald Harders (h.harders@tu-bs.de) + - Full outline support for VTeX. + +2004/08/29 v2.11 Harald Harders (h.harders@tu-bs.de) + - Restricted outline support for VTeX. + +2004/08/23 v2.10 Harald Harders (h.harders@tu-bs.de) + - Print text with real outlines for vector fonts. + - Bugfix: enable switching colors inside \contour argument. + +2004/08/03 v2.00 Harald Harders (h.harders@tu-bs.de), + Morten Høgholm (moho01ab@student.cbs.dk) + - Allow arbitrary numbers of copies and automatic determination of + this number. + +2003/11/09 v1.04 Harald Harders (h.harders@tu-bs.de) + - Avoide usage of \textversion etc. + - Avoid line break of inner text. diff --git a/macros/latex/contrib/contour/Makefile b/macros/latex/contrib/contour/Makefile new file mode 100644 index 0000000000..6a8cdcda82 --- /dev/null +++ b/macros/latex/contrib/contour/Makefile @@ -0,0 +1,83 @@ + +SRCDIR=contour +INSTALLDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/tex/latex/contour +DOCDIR=`kpsewhich --expand-path='$$TEXMFLOCAL'`/doc/latex/contour +VERSION=`grep '^%<.*> *\\[' contour.dtx | sed 's/^%<.*> *\\[[0-9/]* *\\(v[0-9]*\\)\\.\\([0-9]*\\).*/\\1_\\2/'` + +.SUFFIXES: .sty .ins .dtx .dvi .ps .pdf + +.ins.sty: + latex $< + +.dtx.pdf: + pdflatex $< + pdflatex $< + makeindex -s gind.ist $(*D)/$(*F) + makeindex -s gglo.ist -o $(*D)/$(*F).gls $(*D)/$(*F).glo + pdflatex $< + +.dvi.ps: + dvips -o $(*D)/$(*F).ps $(*D)/$(*F) + + +all: contour contour.pdf + + +contour: contour.sty + + +clean: + @-rm -f contour.glo contour.gls contour.idx contour.ilg + @-rm -f contour.ind contour.aux contour.log contour.toc + @-rm -f *~ + +distclean: clean + @-rm -f contour.sty contour.pdf dvips.cnt dvipsone.cnt pdftex.cnt vtex.cnt contour.cfg + +tar: all clean + @echo Lege contour-$(VERSION).tar.gz an + -@rm -f contour-$(VERSION).tar.gz + @tar czCf .. contour-$(VERSION).tar.gz \ + $(SRCDIR)/README \ + $(SRCDIR)/ChangeLog \ + $(SRCDIR)/Makefile \ + $(SRCDIR)/contour.dtx \ + $(SRCDIR)/contour.ins \ + $(SRCDIR)/contour.pdf \ + $(SRCDIR)/contour.xml \ + $(SRCDIR)/contourtest.tex + +zip: all clean + -@rm -f contour-$(VERSION).zip + mkdirhier tex/latex/contour + mkdirhier doc/latex/contour + mkdirhier source/latex/contour + mv contour.sty dvips.cnt dvipsone.cnt pdftex.cnt vtex.cnt contour.cfg tex/latex/contour + cp contour.dtx contour.ins contour.xml source/latex/contour + cp Makefile source/latex/contour + cp README contour.pdf ChangeLog contourtest.tex doc/latex/contour + zip -r contour-$(VERSION).zip tex doc source + rm -r tex/ doc/ source/ + +texlive: all clean + rm -rf texmf + mkdir -p texmf/tex/latex/contour + mkdir -p texmf/doc/latex/contour + mkdir -p texmf/source/latex/contour + cp contour.sty dvips.cnt dvipsone.cnt pdftex.cnt vtex.cnt contour.cfg texmf/tex/latex/contour + cp contour.dtx contour.ins contour.xml texmf/source/latex/contour + cp Makefile texmf/source/latex/contour + cp README ChangeLog texmf/doc/latex/contour + cp contour.pdf contourtest.tex texmf/doc/latex/contour + +install: all + if [ ! -d $(INSTALLDIR) ]; then mkdirhier $(INSTALLDIR); fi + if [ ! -d $(DOCDIR) ]; then mkdirhier $(DOCDIR); fi + install -m644 contour.sty pdftex.cnt dvips.cnt dvipsone.cnt vtex.cnt contour.cfg $(INSTALLDIR) + install -m644 contour.pdf contourtest.tex README ChangeLog $(DOCDIR) + texhash + +contour.sty: contour.ins contour.dtx + +version: + @echo $(VERSION) \ No newline at end of file diff --git a/macros/latex/contrib/contour/README b/macros/latex/contrib/contour/README new file mode 100644 index 0000000000..a1df3ba76b --- /dev/null +++ b/macros/latex/contrib/contour/README @@ -0,0 +1,40 @@ +contour.sty -- printing a contour for a text + +This package generates a colored contour around a given text in order +to enable printing text over a background without the need of a +color box around the text. +By default this is done by placing copies of the text around the text +itself and can be switched to use real outlines if supported by the +backend driver. + + +Automatic installation: +======================= +Run the Makefile by using + make all +or even + make install + + +Manual installation: +==================== +1. Run + latex contour.ins +2. Copy contour.sty to a directory of the LaTeX search path. +3. Documentation is available in contour.pdf or by running + pdflatex contour.dtx + pdflatex contour.dtx + makeindex -s gind.ist contour + makeindex -s gglo.ist -o contour.gls contour.glo + pdflatex contour.dtx + + +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. + + +2004/08/23 +Harald Harders +h.harders@tu-bs.de diff --git a/macros/latex/contrib/contour/contour.dtx b/macros/latex/contrib/contour/contour.dtx new file mode 100644 index 0000000000..68fe993e06 --- /dev/null +++ b/macros/latex/contrib/contour/contour.dtx @@ -0,0 +1,871 @@ +% \iffalse meta comment +% File: contour.dtx Copyright (C) 1999--2004 Harald Harders, Morten Høgholm +% \fi +% +% \iffalse +% +%<*driver> +\documentclass{ltxdoc} +\IfFileExists{contour.sty}{\usepackage{contour} + \let\contourSTYfound\active}{\GenericWarning{contour.dtx}{Package + file contour.sty not found (Documentation will be messed up!^^J^^A + Generate contour.sty by (La)TeXing contour.ins, process + contour.dtx again)^^J}\stop} +\usepackage{longtable} +\usepackage{graphicx} +\usepackage{url} +\GetFileInfo{contour.sty} +\title{The contour package} +\author{Harald Harders (\texttt{h.harders@tu-bs.de})\\ + Morten H\o gholm (\texttt{moho01ab@student.cbs.dk})} +\date{File version \fileversion, date \filedate, printed \today} +\EnableCrossrefs +\CodelineIndex +\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter} +\DoNotIndex{\setcounter,\space,\ifx,\else,\fi,\global,\newlength,\number} +\DoNotIndex{\relax,\setlength,\strip@pt,\the,\typeout,\p@,\z@,\@ne} +\DoNotIndex{\ProvidesPackage,\RequirePackage,\NeedsTeXFormat} +\DoNotIndex{\@firstoftwo,\@secondoftwo,\ifdim,\fi,\ifnum,\fi} +\CodelineNumbered +\RecordChanges +\CheckSum{326} +\renewcommand\floatpagefraction{0.75} +\begin{document} + \DocInput{contour.dtx} +\end{document} +% +% \fi +% +% \changes{2.14}{2004/11/18}{Full outline support for Y\&Y DVIPSONE}% +% \changes{2.12}{2004/08/28}{Full outline support for V\TeX}% +% \changes{2.11}{2004/08/28}{Restricted outline support for V\TeX}% +% \changes{2.10}{2004/08/23}{Print text with real outlines for vector +% fonts}% +% \changes{2.00}{2004/08/03}{Allow arbitrary numbers of text copies}% +% \changes{1.04}{2003/11/09}{Avoide usage of \cs{textversion} etc.}% +% +% \maketitle +% \begin{abstract} +% \noindent +% This package generates a colored contour around a given text in order +% to enable printing text over a background without the need of a +% color box around the text. +% By default this is done by placing copies of the text around the text +% itself and can be switched to use real outlines if supported by the +% backend driver. +% \end{abstract} +% +% \tableofcontents +% +% \section*{Copyright} +% Copyright 1999--2004 Harald Harders, Morten H\o gholm. +% +% 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{Introduction} +% Sometimes it is necessary to print text over a background that is +% not pure white, e.g., in gnuplot plots. It is not always wished to +% plot the text in a rectangular box since this can cover important +% information or look poor. This package provides a solution to cover +% less space with the text and ensure readable text in the same time. +% +% The used technique is quite simple. +% By default, in a circle around the original text position the same +% text is printed evenly distributed 16, 32, or a a given number +% times. +% The default radius for the circle is $0.03\,\mathrm{em}$. +% If requested and supported by the used driver (dvips, pdf\TeX, V\TeX, +% DVIPSONE) a real outline can be chosen instead of text copies. +% +% +% \section{User interface} +% +% To use this package place +% \begin{verbatim} +%\usepackage[]{contour}\end{verbatim} +% in the preamble of your document. +% +% If loaded without package option or with the option |copies| the +% contour is printed by placing copies of the text around the original +% text, as described below. +% This can be changed by the option |outline|. +% If specified this option the contour is printed by a real outline of +% the text instead of copies. +% This increases speed as well as quality\footnote{Especially in +% Acrobat Reader, the quality is better.} and reduces the file size. +% But some prerequisites have to be fulfilled: +% \begin{itemize} +% \item The backend driver has to be supported. +% Currently, dvips, pdf\TeX, V\TeX, and DVIPSONE are supported. +% Normally, the file |contour.cfg| tries to find out which driver +% has to be loaded.\footnote{DVIPSONE cannot be determined +% automatically.} +% But you can also specify the driver by giving one of the package +% options |dvips|, |xdvi|, |pdftex|, |vtex|, or |dvipsone|. +% |xdvi| refers to |dvips| as driver. +% In xdvi and DVIWindo, the contours are silently ignored. +% \item Outline (vector) fonts have to be used. +% With dvips, this means that Type\,1 fonts have to be used. +% With pdf\TeX, Type\,1 or TrueType fonts are supported. +% If you are using METAFONT fonts you have to use copies (package +% option |copies|). +% \end{itemize} +% +% +% \DescribeMacro{\contour}% +% The package provides the commands +%\begin{verbatim} +%\contour{}{} +%\contour[]{}{} +%\contour*{}{}\end{verbatim} +% which produce the text \meta{text} with a \meta{color}ed contour +% around. +% The text itself is typeset in the normal active color. +% The normal \cs{contour} command produces 16 copies of the text while +% the |*| variant makes 32 copies. +% If \meta{number} is given, the given number of copies is generated +% around the text. +% If \meta{number} is |auto| instead of a number, the number of copies +% is calculated automatically depending on the font size. +% +% \DescribeMacro{\contourlength}% +% The radius of the circle (= thickness of the contour) can be changed using +% the command \cs{contourlength}\marg{length}, where \meta{length} is a +% length understood by \LaTeX. The length is not expanded when defining the +% contour length but when using it. For example when using |0.05em|, +% $0.05\,\mathrm{em}$ of the font used in the command \cs{contour} are used. +% +% \DescribeMacro{\contournumber}% +% By default, \cs{contour} generates 16 copies of the text. +% You can change this by using \cs{contournumber}, e.g., +%\begin{verbatim} +%\contournumber{27}\end{verbatim} +% If you specify |auto| instead of a number, \cs{contour} will use the +% automatically calculated number of copies. +% You may also use the package option |auto| to reach this behaviour: +% \begin{verbatim} +%\usepackage[auto]{contour}\end{verbatim} +% If using outlines the number of copies is ignored. +% +% +% \section{Examples} +% +% The command +%\begin{verbatim} +% \colorbox{black}{This text is not visible +% \contour{white}{but this is.}}\end{verbatim} +% produces: +% \medskip +% +% \noindent +% \colorbox{black}{This text is not visible \contour{white}{but this +% is.}} +% \medskip +% +% Another example is shown in Figure~\ref{fig:comparison}. +% \begin{figure} +% \contourlength{0.05em} +% \centering +% \unitlength1mm +% \begin{picture}(50,30)% +% \put(0,0){\line(1,0){50}}% +% \put(0,30){\line(1,0){50}}% +% \put(0,0){\line(0,1){30}}% +% \put(50,0){\line(0,1){30}}% +% \put(0,25){\line(1,1){5}}% +% \put(0,20){\line(1,1){10}}% +% \put(0,15){\line(1,1){15}}% +% \put(0,10){\line(1,1){20}}% +% \put(0,5){\line(1,1){25}}% +% \multiput(0,0)(5,0){5}{\line(1,1){30}}% +% \put(25,0){\line(1,1){25}}% +% \put(30,0){\line(1,1){20}}% +% \put(35,0){\line(1,1){15}}% +% \put(40,0){\line(1,1){10}}% +% \put(45,0){\line(1,1){5}}% +% \put(0,5){\line(1,-1){5}}% +% \put(0,10){\line(1,-1){10}}% +% \put(0,15){\line(1,-1){15}}% +% \put(0,20){\line(1,-1){20}}% +% \put(0,25){\line(1,-1){25}}% +% \multiput(0,30)(5,0){5}{\line(1,-1){30}}% +% \put(25,30){\line(1,-1){25}}% +% \put(30,30){\line(1,-1){20}}% +% \put(35,30){\line(1,-1){15}}% +% \put(40,30){\line(1,-1){10}}% +% \put(45,30){\line(1,-1){5}}% +% \put(25,23){\makebox(0,0)% +% {{\Large\colorbox{white}{text with colorbox}}}}% +% \put(25,15){\makebox(0,0)% +% {{\Large\contour{white}{text with contour}}}}% +% \put(25,7){\makebox(0,0)% +% {{\Large simple text}}}% +% \end{picture} +% \caption{Comparison of the commands \cs{colorbox} and +% \cs{contour}} +% \label{fig:comparison} +% \end{figure} +% +% In Figure~\ref{fig:anzahl}, you can see how the output depends on +% the number of copies. +% \begin{figure} +% \centering +% \begin{minipage}{0.85\linewidth} +% \contourlength{0.08em}% +% \let\lw\linewidth +% \definecolor{gray50}{rgb}{0.5,0.5,0.5} +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[1]{white}{Test}}}}\\% +% a) 1 white copy +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[2]{white}{Test}}}}\\% +% b) 2 white copies +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[3]{white}{Test}}}}\\% +% c) 3 white copies +% \end{minipage}\\[5pt] +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[4]{white}{Test}}}}\\% +% e) 4 white copies +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[8]{white}{Test}}}}\\% +% f) 8 white copies +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[16]{white}{Test}}}}\\% +% g) 16 white copies +% \end{minipage}\\[5pt] +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[32]{white}{Test}}}}\\% +% h) 32 white copies +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[60]{white}{Test}}}}\\% +% i) 60 white copies +% \end{minipage} +% \hfill +% \begin{minipage}{0.3\lw} +% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[120]{white}{Test}}}}\\% +% j) 120 white copies +% \end{minipage} +% \end{minipage} +% \caption{Contours with different numbers of copies +% with a large distance between text and copies} +% \label{fig:anzahl} +% \end{figure} +% +% +% \section{Advanced internals} +% +% Normally, it is not planned to switch between outline and copy mode. +% If you really have to do it you can use the boolean +% \cs{ifcon@outline}. +% \cs{con@outlinetrue} switches on outlines, while replacing |true| by +% |false| switches them off. +% Don't forgett to surround it by \cs{makeatletter} and +% \cs{makeatother} to allow |@| in command names. +% +% See the difference between copy and outline mode: +% \medskip +% +% \begingroup +% \contourlength{0.05em}% +% \Huge +% \textcolor{white}{\contour{black}{Copies}} +% \makeatletter +% \con@outlinetrue +% \makeatother +% \textcolor{white}{\contour{black}{Outline}} +% \endgroup +% +% +% \section{Acknowledgements} +% +% Thanks to Richard Pfeiffer who had the idea for this package and +% wrote some code that did it. +% +% Thanks to Dietrich Grau who asked me for support of DVIPSONE and who +% did the testing of all my code ideas for this driver since I do not +% have Y\&Y \TeX. +% +% +% \StopEventually{\PrintChanges \PrintIndex} +% +% +% \section{The implementation} +% +% Heading of the package: +% \begin{macrocode} +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesFile{dvips.cnt} +%\ProvidesFile{pdftex.cnt} +%\ProvidesFile{vtex.cnt} +%\ProvidesFile{dvipsone.cnt} +%\ProvidesFile{contour.cfg} +%\ProvidesPackage{contour} +% [2004/11/18 v2.14 Print contoured text (HH, MH)] +%<*package> +% \end{macrocode} +% +% \subsection{The package} +% +% This package requires the color package from the graphics bundle: +% \begin{macrocode} +\RequirePackage{color} +% \end{macrocode} +% This package requires the trig package: +% \begin{macrocode} +\RequirePackage{trig} +% \end{macrocode} +% A command that makes \cs{color} inactive prevent the background text +% color from being changed: +% \changes{2.10}{2004/08/23}{Bugfix: enable switching colors inside +% \cs{contour} argument}% +% \begin{macrocode} +\def\con@coloroff{% + \def\@undeclaredcolor[##1]##2{}% + \def\@declaredcolor##1{}% +} +% \end{macrocode} +% Set text to a specified relative position without using space: +% \begin{macrocode} +\newcommand*\con@put[3]{% + \rlap{\hskip#1\raisebox{#2}[0pt]{#3}}% +} +% \end{macrocode} +% \begin{macro}{\contourlength} +% Define the commands for changing the base length: +% \begin{macrocode} +\newcommand*\contourlength[1]{\def\con@base@length{#1}} +\contourlength{0.03em} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\contournumber} +% Define the commands for changing the number of text copies: +% \begin{macrocode} +\newcommand*\contournumber[1]{\def\con@default@copies{#1}} +\contournumber{16} +% \end{macrocode} +% \end{macro} +% Define new offset length: +% \begin{macrocode} +\newlength{\con@length} +% \end{macrocode} +% Define the angles for using `\meta{\#1}' copies unless they've +% previously been defined. We use `trig' for this. +% \begin{macrocode} +\newcommand*\con@define@copyangles[1]{% + \edef\con@tempa{auto}% + \edef\con@tempb{#1}% +% \end{macrocode} +% Set the number of copies automatically. +% \begin{macrocode} + \ifx\con@tempa\con@tempb + \expandafter\ifdim\f@size pt<15pt\relax + \edef\con@tempb{16}% + \else + \expandafter\ifdim\f@size pt<25pt\relax + \edef\con@tempb{32}% + \else + \expandafter\ifdim\f@size pt<50pt\relax + \edef\con@tempb{60}% + \else + \edef\con@tempb{120}% + \fi + \fi + \fi + \fi + \@tempcnta=\con@tempb\relax + \@ifundefined{con@\number\@tempcnta @copies}{% + \global\@namedef{con@\number\@tempcnta @copies}{}% + \@tempdima=360\p@ + \divide\@tempdima by \@tempcnta + \@tempdimb=\z@ + \@tempcntb=\z@ + \loop + \ifnum\@tempcntb<\@tempcnta + \edef\con@temp@fdim{\strip@pt\@tempdimb}% + \CalculateSin{\con@temp@fdim}% + \CalculateCos{\con@temp@fdim}% + \advance\@tempcntb \@ne + \advance\@tempdimb \@tempdima\relax + \repeat + }{}% + \let\con@tempa\@undefined + \let\con@tempb\@undefined +} +% \end{macrocode} +% \begin{macro}{\contour} +% The starred version of \cs{contour} prints 32 copies. +% \begin{macrocode} +\newcommand*\contour{\@ifstar{\@contour[32]}{\@contour}} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand*\@contour[3][\con@default@copies]{% + \ifvmode + \leavevmode + \fi + \setlength\con@length{\con@base@length}% +% \end{macrocode} +% Print outline or copies? +% \begin{macrocode} + \ifcon@outline + \typeout{contour: Using real outline for `#3'\on@line.}% + \@contour@outline{#2}{#3}% + \else + \begingroup +% \end{macrocode} +% Calculate the copy angles. +% \begin{macrocode} + \con@define@copyangles{#1}% + \typeout{contour: Using \the\@tempcnta\space copies for `#3'\on@line.}% + \@tempdima=360\p@ + \divide\@tempdima by \@tempcnta\relax + \@tempdimb=\z@ + \@tempcntb=\z@ +% \end{macrocode} +% Set color ans switch off color command inside argument. +% \begin{macrocode} + \color{#2}% + \con@coloroff +% \end{macrocode} +% Print the copies. +% \begin{macrocode} + \loop + \ifnum\@tempcntb<\@tempcnta\relax + \edef\con@temp@fdim{\strip@pt\@tempdimb}% + \con@put + {\UseSin{\con@temp@fdim}\con@length}% + {\UseCos{\con@temp@fdim}\con@length}% + {#3}% + \advance\@tempcntb \@ne\relax + \advance\@tempdimb\@tempdima\relax + \repeat + \endgroup +% \end{macrocode} +% Print the main text. +% \begin{macrocode} + \mbox{#3}% + \fi +} +% \end{macrocode} +% By default, no driver is active. +% \begin{macrocode} +\providecommand*\con@driver{\@empty} +% \end{macrocode} +% Boolean for using outline or copies. +% \begin{macrocode} +\newif\ifcon@outline +% \end{macrocode} +% Options: +% \begin{macrocode} +\DeclareOption{auto}{\contournumber{auto}} +\DeclareOption{dvips}{\def\con@driver{dvips.cnt}} +\DeclareOption{xdvi}{\ExecuteOptions{dvips}} +\DeclareOption{pdftex}{\def\con@driver{pdftex.cnt}} +\DeclareOption{vtex}{\def\con@driver{vtex.cnt}} +\DeclareOption{dvipsone}{\def\con@driver{dvipsone.cnt}} +\DeclareOption{outline}{\con@outlinetrue} +\DeclareOption{copies}{\con@outlinefalse} +% \end{macrocode} +% Load configuration file if existing. +% \begin{macrocode} +\InputIfFileExists{contour.cfg}{% + \typeout{Loading configuration file `contour.cfg'.}% +}{% + \typeout{No configuration file `contour.cfg' found.}% +} +% \end{macrocode} +% Process the options. +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% Load the driver file. +% \begin{macrocode} +\expandafter\ifx\con@driver\@empty + \ifcon@outline + \PackageError{contour}{Chosen package option `outline' but no + driver defined}{Leave out the `outline' option or define a driver}% + \else + \PackageWarning{contour}{No driver defined (which does not matter + when using copies)}% + \fi +\else + \InputIfFileExists{\con@driver}{% + \typeout{contour: Using driver file `\con@driver'.}% + }{% + \PackageError{contour}{Driver file `\con@driver' does not exist}{}% + }% +\fi +% +% \end{macrocode} +% \end{macro} +% +% \subsection{Driver Files} +% +% \subsubsection{Dvips} +% +% \begin{macro}{\@contour@outline} +% Prints the text and contour using real outlines. +% \cs{@contour@outline\marg{color}\marg{text}} +% \begin{macrocode} +%<*dvips> +\newcommand*\@contour@outline[2]{% + \begingroup +% \end{macrocode} +% Double the width of the contour since the inner half is overprinted +% by the normal text; convert |pt| to |bp|. +% \begin{macrocode} + \setlength\con@length{2\con@length}% + \setlength\con@length{0.99626400996\con@length}% +% \end{macrocode} +% Set the contour color and disable color command. +% \begin{macrocode} + \color{#1}% + \con@coloroff +% \end{macrocode} +% PostScript preamble to print an outline for the text. +% \begin{macrocode} + \special{ps: +% \end{macrocode} +% First, save all graphics settings to avoid side effects. +% \begin{macrocode} + gsave +% \end{macrocode} +% Start a new path and choose a round pen. +% \begin{macrocode} + newpath + 1 setlinejoin + 1 setlinecap +% \end{macrocode} +% Set the line width and scale it according to the PostScript scale. +% \begin{macrocode} + Resolution 72 div DVImag mul + \strip@pt\con@length\space mul setlinewidth +% \end{macrocode} +% \changes{2.13}{2004/11/04}{More robust mechanism to change +% Postscript internals for dvips}% +% Save |show| to be able to restore it later. +% \begin{macrocode} + /cntorigshow /show load def +% \end{macrocode} +% Redefine the |show| command that prints a text to do the outline +% instead of the text. +% \begin{macrocode} + /show { false charpath } def + }% +% \end{macrocode} +% Typeset the outline text. +% \begin{macrocode} + \rlap{#2}% +% \end{macrocode} +% PostScript postamble. +% \begin{macrocode} + \special{ps: +% \end{macrocode} +% Finally, do the outline. +% \begin{macrocode} + stroke +% \end{macrocode} +% Restore the original settings. +% \begin{macrocode} + /show /cntorigshow load def + grestore + }% + \endgroup +% \end{macrocode} +% Print the main text. +% \begin{macrocode} + \mbox{#2}% +} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{pdf\TeX} +% +% \begin{macro}{\@contour@outline} +% Prints the text and contour using real outlines. +% \cs{@contour@outline\marg{color}\marg{text}} +% \begin{macrocode} +%<*pdftex> +\newcommand*\@contour@outline[2]{% + \begingroup +% \end{macrocode} +% Double the width of the contour since the inner half is overprinted +% by the normal text; convert |pt| to |bp|. +% \begin{macrocode} + \setlength\con@length{2\con@length}% + \setlength\con@length{0.99626400996\con@length}% +% \end{macrocode} +% Set the contour color and disable color command. +% \begin{macrocode} + \color{#1}% + \con@coloroff +% \end{macrocode} +% PDF preamble. +% \begin{macrocode} + \pdfliteral{% +% \end{macrocode} +% Save the graphics settings. +% \begin{macrocode} + q +% \end{macrocode} +% Choose a round pen. +% \begin{macrocode} + 1 j + 1 J +% \end{macrocode} +% Switch text to print an outline instead of fill. +% \begin{macrocode} + 1 Tr +% \end{macrocode} +% Set the line width. +% \begin{macrocode} + \strip@pt\con@length\space w + }% +% \end{macrocode} +% Typeset the outline text. +% \begin{macrocode} + \rlap{#2}% +% \end{macrocode} +% PDF postamble. +% \begin{macrocode} + \pdfliteral{% +% \end{macrocode} +% Restore original settings. +% \begin{macrocode} + Q + }% + \endgroup +% \end{macrocode} +% Print the main text. +% \begin{macrocode} + \mbox{#2}% +} +% +% \end{macrocode} +% \end{macro} +% +% +% +% \subsubsection{V\TeX} +% +% \begin{macro}{\@contour@outline} +% Prints the text and contour using real outlines. +% \cs{@contour@outline\marg{color}\marg{text}} +% \begin{macrocode} +%<*vtex> +\newcommand*\@contour@outline[2]{% + \begingroup +% \end{macrocode} +% Double the width of the contour since the inner half is overprinted +% by the normal text; convert |pt| to |bp|. +% \begin{macrocode} + \setlength\con@length{2\con@length}% + \setlength\con@length{0.99626400996\con@length}% +% \end{macrocode} +% Set the contour color and disable color command. +% \begin{macrocode} + \color{#1}% + \con@coloroff +% \end{macrocode} +% PostScript preamble to print an outline for the text. +% +% At this point, V\TeX\ does an ugly job since it interprets this code +% immediately and thus puts the path itself into the output instead of +% just let the printer do the work. +% I do not know how to change this. +% \begin{macrocode} + \special{pS: +% \end{macrocode} +% First, save all graphics settings to avoid side effects. +% \begin{macrocode} + save +% \end{macrocode} +% Start a new path and choose a round pen. +% \begin{macrocode} + newpath + 1 setlinejoin + 1 setlinecap +% \end{macrocode} +% Set the line width. +% \begin{macrocode} + \strip@pt\con@length\space setlinewidth +% \end{macrocode} +% Redefine the command that prints a text to do the outline instead of +% the text. +% \begin{macrocode} + /show { false charpath } def + }% +% \end{macrocode} +% Typeset the outline text. +% \begin{macrocode} + \rlap{#2}% +% \end{macrocode} +% PostScript postamble. +% \begin{macrocode} + \special{pS: +% \end{macrocode} +% Finally, do the outline. +% \begin{macrocode} + stroke +% \end{macrocode} +% Restore the original settings. +% \begin{macrocode} + restore + }% + \endgroup +% \end{macrocode} +% Print the main text. +% \begin{macrocode} + \mbox{#2}% +} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{DVIPSONE} +% \changes{2.14}{2004/11/05}{Add support for DVIPSONE}% +% +% \begin{macro}{\@contour@outline} +% Prints the text and contour using real outlines. +% \cs{@contour@outline\marg{color}\marg{text}} +% \begin{macrocode} +%<*dvipsone> +\newcommand*\@contour@outline[2]{% +% \end{macrocode} +% First, print the text. +% This is a hack and avoids problems when \cs{contour} is used in some +% contexts, e.g., at the begin of the text. +% \begin{macrocode} + \rlap{#2}% + \begingroup +% \end{macrocode} +% Double the width of the contour since the inner half is overprinted +% by the normal text; convert |pt| to |bp|. +% \begin{macrocode} + \setlength\con@length{2\con@length}% + \setlength\con@length{0.99626400996\con@length}% +% \end{macrocode} +% Set the contour color and disable color command. +% \begin{macrocode} + \color{#1}% + \con@coloroff +% \end{macrocode} +% PostScript preamble to print an outline for the text. +% \begin{macrocode} + \special{ps: +% \end{macrocode} +% First, save all graphics settings to avoid side effects. +% \begin{macrocode} + gsave +% \end{macrocode} +% Save the current position to be used for the new path. +% \begin{macrocode} + currentpoint +% \end{macrocode} +% Start a new path and go back to the old position. +% \begin{macrocode} + newpath + moveto +% \end{macrocode} +% Choose a round pen. +% \begin{macrocode} + 1 setlinejoin + 1 setlinecap +% \end{macrocode} +% Set the line width and scale it according to the PostScript scale. +% The factor 65693.4 is chosen by trial and error and may be inexact. +% \begin{macrocode} + 65693.4 \strip@pt\con@length\space mul setlinewidth +% \end{macrocode} +% Save |show| to be able to restore it later. +% \begin{macrocode} + /cntorigshow /show load def +% \end{macrocode} +% Redefine the |show| command that prints a text to do the outline +% instead of the text. +% \begin{macrocode} + /show { false charpath } def + }% +% \end{macrocode} +% Typeset the outline text. +% \begin{macrocode} + \rlap{#2}% +% \end{macrocode} +% PostScript postamble. +% \begin{macrocode} + \special{ps: +% \end{macrocode} +% Finally, do the outline and save the position. +% \begin{macrocode} + currentpoint + stroke +% \end{macrocode} +% Restore the original settings and position. +% \begin{macrocode} + /show /cntorigshow load def + grestore + moveto + }% + \endgroup +% \end{macrocode} +% Print the main text. +% \begin{macrocode} + \mbox{#2}% +} +% +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Configuration Files} +% +% This configuration file is just a copy of a part of |graphics.cfg| +% from \TeX Live. +% \begin{macrocode} +%<*cfgfile> + % Select an appropriate default driver +\begingroup + \chardef\x=0 % + % check pdfTeX + \@ifundefined{pdfoutput}{}{% + \ifcase\pdfoutput + \else + \chardef\x=1 % + \fi + }% + % check VTeX + \@ifundefined{OpMode}{}{% + \chardef\x=2 % + }% +\expandafter\endgroup +\ifcase\x + % default case + \ExecuteOptions{dvips}% +\or + % pdfTeX is running in pdf mode + \ExecuteOptions{pdftex}% +\else + % VTeX is running + \ExecuteOptions{vtex}% +\fi +% +% \end{macrocode} +% +% \Finale diff --git a/macros/latex/contrib/contour/contour.ins b/macros/latex/contrib/contour/contour.ins new file mode 100644 index 0000000000..a49103824e --- /dev/null +++ b/macros/latex/contrib/contour/contour.ins @@ -0,0 +1,64 @@ +\input docstrip.tex +\preamble + + contour package + + Copyright 1999--2004 Harald Harders, Morten Høgholm + + 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, moho01ab@student.cbs.dk + + + Original: Richard Pfeiffer (richard.pfeiffer@t-online.de) + Totally rewritten end extended. + +\endpreamble + +\declarepreamble\drvpreamble + + contour package driver file + + Copyright 2004 Harald Harders + + 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 + +\endpreamble + +\declarepreamble\cfgpreamble + + contour package configuration file + + Copyright 2004 Harald Harders + + 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 + +\endpreamble + +\askforoverwritefalse + +\generate{% + \file{contour.sty}{\from{contour.dtx}{package}}% + \usepreamble\drvpreamble + \file{pdftex.cnt}{\from{contour.dtx}{drv,pdftex}}% + \file{dvips.cnt}{\from{contour.dtx}{drv,dvips}}% + \file{vtex.cnt}{\from{contour.dtx}{drv,vtex}}% + \file{dvipsone.cnt}{\from{contour.dtx}{drv,dvipsone}}% + \usepreamble\cfgpreamble + \file{contour.cfg}{\from{contour.dtx}{cfgfile}}% +}% + +\endbatchfile \ No newline at end of file diff --git a/macros/latex/contrib/contour/contour.pdf b/macros/latex/contrib/contour/contour.pdf new file mode 100644 index 0000000000..17355a3d24 Binary files /dev/null and b/macros/latex/contrib/contour/contour.pdf differ diff --git a/macros/latex/contrib/contour/contourtest.tex b/macros/latex/contrib/contour/contourtest.tex new file mode 100644 index 0000000000..db8a453b7a --- /dev/null +++ b/macros/latex/contrib/contour/contourtest.tex @@ -0,0 +1,49 @@ +\listfiles +\documentclass[12pt]{article} +\usepackage[outline]{contour} +\usepackage{times} +\begin{document} +\Huge +\color{yellow} + +\contour{black}{VA} + +VA + +\contour{black}{Default} + +\contour*{black}{Starred} + +\contour[4]{black}{Explicitely 4} + +\normalsize\contour[auto]{black}{normalsize} + +\large\contour[auto]{black}{large} + +\Large\contour[auto]{black}{Large} + +\LARGE\contour[auto]{black}{LARGE} + +\huge\contour[auto]{black}{huge} + +\Huge\contour[auto]{black}{Huge} + +\fontsize{30}{36}\selectfont\contour[auto]{black}{30pt font} + +\fontsize{50}{60}\selectfont\contour[auto]{black}{50pt font} + +\fontsize{50}{60}\selectfont\contour{black}{long long long long + long long} + +\normalsize +This is \contour{black}{contoured} text. + +\LARGE\contour[auto]{black}{Change \textcolor{red}{color} inside contour} + +\LARGE\contour[auto]{black}{Real outline} +\makeatletter +\con@outlinefalse +\makeatother +\contour[auto]{black}{Printing copies} + +\end{document} -- cgit v1.2.3