← Prev in month ← Prev in thread

[PATCH] makediffpdf.sh: tool to create marked-up diff

From
Michael S. Tsirkin
Date
2014-06-22T16:41:00+00:00
ID
Thread
[PATCH] makediffpdf.sh: tool to create marked-up diff
make pdf diff using latexpand and latexdiff-fast  styles are set in diffpreamble.tex: new text is blue, old text is red and is crossed-out.  in diff, links are coloured green instead of blue  Must be run within a git-svn clone of the spec repository.  Note: latexdiff has --flatten option, this and options to select diff style don't seem to work well. So flatten by script myself, and add our own preamble.  Signed-off-by: Michael S. Tsirkin <> ---  The following seems to work OK for me, though it probably can be made prettier. Anyone? Note: I'm using latexdiff-fast tool from cpan: default latexdiff on Fedora does not seem to work well.
diffpreamble.tex
27 +++++++++++++++++++++++++++  makediffpdf.sh
36 ++++++++++++++++++++++++++++++++++++  2 files changed, 63 insertions(+)  create mode 100644 diffpreamble.tex  create mode 100755 makediffpdf.sh  diff --git a/diffpreamble.tex b/diffpreamble.tex new file mode 100644 index 0000000..d34ced5 --- /dev/null +++ b/diffpreamble.tex @@ -0,0 +1,27 @@ +%DIF FONTSTRIKE PREAMBLE +RequirePackage[normalem]{ulem} +providecommand{DIFaddtex}[1]{{sf #1}} +providecommand{DIFdeltex}[1]{{footnotesize sout{#1}}} +%DIF END FONTSTRIKE PREAMBLE +%DIF COLOR PREAMBLE +RequirePackage{color} +providecommand{DIFaddbegin}{protectcolor{blue}} +providecommand{DIFaddend}{protectcolor{black}} +providecommand{DIFdelbegin}{protectcolor{red}} +providecommand{DIFdelend}{protectcolor{black}} +%DIF END COLOR PREAMBLE +% Standard DIFadd and DIFdel are redefined as DIFaddtex and DIFdeltex +% when hyperref package is included. +%DIF HYPERREF PREAMBLE +providecommand{DIFadd}[1]{	exorpdfstring{DIFaddtex{#1}}{#1}} +providecommand{DIFdel}[1]{	exorpdfstring{DIFdeltex{#1}}{}} +%DIF END HYPERREF PACKAGE + +%DIF FLOATSAFE PREAMBLE: SEEMS UNUSED BUT JUST IN CASE +providecommand{DIFaddFL}[1]{DIFadd{#1}} +providecommand{DIFdelFL}[1]{DIFdel{#1}} +providecommand{DIFaddbeginFL}{} +providecommand{DIFaddendFL}{} +providecommand{DIFdelbeginFL}{} +providecommand{DIFdelendFL}{} +%DIF END FLOATSAFE PREAMBLE diff --git a/makediffpdf.sh b/makediffpdf.sh new file mode 100755 index 0000000..a8176ad --- /dev/null +++ b/makediffpdf.sh @@ -0,0 +1,34 @@ +#make pdf diff using latexpand and latexdiff-fast +#preamble in diffpreamble.tex +#in diff, links are coloured green instead of blue +PATH=.:${PATH} +cur="$PWD" +rm -fr old new +git clone $PWD old +cd "${cur}/old" +git checkout ec1ffbf27a8f0a06ca65cd498a69c7f89bd97dc1 +mv specvars.tex specvars-orig.tex +#make links green to avoid confusion +sed s/blue/green/ specvars-orig.tex
> specvars.tex +SPECDOC=${SPECDOC:-`cat REVISION`} +./make-setup-generated.sh "$SPECDOC" +#wget  http://www.ctan.org/pkg/latexpand  +#chmod +x latexpand +latexpand virtio.tex -o flat.tex +cd "${cur}" +git clone $PWD new +cd "${cur}/new" +mv specvars.tex specvars-orig.tex +#make links green to avoid confusion +sed s/blue/green/ specvars-orig.tex
> specvars.tex +SPECDOC=${SPECDOC:-`cat REVISION`} +./make-setup-generated.sh "$SPECDOC" +latexpand virtio.tex -o flat.tex +cd "${cur}" +#wget  http://mirror.math.ku.edu/tex-archive/support/latexdiff/latexdiff-fast  +#chmod +x latexdiff-fast +latexdiff-fast -p diffpreamble.tex old/flat.tex new/flat.tex
> virtio-diff.tex +rm $SPECDOC.aux $SPECDOC.pdf $SPECDOC.out +xelatex --jobname $SPECDOC virtio-diff.tex +xelatex --jobname $SPECDOC virtio-diff.tex +xelatex --jobname $SPECDOC virtio-diff.tex

--
MST
← Prev in month ← Prev in thread