texlive[42633] Master/texmf-dist/doc/latex/scanpages: scanpages
commits+karl at tug.org
commits+karl at tug.org
Sat Dec 3 23:27:23 CET 2016
Revision: 42633
http://tug.org/svn/texlive?view=revision&revision=42633
Author: karl
Date: 2016-12-03 23:27:22 +0100 (Sat, 03 Dec 2016)
Log Message:
-----------
scanpages (3dec16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/scanpages/README
trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf
trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex
Modified: trunk/Master/texmf-dist/doc/latex/scanpages/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scanpages/README 2016-12-03 22:27:09 UTC (rev 42632)
+++ trunk/Master/texmf-dist/doc/latex/scanpages/README 2016-12-03 22:27:22 UTC (rev 42633)
@@ -16,8 +16,11 @@
#
# This work consists of the files scanpages.sty, replicate.py and replicate.plist.
-Current version: 1.05, 2016/10/09
+Current version: 1.05a, 2016/12/02
+Changes in version 1.05a
+Corrections/additions to documentation.
+
Changes in version 1.05
1. Corrected some misbehaviors in scanpages.sty and some misinformaion in scanpages-doc.
2. Made a small font with just a square and circular shape to act as eraser-heads---used in new macros \whitesq, \whitecirc.
Modified: trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex 2016-12-03 22:27:09 UTC (rev 42632)
+++ trunk/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex 2016-12-03 22:27:22 UTC (rev 42633)
@@ -3,20 +3,17 @@
\usepackage[margin=1in]{geometry}
\usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
-\pdfmapfile{+scanpages.map}
+%\pdfmapfile{+scanpages.map}
%SetFonts
% libertine+newtxmath
-\usepackage[lining]{libertine}
+\usepackage[osf,sups]{baskervillef}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[scaled=.85]{beramono}
+\usepackage[scaled=.95]{cabin}
\usepackage{amsmath,amsthm}
-\usepackage[libertine]{newtxmath}
+\usepackage[baskerville]{newtxmath}
\usepackage{url}
-\useosf
-\usepackage[supstfm=libertinesups,%
- supscaled=1.2,%
- raised=-.13em]{superiors}
%SetFonts
\usepackage{scanpages}
\title{The \textsf{Scanpages} Package}
@@ -28,7 +25,7 @@
\section{Briefly}
This package is intended for production of documents based on scanned material in any format acceptable to \textsf{pdflatex} as a graphic inclusion---eg, {\tt pdf}, {\tt png}, {\tt jpg}, though {\tt pdf} works best with this package. For me, the format has been useful when trying to archive pre-\TeX\ documents without converting them to \LaTeX\ source documents but inputting the scanned pages one by one and adding indexing, hyperlinks, a table of contents (You'll have to do this using \verb|\addcontentsline{toc}...|, and if using \textsf{hyperref}, you may need to add \verb|\phantomsection| immediately before \verb|\addcontentsline|), footnotes, marginal notes and the like. What makes scanned documents bothersome is the irregularities introduced by the scanning process. Pages are sometimes skewed and often offset horizontally and/or vertically from one another, and extraneous marks will likely appear, so each page may need adjustments. The methods of this package are of two types. First, the package {\tt scanpages.sty} contains macros to make it more convenient to perform those adjustments and add adornments. Second, some kind of script is very useful for making the relevant part of the {\tt tex} source, if you are handling more than a few pages of scanned material. For this, there are two almost equivalent scripts included to automate this process as much as possible, one written in \textsf{python}, the other in \textsf{AppleScript.} (The letter may be installed in \TeX Shop's macro menu for completely self-contained usage.)
\section{The \LaTeX\ package}
-Starting with a scanned document, you need to measure four dimensions to specify by the region you wish to import, and decide on a magnification factor to apply. The region to import from the scan should ideally be a bit larger (10{\tt pt} is a good starting value) than the area typically containing all the data, and perhaps excluding original page numbers. (The part of the scanned page lying outside the region is cropped.) The four critical dimensions are:
+Starting with a scanned document, you need to measure four dimensions to specify the region you wish to import, and decide on a magnification factor to apply. The region to import from the scan should ideally be a bit larger (10{\tt pt} is a good starting value) than the area typically containing all the data, and perhaps excluding original page numbers. (The part of the scanned page lying outside the region is cropped.) The four critical dimensions are:
\begin{itemize}
\item
The $x$ and $y$ coordinates {\tt llx, lly} of the lower left corner of the image region (the part you want to import) relative to the lower left corner of the scanned page;
@@ -64,11 +61,11 @@
{\tt rot} is an angle of rotation (degrees) in the mathematically positive sense (counter-clockwise) about the center. You may find it easier to enter {\tt tanrot=0.175}, the tangent of the rotation angle, as this is more easily estimated from the picture;
{\tt page=1} selects the first page of the file {\tt scan-0.pdf}. This option may be omitted if the file contains only one page;
\item {\tt dx} nudges the resulting picture to the right by {\tt 20bp}, and similarly for {\tt dy}. (Actually, {\tt dx} nudges the {\tt viewport} to the left by {\tt 20bp/scale}.) If no unit is provided, {\tt bp} is assumed;
-\item any material following the \verb|\scanpage| line and before \verb|\endpicture| can be used for index entries, table of contents entries, footnotes, additional graphic inclusions, annotations and the like. As the action is all taking place within a \LaTeX\ {\tt picture} environment, each visible item must be placed in an instruction of the form
+\item any material following the \verb|\scanpage| line and before \verb|\endpicture| can be used for index entries, table of contents entries, footnotes, additional graphic inclusions, annotations and the like. As the action is all taking place within a \LaTeX\ {\tt picture} environment with {\tt unitlength} set to {\tt1bp}, each visible item must be placed in an instruction of the form
\begin{verbatim}
\put(x,y){...}
\end{verbatim}
-where {\tt x} and {\tt y} are the purely numeric coordinates with implied unit {\tt 1bp}, which matches that required for dimensions in \verb|\includegraphics|.
+where {\tt x} and {\tt y} are purely numeric coordinates with implied unit {\tt 1bp}, which matches that required for dimensions in \verb|\includegraphics|.
\end{itemize}
The page it produces contains, in addition to the scan material and other embellishments, a superimposed grid with unit {\tt 1bp} and a black box marking the edge of outline of the destination box. After all adjustments are complete, the grid may be suppressed by adding the option {\tt nogrid} to the package option list.
@@ -118,7 +115,7 @@
%\endpicture\endgroup\newpage
\end{verbatim}
The \verb|%Repetitions=|
- line describes the maximum value of a counter starting at {\tt 1} that controls the iteration. The line \verb|%Variables=|
+ line describes the maximum value of a counter starting at {\tt 1} that controls the iteration. The \verb|%Variables=|
line is less obvious.
The fragment \verb|{NNN,0:1+1,1:2+-2,2:[-200+300],3:1+1(3)}| means that variables are named {\tt NNN0, NNN1, NNN2, NNN3}. Variable {\tt NNN0} is initially {\tt1}, increments by {\tt1} and so takes successive values {\tt 1,2,...,100}. Variable {\tt NNN1} is initially {\tt2} and increments by {\tt -2}, while variable {\tt NNN2} alternates between {\tt -200} for odd counter values and {\tt300} for even counter values. Variable {\tt NNN3} takes the same value as {\tt NNN0} but prints in a field of length {\tt 3}, padding as necessary on the left with {\tt0}'s so it substitutes successively {\tt 001,002,...,099,100}. (Note that commas, colons and plus signs are simply separators and have no arithmetic significance.) Running the script on this file will append 100 copies, the first two lines omitted, and with one \% stripped and variables replaced by their successive values. The first two resulting items appearing as
\begin{verbatim}
@@ -159,16 +156,16 @@
\end{verbatim}
\end{itemize}
\section{Whiting out scan artifacts}
-Use a white rectangular box to overwrite scan artifacts. The package provides some macros to assist. Both are based on glyphs in a special font included as part of the {\tt scanpages} package, one a square shape and one a circular shape, each 500 units wide and tall, with zero depth and zero side-bearings. (At {\tt 10pt} typesetting, 500 units amounts to {\tt 5pt}.)
+Use a white shape to overwrite scan artifacts. The package provides some macros to assist. Both are based on glyphs in a special font included as part of the {\tt scanpages} package, one a square shape and one a circular shape, each 500 units wide and tall, with zero depth and zero side-bearings. (A thousand units is equal to {\tt 1em}, so at with {\tt 10pt} typesetting, 500 units amounts to {\tt 5pt}.)
\begin{verbatim}
-\whitesq(150,200){5} % height and width scaled by 5
-\whitesq(150,200){5}[2] % height scaled by 5, width by 2
+\whitesq(150,200){5} % width and height scaled by 5
+\whitesq(150,200){5}[2] % width scaled by 5, height by 2
\end{verbatim}
\begin{verbatim}
-\whitecirc(150,200){5} % height and width scaled by 5
-\whitecirc(150,200){5}[2] % height scaled by 5, width by 2
+\whitecirc(150,200){5} % width and height scaled by 5
+\whitecirc(150,200){5}[2] % width scaled by 5, height by 2
\end{verbatim}
-the only difference being in the the shape of the of the region whited out.
+the only difference being in the the shape of the of the region whited out. These macros make use of \verb|\scalebox| from the {\tt graphicx} package, and follow the same syntax for scale width and height.
\section{Differences between the scripts}
The AppleScript is meant to work within TeXShop after installation in the TeXShop Macros Menu---see instructions below. It works on the selected part of the file, and its output is placed in the same file, which can be part of a larger document. The \textsf{python} script is meant to run from the command line on a file containing just the pattern text, and produces output in the same file, which can then be copied than into your working {\tt.tex} document. Eg, if you copied the script into a directory on your {\tt PATH} and made it executable
\begin{verbatim}
@@ -189,6 +186,7 @@
\put(100,200){\includegraphics[viewport=165 530 300 700,clip]{pic1}}
\endpicture\endgroup\newpage
\end{verbatim}
+(A useful variant of this technique was suggested by my colleague Gill Williamson. Suppose your starting point is a hand-sketched graph or some other mathematical illustration. Scan the sketch and create a one-page document as described above on which you will make embellishments such as labels, then save this with no grid and import that document into your final larger document. This protects you from having to make many individual changes if you change the size of your picture so that the \verb|\put()| coordinates all have to be changed.)
\newpage
\initviewport{1}{1in}{1in}{8cm}{12cm}
\scanpage{}
More information about the tex-live-commits
mailing list