summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hilowres
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/hilowres
Initial commit
Diffstat (limited to 'macros/latex/contrib/hilowres')
-rw-r--r--macros/latex/contrib/hilowres/hilowres.dtx202
-rw-r--r--macros/latex/contrib/hilowres/hilowres.ins47
-rw-r--r--macros/latex/contrib/hilowres/readme.txt12
3 files changed, 261 insertions, 0 deletions
diff --git a/macros/latex/contrib/hilowres/hilowres.dtx b/macros/latex/contrib/hilowres/hilowres.dtx
new file mode 100644
index 0000000000..d86bb7169c
--- /dev/null
+++ b/macros/latex/contrib/hilowres/hilowres.dtx
@@ -0,0 +1,202 @@
+% \iffalse
+%
+% hilowres.dtx Version 1.0, 1999/01/07
+% (c) 1999 by Johann Gerell <jogerell@acc.umu.se>
+%
+% Please see the information in file `hilowres.ins' on how you
+% may use and (re-)distribute this file. Run LaTeX on the file
+% `hilowres.ins' to get a .sty-file and instructions.
+%
+% This file may NOT be distributed if not accompanied by `hilowres.ins'.
+%
+%<*driver>
+\documentclass[a4paper]{ltxdoc}
+\widowpenalty 10000
+\newcommand{\hilo}{\textsf{hilowres}}
+\begin{document}
+ \DocInput{hilowres.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{The \hilo\ package}
+% \author{Johann Gerell\\ jogerell@acc.umu.se}
+% \date{1999/01/07}
+% \maketitle
+% \begin{abstract}
+% This \LaTeX2e\ package defines a new command \cs{hilofig}, which
+% simplifies a global inclusion of low resolution versions of pictures
+% that also exist in high resolution. Perhaps this package is overkill,
+% but it's at least short and it was easy to implement. As a side effect
+% I finally had to take a look at the \textsf{doc}/\textsf{docstrip}
+% world\dots
+% \end{abstract}
+% ^^A\tableofcontents
+%
+% \section{Introduction}
+%
+% Let's say that we have a number of pairs of pictures where one in each
+% pair is a low resolution version of the second. For various reasons it
+% might be desired to globally include all the low resolution versions
+% instead of the high resolution ones. And all of a sudden, when we've
+% specified the filenames of about 50 low-res pictures, we feel like
+% switching to the high-res pictures. This task can be unnecessarily
+% tedious with e.g.``search-and-replace''.
+%
+% With this package this operation becomes easy as nothing, provided that
+% the filenames of the pairs of pictures all follow the scheme
+% |basehighext.eps| and |baselowext.eps|, where |highext| in |basehighext|
+% defaults to nothing (a zero length string) and |lowext| in |baselowext|
+% defaults to |_low|. Using the defaults, one pair of pictures can be e.g.
+% |bird.eps| and |bird_low.eps|.
+%
+% \section{Usage}
+%
+% First we load the package with
+% \cs{usepackage}\oarg{resolution}\marg{filename}, where the optional
+% argument \textit{resolution} is |low| if we want to use the low
+% resolution pictures\footnote{The pairs of files can of course contain
+% completely different pictures\dots}. To use the high resolution version,
+% no optional argument should be specified.
+%
+% \subsection{Load the package}
+%
+% So, let's use the low resolution pictures:
+%\begin{verbatim}
+% \usepackage[low]{hilowres}
+%\end{verbatim}
+% The \hilo\ package simply wraps the \cs{includegraphics}
+% command of the \textsf{graphicx} package, which is loaded by the \hilo\
+% package if necessary.
+%
+% \subsection{Include a picture}
+%
+% \DescribeMacro{\hilofig}
+% The main command of this package is
+% \cs{hilofig}\oarg{key val list}\marg{file}, where \textit{key val list}
+% is the same as for \cs{includegraphics} (e.g. |width=...|, |height=...|,
+% |scale=...|, etc), and \textit{file} is the basename of the pairs of
+% files. If we write:
+%\begin{verbatim}
+% \hilofig[width=.8\textwidth]{bird}
+%\end{verbatim}
+% and have specified |low| as the optional argument to the package, then
+% the file that will be included at a width equal to 80\% of the
+% value of \cs{textwidth} is |bird_low.eps|.
+%
+% When and if we later wish to switch to the hi-res pictures, we simply
+% remove the |[low]| from |\usepackage[low]{hilowres}| in the preamble.
+% The file that will be included in our example is then |bird.eps|.
+%
+% \subsection{Configuration}
+%
+% \DescribeMacro{\highext} \DescribeMacro{\lowext}
+% If our files have different |highext|- and |lowext|-extensions than the
+% default ones, i.e. an empty string and |_low| respectively, then we can
+% change the default strings in the preamble with the commands
+% \cs{highext}\marg{extension} and \cs{lowext}\marg{extension}. If we for
+% instance have filenames such as |birdcolor.eps| and |birdgrey.eps|, in
+% the preamble we can then change the defaults with:
+%\begin{verbatim}
+% \highext{color}
+% \lowext{grey}
+%\end{verbatim}
+%
+% If \LaTeX\ can't find a file in the current directory, then we probably
+% need to put |\DeclareGraphicsExtensions{eps}|\footnote{From the
+% \textsf{graphicx} package} in the preamble. Naturally, not only
+% \textit{eps} is permitted, but other file formats that we normally use
+% with \cs{includegraphics} are also ok here. If the pictures live in
+% different directories, then in the preamble we must put
+% \cs{graphicspath}\marg{dir-list}\footnotemark[\value{footnote}].
+%
+% \section{Sources}
+%
+% The source code doesn't contain any fancy stuff at all. It's very short
+% and quite trivial\dots
+%
+% Begin with package identification and loading of the \textsf{graphicx}
+% package.
+%
+% \iffalse
+%<*package>
+% \fi
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{hilowres}
+ [1999/01/07 v1.0 Include optional low resolution images]
+\RequirePackage{graphicx}
+% \end{macrocode}
+% Define a ``high resolution flag'', which defaults to \textit{true} but
+% is set to \textit{false} if the package option |low| is specified.
+%
+% \begin{macrocode}
+\newif\if@high\@hightrue
+\DeclareOption{low}{\@highfalse}
+\ProcessOptions
+% \end{macrocode}
+% Output a message during compile for user information.
+%
+% \begin{macrocode}
+\if@high\typeout{^^J NOTE: Resolution is HIGH ^^J}
+\else\typeout{^^J NOTE: Resolution is LOW ^^J}
+\fi
+% \end{macrocode}
+% The package source file uses internal commands for the |highext|-
+% and |lowext|-extensions, and they defaults to a zero length string and
+% to |_low| respectively.
+%
+% \begin{macrocode}
+\newcommand{\@highext}{}
+\newcommand{\@lowext}{_low}
+% \end{macrocode}
+%
+% \begin{macro}{\hilofig}
+% The primary user command is \cs{hilofig}\oarg{key val list}\marg{file}.
+%
+% \begin{macrocode}
+\newcommand{\hilofig}[2][]{%
+\includegraphics[#1]{#2\if@high\@highext\else\@lowext\fi}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\highext}
+% \begin{macro}{\lowext}
+% The user can change the default |highext|- and |lowext|-extensions with
+% the commands \cs{highext}\marg{extension} and
+% \cs{lowext}\marg{extension} respectively.
+%
+% \begin{macrocode}
+\newcommand{\highext}[1]{\renewcommand{\@highext}{#1}}
+\newcommand{\lowext} [1]{\renewcommand{\@lowext} {#1}}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% And thats's all, folks\dots
+%
+% \begin{macrocode}
+\endinput
+% \end{macrocode}
+% \iffalse
+%</package>
+% \fi
+%
+% \section{License}
+%
+% You may use the \hilo\ package freely, but at your own risk. The
+% author of |hilowres.dtx| and |hilowres.ins| (the complete \hilo\ package
+% distribution) can not be held responsible for any consequence of your
+% using any of these files, or files created from these, including
+% hardware, software, and data damage. You may not make any changes to
+% the files |hilowres.dtx| or |hilowres.ins|. You may incorporate the code
+% from these files in other files under different names, provided the
+% original author is given full credit for his work and that you yourself
+% take the complaints from the user(s) of your file(s). You may freely
+% distribute the files |hilowres.dtx| and |hilowres.ins|, provided: 1. You
+% do not take money for the distribution or use of these files except for
+% a nominal charge for diskettes and postage; and 2. You always distribute
+% |hilowres.dtx| and |hilowres.ins| together at the same time.
+%
+% \Finale
diff --git a/macros/latex/contrib/hilowres/hilowres.ins b/macros/latex/contrib/hilowres/hilowres.ins
new file mode 100644
index 0000000000..71abfd29ff
--- /dev/null
+++ b/macros/latex/contrib/hilowres/hilowres.ins
@@ -0,0 +1,47 @@
+%------------------------------------------------------------------
+% This is file `hilowres.ins', the installation file for the
+% `hilowres' package. Last revised 1999/01/07.
+%------------------------------------------------------------------
+% Copyright (c) 1999 by Johann Gerell <jogerell@acc.umu.se>,
+% http://www.acc.umu.se/~jogerell. All rights reserved.
+%------------------------------------------------------------------
+% You may use the `hilowres' package freely, but at your own risk.
+% The author of `hilowres.dtx' and `hilowres.ins' (the complete
+% `hilowres' package distribution) can not be held responsible for
+% any consequence of your using any of these files, or files
+% created from these, including hardware, software, and data
+% damage. You may not make any changes to the files
+% `hilowres.dtx' or `hilowres.ins'. You may incorporate the code
+% from these files in other files under different names, provided
+% the original author is given full credit for his work and that
+% you yourself take the complaints from the user(s) of your
+% file(s). You may freely distribute the files `hilowres.dtx' and
+% `hilowres.ins', provided: 1. You do not take money for the
+% distribution or use of these files except for a nominal charge
+% for diskettes and postage; and 2. You always distribute
+% `hilowres.dtx' and `hilowres.ins' together at the same time.
+%
+\NeedsTeXFormat{LaTeX2e}[1996/12/01]
+\def\batchfile{hilowres.ins}
+\input docstrip.tex
+\keepsilent
+\preamble
+
+Copyright (c) 1999 by Johann Gerell <jogerell@acc.umu.se>.
+All rights reserved. See the file `hilowres.ins' for information
+on how you may (re-)distribute the `hilowres' package files.
+You are not allowed to make any changes to this file without
+explicit permission from the author.
+
+\endpreamble
+\generate{\file{hilowres.sty}{\from{hilowres.dtx}{package}}}
+
+\Msg{************************************************************}
+\Msg{ }
+\Msg{ To finish the installation you have to move the file}
+\Msg{ `hilowres.sty' into a directory where LaTeX can find it.}
+\Msg{ }
+\Msg{ To typeset the documentation, run the file `hilowres.dtx'}
+\Msg{ through LaTeX, i.e. `latex hilowres.dtx'.}
+\Msg{ }
+\Msg{***********************************************************}
diff --git a/macros/latex/contrib/hilowres/readme.txt b/macros/latex/contrib/hilowres/readme.txt
new file mode 100644
index 0000000000..263bb636fc
--- /dev/null
+++ b/macros/latex/contrib/hilowres/readme.txt
@@ -0,0 +1,12 @@
+hilowres is a package that can be used to simplify a global inclusion of
+low resolution versions of high resolution images, if each pair of files
+have the same basename (e.g. bird_low.eps and bird.eps). The package is
+a totally uncomplicated wrapper around the \includegraphics command of the
+graphicx package.
+
+Example usage: \hilowfig[width=3in]{bird}. If the option `low' is
+specified when loading the package, then the low resolution version
+(i.e. bird_low.eps) is used, otherwise the high resolution version (i.e.
+bird.eps) is used.
+
+Author: Johann Gerell <jogerell@acc.umu.se>