From 14ee829b923fee3fbf3d06640862706e04d84cd2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Oct 2016 21:15:31 +0000 Subject: scanpages (10oct16) git-svn-id: svn://tug.org/texlive/trunk@42249 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/scanpages/README | 6 +- Master/texmf-dist/doc/latex/scanpages/pic1.pdf | Bin 0 -> 3699 bytes Master/texmf-dist/doc/latex/scanpages/pic2.pdf | Bin 0 -> 4289 bytes .../doc/latex/scanpages/scanpages-doc.pdf | Bin 64666 -> 233176 bytes .../doc/latex/scanpages/scanpages-doc.tex | 97 ++++++++++----------- .../fonts/map/dvips/scanpages/scanpages.map | 1 + .../fonts/tfm/public/scanpages/scanwipe.tfm | Bin 0 -> 148 bytes .../fonts/type1/public/scanpages/scanwipe.pfb | Bin 0 -> 2627 bytes .../texmf-dist/tex/latex/scanpages/scanpages.sty | 47 +++++++--- Master/texmf-dist/tex/latex/scanpages/uscanwipe.fd | 6 ++ Master/tlpkg/libexec/ctan2tds | 1 - Master/tlpkg/tlpsrc/scanpages.tlpsrc | 1 + 12 files changed, 92 insertions(+), 67 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/scanpages/pic1.pdf create mode 100644 Master/texmf-dist/doc/latex/scanpages/pic2.pdf create mode 100644 Master/texmf-dist/fonts/map/dvips/scanpages/scanpages.map create mode 100644 Master/texmf-dist/fonts/tfm/public/scanpages/scanwipe.tfm create mode 100644 Master/texmf-dist/fonts/type1/public/scanpages/scanwipe.pfb create mode 100644 Master/texmf-dist/tex/latex/scanpages/uscanwipe.fd diff --git a/Master/texmf-dist/doc/latex/scanpages/README b/Master/texmf-dist/doc/latex/scanpages/README index 5c4a9bd6cbc..5e9cb19d5e6 100644 --- a/Master/texmf-dist/doc/latex/scanpages/README +++ b/Master/texmf-dist/doc/latex/scanpages/README @@ -16,7 +16,11 @@ LaTeX package scanpages # # This work consists of the files scanpages.sty, replicate.py and replicate.plist. -Version: 1.04, 2016/03/28 +Current version: 1.05, 2016/10/09 + +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. Changes in version 1.04 Added options to include the page number from the original scanned document. (Thanks to Gill Williamson for his very useful input on this feature.) diff --git a/Master/texmf-dist/doc/latex/scanpages/pic1.pdf b/Master/texmf-dist/doc/latex/scanpages/pic1.pdf new file mode 100644 index 00000000000..9e562d3eab2 Binary files /dev/null and b/Master/texmf-dist/doc/latex/scanpages/pic1.pdf differ diff --git a/Master/texmf-dist/doc/latex/scanpages/pic2.pdf b/Master/texmf-dist/doc/latex/scanpages/pic2.pdf new file mode 100644 index 00000000000..5c2cd17066f Binary files /dev/null and b/Master/texmf-dist/doc/latex/scanpages/pic2.pdf differ diff --git a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf index fde28e1e823..9d20074ae33 100644 Binary files a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf and b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex index 7618b31a5bd..af1d28791b5 100644 --- a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex +++ b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex @@ -1,7 +1,9 @@ +% !TEX TS-program = pdflatex \documentclass[11pt]{article} \usepackage[margin=1in]{geometry} \usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent \usepackage{graphicx} +\pdfmapfile{+scanpages.map} %SetFonts % libertine+newtxmath \usepackage[lining]{libertine} @@ -9,13 +11,14 @@ \usepackage{textcomp} \usepackage[scaled=.85]{beramono} \usepackage{amsmath,amsthm} -\usepackage[libertine,bigdelims]{newtxmath} +\usepackage[libertine]{newtxmath} \usepackage{url} \useosf \usepackage[supstfm=libertinesups,% supscaled=1.2,% raised=-.13em]{superiors} %SetFonts +\usepackage{scanpages} \title{The \textsf{Scanpages} Package} \author{Michael Sharpe} \date{\today} % Activate to display a given date or no date @@ -23,9 +26,9 @@ \begin{document} \maketitle \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}. 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.) +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 governed 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 four critical dimensions are: +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: \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; @@ -44,9 +47,9 @@ It is not an error to omit one or more of these values, as default values will b \item {\tt w} defaults to {\tt 400pt}. \item {\tt h} defaults to {\tt 600pt}. \end{itemize} -The package creates then a destination box centered horizontally and vertically in the page and runs \verb|\includegraphics| with appropriate values whenever it sees entries like +The package creates then a destination box centered horizontally and vertically in the page and runs \verb|\includegraphics| with appropriate values set for the {\tt viewport} and {\tt crop} whenever it sees entries like \begin{verbatim} -\scanpage[rot=-1,page=1,dx=20,dy=15]{scan-0} +\scanpage[rot=-1,page=1,dx=20,dy=15]{scan-0} % page= only for pdf files %\index{} %\put(450,250){Is this assertion correct?} \endpicture\endgroup\newpage @@ -54,10 +57,14 @@ The package creates then a destination box centered horizontally and vertically which it interprets as follows: \begin{itemize} \item -{\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 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 +if {\tt scan-0} is a blank string, a blank picture is produced, otherwise, if no corresponding graphic file can be found, {\tt graphicx} will stop with an error message; +\item +{\tt page=} will be understood only by {\tt.pdf} inclusions; +\item +{\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 \begin{verbatim} \put(x,y){...} \end{verbatim} @@ -69,45 +76,21 @@ The page it produces contains, in addition to the scan material and other embell The \verb|\scanpage| macro also accepts three additional options that allow the page number from the original scanned document to be displayed. \begin{itemize} \item -\verb|origpgnum=104| sets the current page number from the orginal scanned document to {\tt 104}, and specifies that this number should appear only when the {\tt grid} is in use---that is, except when the option {\tt nogrid} is in force. Unless modified by an option in a future page, the scanned page number will increment by one and display on all subsequent pages. +\verb|origpgnum=104| sets the current scanned page number to {\tt 104}, and specifies that this number should appear only when the {\tt grid} is in use---that is, except when the option {\tt nogrid} is in force. Unless modified by an option in a future page, the scanned page number will increment by one and display on all subsequent pages. \item \verb|origindest| specifies that the current scanned page number should be visible in the final document. \item \verb|origpgnumoff| prevents the scanned page number from appearing in either the final document or the grid, from this page forward. \item The format governing the display of the current scanned page number is set by the macro \verb|\origpgcmd|, whose default value is \begin{verbatim} -\newcommand{\origpgcmd}{\put(400,-30){p.\ $\the\origpgnum$ in orig.}} +\newcommand{\origpgcmd}{\put(400,-30){\texttt{Orig. page \# \the\origpgnum}}} \end{verbatim} which specifies that entries like \begin{verbatim} -p. 104 in orig. +Orig. page # 104 \end{verbatim} -will appear with baseline {\tt 30bp} (about 3/8 in) below the target box and {\tt 400bp} ( about {\tt5.6in}) from its left edge. You may change this after loading {\tt scanpages} with a similar line like +will appear with baseline {\tt 30bp} (about 3/8 in) below the target box and {\tt 400bp} ( about {\tt5.6in}) from its left edge. You may change this in your preamble, after loading {\tt scanpages}, with a similar line, like \begin{verbatim} -\renewcommand{\origpgcmd}{\put(250,-30){\color{red}% -This was p.\ $\the\origpgnum$ in the original}} -\end{verbatim} -It is important to note that this will have no effect if it is placed within a block of the form -\begin{verbatim} -\scanpage[...]{} - -\endpicture\endgroup -\end{verbatim} -\item \textsc{Example:} -\begin{verbatim} -\scanpage[page=1]{scanneddoc.pdf}% no orig page number -\endpicture\endgroup\newpage -% -\scanpage[page=2,origpgnum=87,origpgdest]{scanneddoc.pdf} -% the final doc will show the orig page no 87 -\endpicture\endgroup\newpage -% -\scanpage[page=3]{scanneddoc.pdf} -% the final doc will show the orig page no 88 -\endpicture\endgroup\newpage -% -\scanpage[page=4,origpgnumoff]{scanneddoc.pdf} -% the orig page no (89) will not display, but its counter increments -\endpicture\endgroup\newpage +\renewcommand{\origpgcmd}{...} \end{verbatim} @@ -117,11 +100,11 @@ It is important to note that this will have no effect if it is placed within a b \subsection{Resetting the initial choices} The options you chose when loading the package may be changed in the middle of a document. Just insert \begin{verbatim} -\initviewport{,,,,} +\initviewport{}{}{}{}{} \end{verbatim} -to change your initial choice of options. Eg, +to change your initial choice of options. E.g., \begin{verbatim} -\initviewport{.95,3cm,4cm,8cm,12cm} +\initviewport{.95}{3cm}{4cm}{8cm}{12cm} \end{verbatim} will in effect make {\tt scale=.95}, {\tt llx=3cm}, {\tt lly=4cm}, {\tt w=8cm} and {\tt h=12cm}. \section{Making a source entry for each page} @@ -176,20 +159,16 @@ Scanning software often places each scanned page in a separate file with names l \end{verbatim} \end{itemize} \section{Whiting out scan artifacts} -Use a white rectangular box to overwrite scan artifacts. The simplest method may be to use \verb|\rule|, like this: +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}.) \begin{verbatim} -\put(150,200){% lower left corner at (150,200) -{\color{white}\rule{10pt}{5pt}}% solid white rect 10pt wide, 5pt high -} +\whitesq(150,200){5} % height and width scaled by 5 +\whitesq(150,200){5}[2] % height scaled by 5, width by 2 \end{verbatim} -For more precise whiteouts which allow you to overwrite existing material, use something like \begin{verbatim} -\setlength{\fboxsep}{1bp} % This line sets the width of border of opaque white -% around the text in the \colorbox -\put(.,.){\colorbox{white}{$y=$}} % places $y=$ with an opaque white background -% 1bp larger than the minimal bounding box for $y=$. +\whitecirc(150,200){5} % height and width scaled by 5 +\whitecirc(150,200){5}[2] % height scaled by 5, width by 2 \end{verbatim} - +the only difference being in the the shape of the of the region whited out. \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} @@ -200,4 +179,20 @@ The two scripts give the same output provided you use variable names that are id line. (In the examples above, this was always {\tt NNN}.) The \textsf{python} script is case sensitive, but the AppleScript is not---it will act on any variant like {\tt nnn0} or {\tt NnN1} as well. \subsection{Installation in TeXShop's Macros Menu} Select \TeX Shop's Macros Menu and choose the top item---\textsf{Open Macro Editor ... }. Then, from the same menu, choose the second item---\textsf{Add macros from file ...}---and navigate to {\tt replicate.plist} in this distribution. When you choose that file, the AppleScript will be installed under the name \textsf{Replicate} in the Macros Menu. +\section{Example} +The last page of this document shows the result of using {\tt scanpage} with a blank filename, which does nothing but create a blank picture with a grid, then overwrite a part of the page with a portion of another. The illustration will not show the ({\tt nogrid}) final result. +\begin{verbatim} +\newpage +\initviewport{1}{1in}{1in}{8cm}{12cm} +\scanpage{} +%viewport=xl yl xr yr +\put(100,200){\includegraphics[viewport=165 530 300 700,clip]{pic1}} +\endpicture\endgroup\newpage +\end{verbatim} +\newpage +\initviewport{1}{1in}{1in}{8cm}{12cm} +\scanpage{} +%viewport=xl yl xr yr +\put(100,200){\includegraphics[viewport=165 530 300 700,clip]{pic1}} +\endpicture\endgroup\newpage \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/fonts/map/dvips/scanpages/scanpages.map b/Master/texmf-dist/fonts/map/dvips/scanpages/scanpages.map new file mode 100644 index 00000000000..b5503df694d --- /dev/null +++ b/Master/texmf-dist/fonts/map/dvips/scanpages/scanpages.map @@ -0,0 +1 @@ +scanwipe scanwipe scanwipe.tfm}{} +\endinput diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index d2bf0d59df1..736ca681d3f 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -981,7 +981,6 @@ chomp ($Build = `cd $Master/../Build/source && pwd`); 'sagetex', "die 'skipping, omitted at author request (25 Jan 2010 19:50:16)'", 'sansmathaccent', "&MAKEflatten", 'sansmathfonts', "&MAKEflatten", - 'scanpages', "&MAKEflatten", 'schedule', "die 'skipping, noinfo license, too old to matter'", 'schulschriften', "&MAKEflatten", 'scientifixpaper', "die 'skipping, noinfo license'", diff --git a/Master/tlpkg/tlpsrc/scanpages.tlpsrc b/Master/tlpkg/tlpsrc/scanpages.tlpsrc index e69de29bb2d..fc4bf8b70ed 100644 --- a/Master/tlpkg/tlpsrc/scanpages.tlpsrc +++ b/Master/tlpkg/tlpsrc/scanpages.tlpsrc @@ -0,0 +1 @@ +execute addMap scanpages.map -- cgit v1.2.3