diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-29 21:24:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-29 21:24:48 +0000 |
commit | 61c652c6ab0d56352e59455266ca1d649ba244d6 (patch) | |
tree | d0af0720070116c664d5848da7c4ec5c5c79909a | |
parent | 86d055cf3a39706e11cf2f143633f70879052726 (diff) |
scanpages (29mar16)
git-svn-id: svn://tug.org/texlive/trunk@40177 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/scanpages/README | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/scanpages/replicate.plist | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf | bin | 52395 -> 64666 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/scanpages/scanpages-doc.tex | 61 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/scanpages/scanpages.sty | 28 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 |
6 files changed, 92 insertions, 14 deletions
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 Binary files differindex ec111b10e0e..fde28e1e823 100644 --- a/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf +++ b/Master/texmf-dist/doc/latex/scanpages/scanpages-doc.pdf 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 diff --git a/Master/texmf-dist/tex/latex/scanpages/scanpages.sty b/Master/texmf-dist/tex/latex/scanpages/scanpages.sty index 5d24e8625e0..c049983fd4c 100644 --- a/Master/texmf-dist/tex/latex/scanpages/scanpages.sty +++ b/Master/texmf-dist/tex/latex/scanpages/scanpages.sty @@ -5,8 +5,8 @@ % Copyright (c) 2014 by Michael Sharpe, msharpe at ucsd dot edu; % This is free software, subject to the LATEX Project Public License. -\def\fileversion{1.03} -\def\filedate{2014/05/01} +\def\fileversion{1.04} +\def\filedate{2016/03/28} \ProvidesPackage{scanpages.sty}[\filedate\space v\fileversion] \message{`scanpages' v\fileversion, \filedate\space Macros to help create documents from scanned pages (msharpe)} @@ -19,7 +19,7 @@ \RequirePackage{graphicx} \RequirePackage{etoolbox} \ifpdf\else - \@latex@error{Must be processed in pdf[la]tex!}\@eha + \@latex@error{Must be processed with pdf[la]tex!}\@eha \fi \newif\ifscanp@nogrid \define@boolkey{scanp}{nogrid}[true]{% @@ -43,6 +43,13 @@ \x} \ProcessOptions* +%new +\newcommand{\origpgcmd}{\put(\scanp@srcw,-30){p.\ \the\origpgnum\ in orig.}} +\newcount\origpgnum %page in original +\newif\ifscanp@origindest +\newif\ifscanp@origingrid +\newif\ifscanp@change +% end new \newcount\scanp@pgcnt \setlength\unitlength{1bp} \long\def\putn(#1,#2)#3{% @@ -89,6 +96,9 @@ } \initviewport{\scanp@srcscale}{\scanp@llx}{\scanp@lly}{\scanp@srcw}{\scanp@srcw} % +\define@key{scanpi}{origpgnum}{\global\origpgnum=#1 \global\scanp@origingridtrue} +\define@boolkey{scanpi}{origindest}[true]{\csname scanp@change#1\endcsname} +\define@boolkey{scanpi}{origpgnumoff}[true]{\global\scanp@origindestfalse\global\scanp@origingridfalse} \define@key{scanpi}{dx}{\def\scanp@dx{#1}} \define@key{scanpi}{dy}{\def\scanp@dy{#1}} \define@key{scanpi}{page}{\def\scanp@page{#1}} @@ -97,7 +107,10 @@ \newdimen\scanp@dxdim\newdimen\scanp@dydim \def\scanpage{\@ifnextchar[\scanpage@i{\scanpage@i[]}} -\def\scanpage@i[#1]#2{\advance\scanp@pgcnt\@ne\begingroup\setkeys{scanpi}{#1}% +\def\scanpage@i[#1]#2{\advance\scanp@pgcnt\@ne\begingroup\setkeys{scanpi}{#1}% +\ifscanp@change\global\scanp@origindesttrue % + \global\scanp@origingridfalse % + \global\scanp@changefalse \fi% \edef\scanp@head{\noexpand\vspace*{\scanp@yindent}\noexpand\noindent\noexpand\hspace*{\scanp@xindent}\noexpand\picture(\strip@pt\scanp@dwdimbp,\strip@pt\scanp@dhdimbp)} %\edef\@x{\strip@pt\scanp@dwdimbp}\edef\@y{\strip@pt\scanp@dhdimbp} %\vspace*{\the\scanp@yindent}\noindent\hspace*{\scanp@xindent}\picture(\@x,\@y) @@ -115,8 +128,9 @@ \ifdefvoid{\scanp@page}{}{\edef\scanp@cmd{page=\scanp@page,\scanp@cmd}} \edef\scanp@cmd{\noexpand\scanp@head\noexpand\put(0,0){\noexpand\includegraphics[\scanp@cmd}} \scanp@cmd % \begingroup, start \picture, \put pdf at (0,0) -\thegrid{\strip@pt\scanp@dwdimbp}{\strip@pt\scanp@dhdimbp} -} +\ifscanp@origindest\origpgcmd\fi +\thegrid{\strip@pt\scanp@dwdimbp}{\strip@pt\scanp@dhdimbp}% +\global\advance\origpgnum\@ne} \ifscanp@nogrid\def\thegrid#1#2{}\else% \long\def\thegrid#1#2{\edef\scanp@gcmd{\noexpand\put(0,0){\noexpand\line(1,0){#1}} @@ -138,7 +152,7 @@ \put(\x,-15){\x}} \put(0,-30){\color{blue}Page \the\scanp@pgcnt}% \scanp@gcmd% -} +\ifscanp@origingrid\origpgcmd\fi} \fi % end \ifscanp@nogrid \endinput
\ No newline at end of file diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 2cbbdb484d4..813da456324 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -956,6 +956,7 @@ 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'", |