From 43f0cab68a9ea1b2cc9385df46487eb6f4cba012 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 23 Mar 2014 22:12:25 +0000 Subject: prerex (23mar14) git-svn-id: svn://tug.org/texlive/trunk@33264 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/prerex/README | 6 +-- Master/texmf-dist/doc/latex/prerex/chart.dat | 33 ++++++++++++ Master/texmf-dist/doc/latex/prerex/chart.map | 18 +++++++ Master/texmf-dist/doc/latex/prerex/chart.pdf | Bin 47713 -> 45363 bytes Master/texmf-dist/doc/latex/prerex/chart.sh | 3 ++ Master/texmf-dist/doc/latex/prerex/chart.svgz | Bin 0 -> 31216 bytes Master/texmf-dist/doc/latex/prerex/intro.pdf | Bin 284350 -> 285602 bytes Master/texmf-dist/doc/latex/prerex/intro.tex | 29 ++++++++--- Master/texmf-dist/doc/latex/prerex/prerex.pdf | Bin 144411 -> 156356 bytes Master/texmf-dist/doc/latex/prerex/prerex.sty.7 | 35 +++++++++---- .../texmf-dist/doc/latex/prerex/prerex.sty.7.pdf | Bin 0 -> 16953 bytes Master/texmf-dist/doc/latex/prerex/prerex.tex | 51 +++++++++++------- Master/texmf-dist/tex/latex/prerex/prerex.sty | 57 +++++++++++++++------ 13 files changed, 178 insertions(+), 54 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/prerex/chart.dat create mode 100644 Master/texmf-dist/doc/latex/prerex/chart.map create mode 100644 Master/texmf-dist/doc/latex/prerex/chart.sh create mode 100644 Master/texmf-dist/doc/latex/prerex/chart.svgz create mode 100644 Master/texmf-dist/doc/latex/prerex/prerex.sty.7.pdf diff --git a/Master/texmf-dist/doc/latex/prerex/README b/Master/texmf-dist/doc/latex/prerex/README index fce4dc5536b..3c41586e730 100644 --- a/Master/texmf-dist/doc/latex/prerex/README +++ b/Master/texmf-dist/doc/latex/prerex/README @@ -1,4 +1,4 @@ -prerex, version 2014-03-02. Macros for prerequisite charts, with +prerex, version 2014-03-22. Macros for prerequisite charts, with associated editor and viewer applications. This package consists of @@ -17,8 +17,8 @@ The implementation of prerex.sty is built on pgf, so that it may be used equally happily with latex or pdflatex; prerex is written in C and vprerex is written in C++ using the Qt-4 and poppler libraries. -See chart.{pdf,html} for a small example of a prerequisite chart and -real-life examples at +See chart.{pdf,html,svgz} for a small example of a prerequisite +chart and real-life examples at http://www.cs.queensu.ca/students/undergraduate/prerequisites/ diff --git a/Master/texmf-dist/doc/latex/prerex/chart.dat b/Master/texmf-dist/doc/latex/prerex/chart.dat new file mode 100644 index 00000000000..77ac2237116 --- /dev/null +++ b/Master/texmf-dist/doc/latex/prerex/chart.dat @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + diff --git a/Master/texmf-dist/doc/latex/prerex/chart.map b/Master/texmf-dist/doc/latex/prerex/chart.map new file mode 100644 index 00000000000..1b045d74de8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/prerex/chart.map @@ -0,0 +1,18 @@ + +1083 +1303 +2813 +2023 +2513 +1083 +2333 +2013 +2685 +2013 +3323 +3813 +3413 +3013 +3513 +3503 + diff --git a/Master/texmf-dist/doc/latex/prerex/chart.pdf b/Master/texmf-dist/doc/latex/prerex/chart.pdf index af8935b4e7b..354568cfcc3 100644 Binary files a/Master/texmf-dist/doc/latex/prerex/chart.pdf and b/Master/texmf-dist/doc/latex/prerex/chart.pdf differ diff --git a/Master/texmf-dist/doc/latex/prerex/chart.sh b/Master/texmf-dist/doc/latex/prerex/chart.sh new file mode 100644 index 00000000000..93480aa374a --- /dev/null +++ b/Master/texmf-dist/doc/latex/prerex/chart.sh @@ -0,0 +1,3 @@ +#!/bin/sh +mogrify -crop 1000x666+0+0 chart.png +exit 0 diff --git a/Master/texmf-dist/doc/latex/prerex/chart.svgz b/Master/texmf-dist/doc/latex/prerex/chart.svgz new file mode 100644 index 00000000000..cfad47bdfdc Binary files /dev/null and b/Master/texmf-dist/doc/latex/prerex/chart.svgz differ diff --git a/Master/texmf-dist/doc/latex/prerex/intro.pdf b/Master/texmf-dist/doc/latex/prerex/intro.pdf index ba6cb15c8e5..2b4e956ad15 100644 Binary files a/Master/texmf-dist/doc/latex/prerex/intro.pdf and b/Master/texmf-dist/doc/latex/prerex/intro.pdf differ diff --git a/Master/texmf-dist/doc/latex/prerex/intro.tex b/Master/texmf-dist/doc/latex/prerex/intro.tex index e03d426e2fd..e89c60dcebe 100644 --- a/Master/texmf-dist/doc/latex/prerex/intro.tex +++ b/Master/texmf-dist/doc/latex/prerex/intro.tex @@ -132,7 +132,9 @@ to accommodate paper size, display resolution, or user preference. Charts can also be converted to Portable Network Graphics (PNG) format for in-line use on a web page. PNG format is also relatively compact -and can be rendered directly by most web browsers. +and can be rendered directly by most web browsers. Scalable Vector Graphics (SVG) +format is a new standard which is increasingly supported by modern browsers; it is fairly easy to +convert PDF pages to SVG images. Prerex-formatted charts are produced by software that processes simple and convenient text-based descriptions. These descriptions can be edited in any @@ -475,6 +477,21 @@ From version 5.0, \verb|prerex.sty| (if processed by \verb\pdflatex\) generates containing image-map data for the hyperlinked nodes in the chart; consult a reference on the HTML language for an explanation of (client-side) image maps. +\section{Conversion to Scalable Vector Graphics (SVG) Format} + +Recent versions of popular browsers support SVG graphics natively,; i.e., without +requiring a plug-in or +external application. The quality and size of SVG images are comparable to PDF when +the files are compressed. + +On Unix-like platforms such as Linux, a small program called \verb\pdf2svg\ is +available\footnote{% +\myurl{http://www.cityinthesky.co.uk/opensource/pdf2svg/}}; it uses standard +libraries (\verb\poppler\ and \verb\cairo\) to implement +the conversion. Since version~6.5, pdf\LaTeX\ processing will generate an auxiliary +file \verb|\jobname.dat| of data on links in the PDF, as most conversion +applications do not attempt to convert PDF hyperlinks to SVG links. + \section{Terminology and Coordinate System} Before we discuss the \texttt{prerex} editor and the format @@ -533,14 +550,14 @@ in the background of a chart. The coordinates of a \emph{box,} -\emph{mini, +\emph{mini}, or -\emph{text-line}} +\emph{text} are those of its centre point. An \emph{arrow} is described by the -coordinates of the centre points of its source and target boxes/minis/text-lines. +coordinates of the centre points of its source and target boxes/minis/texts. \section{Chart Editing} \label{editor} @@ -554,11 +571,11 @@ and the Fink\footnote{\myurl{http://fink.sourceforge.net/}} platform on OS~X. The editor supports add, remove, cut-and-paste, and edit operations -on course boxes, minis, text-lines, and arrows, and shifts of specified diagram elements or an entire diagram. +on course boxes, minis, texts, and arrows, and shifts of specified diagram elements or an entire diagram. A summary of all commands supported by \texttt{prerex} is given in Table~\ref{help}. %on page~\pageref{help}. -Note that if a course box/mini/text-line is ``cut'' +Note that if a course box/mini/text is ``cut'' and then ``pasted'' elsewhere, the target or source coordinates of arrows into or out of the source and target are adjusted accordingly, and similarly if nodes are shifted or raised. To allow permutations of two or more chart elements, the diff --git a/Master/texmf-dist/doc/latex/prerex/prerex.pdf b/Master/texmf-dist/doc/latex/prerex/prerex.pdf index 4ba8a28f61e..15644cd9d0f 100644 Binary files a/Master/texmf-dist/doc/latex/prerex/prerex.pdf and b/Master/texmf-dist/doc/latex/prerex/prerex.pdf differ diff --git a/Master/texmf-dist/doc/latex/prerex/prerex.sty.7 b/Master/texmf-dist/doc/latex/prerex/prerex.sty.7 index d71cf77aeee..acc4b0abe75 100644 --- a/Master/texmf-dist/doc/latex/prerex/prerex.sty.7 +++ b/Master/texmf-dist/doc/latex/prerex/prerex.sty.7 @@ -1,4 +1,4 @@ -.TH PREREX.STY 7 2014-02-28 "prerex.sty-6.4" "" +.TH PREREX.STY 7 2014-03-22 "prerex.sty-6.5" "" .SH NAME prerex.sty \- a LaTeX document style for prerequisite charts .SH DESCRIPTION @@ -8,9 +8,10 @@ defines macros that can use to draw charts consisting of labelled course boxes linked by arrows that represent pre- and co-requisite requirements. -In addition to the usual -.B [pdf]latex -output, auxiliary files will be generated containing image-map data for the +If +.B pdflatex +is used, +auxiliary files will be generated as follows: image-map data and xlink commands for the hyperlinked nodes in the diagram and a shell script to crop a PNG image generated from a Postscript or PDF chart. .P @@ -202,7 +203,7 @@ command. .SH WEB LINKS Course boxes (including minis) may be hyperlinked. The default URL for course boxes is -.IR course-code .html +.IR ./course-code .html where .I course-code is @@ -351,7 +352,7 @@ This implementation of .B prerex.sty uses .B pgf -(version 1.18 or later) +(version 3.0 or later) with add-on package .B tikz. The following additional packages are used: @@ -371,6 +372,10 @@ followed by .BR dvips (1) (and possibly .BR ps2pdf (1)) +.I or +.BR latex (1) +followed by +.BR dvipdfmx (1) may be used. .P To convert a chart to a compact but reasonably high-quality image, it is suggested to use the @@ -395,6 +400,12 @@ crops the image at the southeast corner. It is possible to use a PNG compression application such as .BR optipng (1) to reduce the file-size of the cropped image (without loss of quality). +.P +To convert a PDF chart to SVG (Scaleable Vector Graphic) format, it is recommended to +use +.BR pdf2svg (1), +obtainable from +http://www.cityinthesky.co.uk/opensource/pdf2svg/. .SH IMPLEMENTATION DETAILS .P @@ -430,16 +441,18 @@ PDF viewers to compute chart coordinates. .P To support HTML versions of charts, .B prerex.sty +(when processed by +.BR pdflatex (1)) generates a script to crop a chart image at the southeast corner, allowing descriptive notes below the chart to be treated as ordinary text. Also, -it generates image-map data for use with an HTML image map. To +it generates image-map data for use with an HTML image map and +xlink data for use with a SVG image. To obtain absolute page coordinates, the .B zsavepos, .B zposx and .B zposy -commands are used; the page coordinates are converted into pixel coordinates -for cropping and image-map use. +commands are used; the page coordinates are converted into pixel coordinates. .SH LICENSE .B prerex.sty and this document may be distributed and/or modified under the @@ -449,6 +462,7 @@ R. D. Tennent (rdt@cs.queensu.ca) .SH SEE ALSO .BR ImageMagick (1), .BR convert (1). +.BR dvipdfmx (1), .BR dvips (1), .BR evince (1), .BR gpdf (1), @@ -456,12 +470,13 @@ R. D. Tennent (rdt@cs.queensu.ca) .BR latex (1), .BR okular (1), .BR optipng (1), +.BR pdf2svg (1), .BR pdflatex (1), .BR prerex (1), .BR prerex (5), .BR ps2pdf (1), .BR tikz (1), -.BR tgf (1), +.BR pgf (1), .BR vprerex (1), and .BR xpdf (1). diff --git a/Master/texmf-dist/doc/latex/prerex/prerex.sty.7.pdf b/Master/texmf-dist/doc/latex/prerex/prerex.sty.7.pdf new file mode 100644 index 00000000000..1d58d2d4b63 Binary files /dev/null and b/Master/texmf-dist/doc/latex/prerex/prerex.sty.7.pdf differ diff --git a/Master/texmf-dist/doc/latex/prerex/prerex.tex b/Master/texmf-dist/doc/latex/prerex/prerex.tex index 1146461bb67..448ef4e5ef0 100644 --- a/Master/texmf-dist/doc/latex/prerex/prerex.tex +++ b/Master/texmf-dist/doc/latex/prerex/prerex.tex @@ -3,10 +3,11 @@ \usepackage[medium,semibold,scale=0.95]{cabin} \usepackage{fullpage} \usepackage{prerex} +\newcommand{\myurl}[1]{\textcolor{blue}{\underline{\textcolor{black}{\url{#1}}}}} %\def\LaTeX{\mbox{LaTeX}} \begin{document} -\title{\textsf{prerex.sty}: Prerequisite Charts in \LaTeX\\{\large Version 6.4}} +\title{\textsf{prerex.sty}: Prerequisite Charts in \LaTeX\\{\large Version 6.5}} \author{R. D. Tennent\\\texttt{rdt@cs.queensu.ca}} \date{\today} \maketitle @@ -15,17 +16,16 @@ \section{Description} \texttt{prerex.sty} defines macros that -[pdf]\LaTeX\ +\LaTeX\ processors can use -to draw charts consisting of labelled course boxes linked by arrows +to create charts consisting of labelled course boxes linked by arrows that represent pre- and co-requisite requirements; see the example chart in Figure~\ref{chart} on page~\pageref{chart}. -In addition to the usual -output, auxiliary files will be generated containing image-map data for the -hyperlinked nodes in the diagram and a shell script for cropping a PNG image -obtained from the output; however, the page coordinates may not be accurate unless pdf\LaTeX\ -is used as the -processing engine. +If pdf\LaTeX\ is used as the processing engine, +three auxiliary files will be generated, as follows: image-map data and SVG commands for the +hyperlinked nodes in the diagram, and a shell script for cropping a PNG image +obtained from the output. pdf\LaTeX\ must be used as the processing engine +to get accurate page coordinates. If the source file satisfies the constraints of the @@ -384,8 +384,8 @@ and \verb\latex\ (followed by \verb\dvips\ and, possibly, \verb\ps2pdf\) \emph{or} \verb\latex\ (with suitable driver options, followed by \verb\dvipdfmx\) -may be used; however, cropping shell scripts and -image maps are only generated if \verb\pdflatex\ +may be used; however, cropping shell scripts, +image maps and link data files are only generated if \verb\pdflatex\ is used. \section{Conversion to Portable Network Graphic (PNG) Format} @@ -410,6 +410,19 @@ If \verb\pdflatex\ is used, an auxiliary file containing image-map data for the hyperlinked nodes in the chart is also generated; consult a reference on the HTML language for an explanation of (client-side) image maps. +\section{Conversion to Scalable Vector Graphic (SVG) Format} + +SVG is an emerging standard for high-quality graphics. The +\texttt{pdf2svg}\footnote{% +\myurl{http://www.cityinthesky.co.uk/opensource/pdf2svg/}} +program uses \texttt{poppler} and \texttt{cairo} libraries +to convert a PDF page to a scalable vector-graphic image. When compressed +by \texttt{gzip} into \texttt{.svgz} format, the image file is comparable in size and quality +to the PDF form. Currently, links in the PDF are not converted by \texttt{poppler} and +\texttt{cairo} to links +in the SVG image. Since Version~6.5, an auxiliary file of suitable commands for inclusion in +a \texttt{.svg} image is generated by pdf\LaTeX\ processing. + \section{Installation} \begin{enumerate} @@ -439,7 +452,7 @@ user: \end{list} where the argument should be in the range $0$--$100$; $0$ means no curvature. \begin{list}{}{} -\item \verb|\newcommand{\CourseURL}[3]{#3.html}| +\item \verb|\newcommand{\CourseURL}[3]{./#3.html}| \end{list} where the arguments supplied at the call are the $x$ and $y$ coordinates of the box or mini and the course code. @@ -531,16 +544,16 @@ PDF viewers to compute chart coordinates. \subsection{Chart Images} -\enlargethispage*{8ex} - To support HTML versions of charts, \texttt{prerex.sty} (if processed by \verb\pdflatex\) generates a script to crop a chart image at the southeast corner, allowing -descriptive notes below the chart to be treated as ordinary text. Also, -it generates image-map data for use with an HTML image map. To -obtain absolute page coordinates, the \texttt{zsavepos}, \texttt{zposx} -and \texttt{zposy} commands are used; the page coordinates are converted into pixel coordinates -for cropping and image-map use. +descriptive notes below the chart to be treated as ordinary text. Also, for the clickable links, +it generates image-map data for use with an HTML image map and +\texttt{xlink} commands for embedding into an +SVG image. To +obtain absolute page coordinates for these auxiliary files, the \texttt{zsavepos}, \texttt{zposx} +and \texttt{zposy} commands are used; the page coordinates are converted into pixel +coordinates. \section{License} \verb|prerex.sty|, \verb|prerex.sty.7|, \verb|README.prerex| and this document may be distributed and/or modified under the diff --git a/Master/texmf-dist/tex/latex/prerex/prerex.sty b/Master/texmf-dist/tex/latex/prerex/prerex.sty index 429c8171ecd..fe101470637 100644 --- a/Master/texmf-dist/tex/latex/prerex/prerex.sty +++ b/Master/texmf-dist/tex/latex/prerex/prerex.sty @@ -13,7 +13,7 @@ %% This work has the LPPL maintenance status "author-maintained". %% \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{prerex}[2014/03/02 v6.4.1 LaTeX style for prerequisite charts, pgf version] +\ProvidesPackage{prerex}[2014/03/22 v6.5.0 LaTeX style for prerequisite charts, pgf version] % % Changelog is at the end of the file. % @@ -45,10 +45,12 @@ % \newlength{\unit} - +\newlength{\ppt} +\setlength{\ppt}{0.0138888888in} % one Postscript point = (1/72) in. \setlength{\unit}{5.7816pt} % 10 pixels per unit at 125dpi; 1pt = (1/72.27) in. \newcommand{\PixelsPerUnit}{10} \newcommand{\dpi}{125} +\newcommand{\ppi}{72} \RequirePackage{relsize} \RequirePackage{calc} @@ -69,7 +71,7 @@ \newcommand{\DefaultCurvature}{20} % where the argument should be in the range 0-100; 0 means no curvature. -\newcommand{\CourseURL}[3]{file:#3.html} +\newcommand{\CourseURL}[3]{#3.html} % where the arguments supplied at the call are the x and y coordinates % and the course code. @@ -79,7 +81,7 @@ \newcommand{\boldwidth}{1.0pt} \newcommand{\dottedwidth}{0.8pt} \newcommand{\dashedwidth}{0.5pt} -\newcommand{\smallersize}{\relsize{-2}} +\newcommand{\smallersize}{\relsize{-3}} \newcommand{\baselineAdj}{-0.5ex} \newcounter{@myangle} @@ -103,8 +105,11 @@ \fi \newcounter{chart} % in case there is more than one chart in the document -\newcounter{xNW}\newcounter{yNW} % coordinates of NW corner of a node -\newcounter{xSE}\newcounter{ySE} % coordinates of SE corner of a node +\newcounter{xNW}\newcounter{yNW} +\newcounter{xSE}\newcounter{ySE} +\newcounter{xSW}\newcounter{ySW} +\newcounter{xL}\newcounter{yL} +\newcounter{XSE}\newcounter{YSE} \def\@unitmult{\unit * 5} % used for the grid and as the minimum height of half-course boxes @@ -128,6 +133,16 @@ \addtocounter{ySE}{0 - (#2 + #5) * \PixelsPerUnit } % subtract # of pixels from origin to node (+#5) \immediate\write\@imapfile{#3}% + + \immediate\write\@linkfile{ } \fi } @@ -611,13 +626,16 @@ \ifpdf \newwrite\@imapfile % image-map data - \newwrite\@scriptfile % shell script to generate image file + \newwrite\@scriptfile % shell script to crop PNG image + \newwrite\@linkfile % link data for SVG \ifnum\value{chart}=0 \immediate\openout\@imapfile=\jobname.map \immediate\write\@imapfile{} + \immediate\openout\@linkfile=\jobname.dat \else \immediate\openout\@imapfile=\jobname_\thechart.map \immediate\write\@imapfile{} + \immediate\openout\@linkfile=\jobname_\thechart.dat \fi \fi @@ -656,21 +674,23 @@ \end{tikzpicture} \ifpdf \write\@imapfile{} + \write\@linkfile{} \closeout\@imapfile + \closeout\@linkfile \zsavepos{EndOfChart_\thechart} % determine cropping coordinates \ifdim\paperwidth<\paperheight % portrait mode - \setcounter{xSE}{\dpi * \ratio{\zposx{EndOfChart_\thechart}sp}{1in}}% - \setcounter{ySE}{ \dpi * \ratio{\paperheight}{1in}} - \addtocounter{ySE}{0 - \dpi * \ratio{\zposy{EndOfChart_\thechart}sp}{1in}} - \addtocounter{ySE}{0 + 2 * \PixelsPerUnit } % bottom margin + \setcounter{XSE}{\dpi * \ratio{\zposx{EndOfChart_\thechart}sp}{1in}}% + \setcounter{YSE}{ \dpi * \ratio{\paperheight}{1in}} + \addtocounter{YSE}{0 - \dpi * \ratio{\zposy{EndOfChart_\thechart}sp}{1in}} + \addtocounter{YSE}{0 + 2 * \PixelsPerUnit } % bottom margin \else % landscape mode - \setcounter{xSE}{ \dpi * \ratio{\paperwidth}{1in}} - \addtocounter{xSE}{0 - \dpi * \ratio{\zposx{EndOfChart_\thechart}sp}{1in}}% + \setcounter{XSE}{ \dpi * \ratio{\paperwidth}{1in}} + \addtocounter{XSE}{0 - \dpi * \ratio{\zposx{EndOfChart_\thechart}sp}{1in}}% \addtocounter{xSE}{0 + 2 * \PixelsPerUnit } % bottom margin - \setcounter{ySE}{ \dpi * \ratio{\paperheight}{1in}} - \addtocounter{ySE}{ 0 - \dpi * \ratio{\zposy{EndOfChart_\thechart}sp}{1in}} + \setcounter{YSE}{ \dpi * \ratio{\paperheight}{1in}} + \addtocounter{YSE}{ 0 - \dpi * \ratio{\zposy{EndOfChart_\thechart}sp}{1in}} \fi \edef\HasH{\expandafter\@gobble\string\#} \ifnum\value{chart}=0 @@ -678,7 +698,7 @@ \immediate\openout\@scriptfile=\jobname.sh \immediate\write\@scriptfile{\HasH!/bin/sh} % defer remaining output till cropping coordinates are available - \write\@scriptfile{mogrify -crop \thexSE x\theySE +0+0 \jobname.png} + \write\@scriptfile{mogrify -crop \theXSE x\theYSE +0+0 \jobname.png} \write\@scriptfile{exit 0} \closeout\@scriptfile \fi % more than one chart? unlikely a cropping script would be usable @@ -688,6 +708,11 @@ % % Changelog: % +% Version 6.5.0 +% +% pdflatex processing now generates an auxiliary file \jobname.dat of link data +% for use with a SVG image +% % Version 6.4.1 % % Set length=4pt for arrow tips in tikzpicture options. -- cgit v1.2.3