From 61c652c6ab0d56352e59455266ca1d649ba244d6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 29 Mar 2016 21:24:48 +0000 Subject: scanpages (29mar16) git-svn-id: svn://tug.org/texlive/trunk@40177 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/scanpages/README | 7 ++- .../texmf-dist/doc/latex/scanpages/replicate.plist | 9 ++- .../doc/latex/scanpages/scanpages-doc.pdf | Bin 52395 -> 64666 bytes .../doc/latex/scanpages/scanpages-doc.tex | 61 ++++++++++++++++++++- 4 files changed, 70 insertions(+), 7 deletions(-) (limited to 'Master/texmf-dist/doc/latex/scanpages') diff --git a/Master/texmf-dist/doc/latex/scanpages/README b/Master/texmf-dist/doc/latex/scanpages/README index 8103279002a..5c4a9bd6cbc 100644 --- a/Master/texmf-dist/doc/latex/scanpages/README +++ b/Master/texmf-dist/doc/latex/scanpages/README @@ -1,6 +1,6 @@ LaTeX package scanpages #====================== -# Copyright 2014 Michael Sharpe, msharpe at ucsd dot edu. +# Copyright 2014--2016 Michael Sharpe, msharpe at ucsd dot edu. # # This work may be distributed and/or modified under the # conditions of the LaTeX Project Public License, either version 1.3 @@ -16,7 +16,10 @@ LaTeX package scanpages # # This work consists of the files scanpages.sty, replicate.py and replicate.plist. -Version: 1.03, 2014/05/01 +Version: 1.04, 2016/03/28 + +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.) Changes in version 1.03 Corrected a number of issues in scanpages.sty and its documentation so that the package now works as documented. diff --git a/Master/texmf-dist/doc/latex/scanpages/replicate.plist b/Master/texmf-dist/doc/latex/scanpages/replicate.plist index 04beb49b623..fa40293b5a1 100644 --- a/Master/texmf-dist/doc/latex/scanpages/replicate.plist +++ b/Master/texmf-dist/doc/latex/scanpages/replicate.plist @@ -20,9 +20,14 @@ property trimitems : {" ", tab, linefeed, return} set lf to linefeed set cr to return set crlf to cr & lf - set oldtid to text item delimiters tell application "TeXShop" to set s to content of selection of document 1 set tmp to (paragraphs of s) + +set oldtid to text item delimiters +tell application "TeXShop" to set s to content of selection of document 1 +set tmp to (paragraphs of s) set text item delimiters to {lf} -set s to (tmp as text) set text item delimiters to "%Repetitions=" set tmp to (text items of s) +set s to (tmp as text) +set text item delimiters to "%Repetitions=" +set tmp to (text items of s) set text item delimiters to oldtid if not ((count of tmp) = 2) then display dialog "Bailing! The selection does not contain exactly one '%Repetitions='" diff --git a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf index ec111b10e0e..fde28e1e823 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 709b7f7be22..7618b31a5bd 100644 --- a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex +++ b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex @@ -2,7 +2,6 @@ \usepackage[margin=1in]{geometry} \usepackage[parfill]{parskip}% Begin paragraphs with an empty line rather than an indent \usepackage{graphicx} -\usepackage{amssymb}% do not use with mtpro2 except lite version %SetFonts % libertine+newtxmath \usepackage[lining]{libertine} @@ -55,8 +54,8 @@ 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, 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 is the file contains only one page. +{\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 \begin{verbatim} @@ -66,6 +65,55 @@ where {\tt x} and {\tt y} are the purely numeric coordinates with implied unit { \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. +\subsection{Options to include the original page numbers} +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. +\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.}} +\end{verbatim} +which specifies that entries like +\begin{verbatim} +p. 104 in orig. +\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 +\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 +\end{verbatim} + + +\end{itemize} + + \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} @@ -134,6 +182,13 @@ Use a white rectangular box to overwrite scan artifacts. The simplest method may {\color{white}\rule{10pt}{5pt}}% solid white rect 10pt wide, 5pt high } \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=$. +\end{verbatim} \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 -- cgit v1.2.3