diff options
author | Karl Berry <karl@freefriends.org> | 2015-12-29 00:15:33 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-12-29 00:15:33 +0000 |
commit | bac237f29f6ca325050af70f4720d1af61c45bbe (patch) | |
tree | 198196d36912e5d3b734e2272853524765acf989 /Master/texmf-dist/doc | |
parent | 5460c8b6efbae612a6bed2069f92d1957234f75f (diff) |
latexdiff (26dec15)
git-svn-id: svn://tug.org/texlive/trunk@39223 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexdiff-vc.1 | 46 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexdiff-vc.man1.pdf | bin | 10964 -> 32148 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexdiff.1 | 153 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexdiff.man1.pdf | bin | 37584 -> 65711 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexrevise.1 | 29 | ||||
-rw-r--r-- | Master/texmf-dist/doc/man/man1/latexrevise.man1.pdf | bin | 8976 -> 29859 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexdiff/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.pdf | bin | 288437 -> 268129 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.tex | 16 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/support/latexdiff/latexdiff | 387 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/support/latexdiff/latexdiff-fast | 387 |
11 files changed, 717 insertions, 309 deletions
diff --git a/Master/texmf-dist/doc/man/man1/latexdiff-vc.1 b/Master/texmf-dist/doc/man/man1/latexdiff-vc.1 index dec9e1306fb..067af21f186 100644 --- a/Master/texmf-dist/doc/man/man1/latexdiff-vc.1 +++ b/Master/texmf-dist/doc/man/man1/latexdiff-vc.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXDIFF-VC 1" -.TH LATEXDIFF-VC 1 "2015-04-14" "perl v5.14.2" " " +.TH LATEXDIFF-VC 1 "2015-12-26" "perl v5.18.2" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -143,7 +152,7 @@ latexdiff\-vc \- wrapper script that calls latexdiff for different versions of a .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fIlatexdiff-vc\fR is a wrapper script that applies \fIlatexdiff\fR to a -file, or multiple files under version control (\s-1CVS\s0, \s-1RCS\s0 or \s-1SVN\s0), and optionally runs the +file, or multiple files under version control (git, subversion (\s-1SVN\s0), mercurial (hg), \s-1CVS, RCS\s0), and optionally runs the sequence of \f(CW\*(C`latex\*(C'\fR and \f(CW\*(C`dvips\*(C'\fR or \f(CW\*(C`pdflatex\*(C'\fR commands necessary to produce pdf or postscript output of the difference tex file(s). It can also be applied to a pair of files to automatise the generation of difference @@ -155,16 +164,16 @@ file in postscript or pdf format. Set the version system. If no version system is specified, latexdiff-vc will venture a guess. .Sp -latexdiff-cvs and latexdiff-rcs are variants of latexdiff-vc which default to +latexdiff-cvs, latexdiff-rcs etc are variants of latexdiff-vc which default to the respective versioning system. However, this default can still be overridden using the options above. .IP "\fB\-r\fR, \fB\-r\fR \fIrev\fR or \fB\-\-revision\fR, \fB\-\-revision=\fR\fIrev\fR" 4 .IX Item "-r, -r rev or --revision, --revision=rev" -Choose revision (under \s-1RCS\s0, \s-1CVS\s0, \s-1SVN\s0, \s-1GIT\s0 or \s-1HG\s0). One or two \fB\-r\fR options can be +Choose revision (under \s-1RCS, CVS, SVN, GIT\s0 or \s-1HG\s0). One or two \fB\-r\fR options can be specified, and they result in different behaviour: .RS 4 .IP "\fBlatexdiff-vc\fR \-r \fIfile.tex\fR ..." 4 .IX Item "latexdiff-vc -r file.tex ..." -compares \fIfile.tex\fR with the most recent version checked into \s-1RCS\s0. +compares \fIfile.tex\fR with the most recent version checked into \s-1RCS.\s0 .IP "\fBlatexdiff-vc\fR \-r \fIrev1\fR \fIfile.tex\fR ..." 4 .IX Item "latexdiff-vc -r rev1 file.tex ..." compares \fIfile.tex\fR with revision \fIrev1\fR. @@ -175,7 +184,7 @@ compares revisions \fIrev1\fR and \fIrev2\fR of \fIfile.tex\fR. Multiple files can be specified for all of the above options. All files must have the extension \f(CW\*(C`.tex\*(C'\fR, though. .IP "\fBlatexdiff-vc\fR \fIold.tex\fR \fInew.tex\fR" 4 -.IX Item "latexdiff-vc old.tex new.tex" +.IX Item "latexdiff-vc old.tex new.tex" compares two files. .RE .RS 4 @@ -184,7 +193,7 @@ The name of the difference file is generated automatically and reported to stdout. .RE .IP "\fB\-d\fR or \fB\-\-dir\fR \fB\-d\fR \fIpath\fR or \fB\-\-dir=\fR\fIpath\fR" 4 -.IX Item "-d or --dir -d path or --dir=path" +.IX Item "-d or --dir -d path or --dir=path" Rather than appending the string \f(CW\*(C`diff\*(C'\fR and optionally the version numbers given to the output-file, this will prepend a directory name \f(CW\*(C`diff\*(C'\fR to the @@ -216,7 +225,7 @@ run the sequence \f(CW\*(C`pdflatex; pdflatex\*(C'\fR on the difference file, or \&\f(CW\*(C`pdflatex; bibtex; pdflatex; pdflatex\*(C'\fR for files requiring bibtex. .IP "\fB\-\-only\-changes\fR" 4 .IX Item "--only-changes" -Post-process the output such that only pages with changes on them are displayed. This requires the use of subtype \s-1ZLABEL\s0 +Post-process the output such that only pages with changes on them are displayed. This requires the use of subtype \s-1ZLABEL \s0 in latexdiff, which will be set automatically, but any manually set \-s option will be overruled (also requires zref package to be installsed). (note that this option must be combined with \-\-ps or \-\-pdf to make sense) .IP "\fB\-\-force\fR" 4 @@ -244,10 +253,11 @@ or higher are required. .SH "BUG REPORTING" .IX Header "BUG REPORTING" Please submit bug reports using the issue tracker of the github repository page \fIhttps://github.com/ftilmann/latexdiff.git\fR, -or send them to \fItilmann \*(-- \s-1AT\s0 \*(-- gfz\-potsdam.de\fR. Include the serial number of \fIlatexdiff-vc\fR +or send them to \fItilmann \*(-- \s-1AT\s0 \*(-- gfz\-potsdam.de\fR. Include the version number of \fIlatexdiff-vc\fR (option \f(CW\*(C`\-\-version\*(C'\fR). .SH "AUTHOR" .IX Header "AUTHOR" +Version 1.1.1 Copyright (C) 2005\-2015 Frederik Tilmann .PP This program is free software; you can redistribute it and/or modify diff --git a/Master/texmf-dist/doc/man/man1/latexdiff-vc.man1.pdf b/Master/texmf-dist/doc/man/man1/latexdiff-vc.man1.pdf Binary files differindex aa1fcab822f..fa6f683059d 100644 --- a/Master/texmf-dist/doc/man/man1/latexdiff-vc.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/latexdiff-vc.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/latexdiff.1 b/Master/texmf-dist/doc/man/man1/latexdiff.1 index 24834cbde14..815f23d874e 100644 --- a/Master/texmf-dist/doc/man/man1/latexdiff.1 +++ b/Master/texmf-dist/doc/man/man1/latexdiff.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXDIFF 1" -.TH LATEXDIFF 1 "2015-04-14" "perl v5.14.2" " " +.TH LATEXDIFF 1 "2015-12-26" "perl v5.18.2" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -270,7 +279,7 @@ CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCBHBAR BOLD\*(C'\fR Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines \&\f(CW\*(C`\eDIFaddbegin\*(C'\fR, \f(CW\*(C`\eDIFaddend\*(C'\fR, \f(CW\*(C`\eDIFdelbegin\*(C'\fR and \f(CW\*(C`\eDIFdelend\*(C'\fR commands. -Available styles: \f(CW\*(C`SAFE MARGINAL COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*\*(C'\fR +Available styles: \f(CW\*(C`SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*\*(C'\fR .Sp [ Default: \f(CW\*(C`SAFE\*(C'\fR ] * Subtype \f(CW\*(C`LABEL\*(C'\fR is deprecated @@ -294,7 +303,7 @@ obtained by executing .Sp [Default encoding is utf8 unless the first few lines of the preamble contain an invocation \f(CW\*(C`\eusepackage[..]{inputenc}\*(C'\fR in which case the -encoding chosen by this command is asssumed. Note that \s-1ASCII\s0 (standard +encoding chosen by this command is asssumed. Note that \s-1ASCII \s0(standard latex) is a subset of utf8] .IP "\fB\-\-preamble=file\fR or \fB\-p file\fR" 4 .IX Item "--preamble=file or -p file" @@ -352,9 +361,9 @@ Define most of the glossaries commands as safe, protecting them with \embox'es w .el .IP "\f(CWmhchem\fR" 8 .IX Item "mhchem" Treat \f(CW\*(C`\ece\*(C'\fR as a safe command, i.e. it will be highlighted (note that \f(CW\*(C`\ecee\*(C'\fR will not be highlighted in equations as this leads to processing errors) -.ie n .IP """chemformula""" 8 -.el .IP "\f(CWchemformula\fR" 8 -.IX Item "chemformula" +.ie n .IP """chemformula"" or ""chemmacros""" 8 +.el .IP "\f(CWchemformula\fR or \f(CWchemmacros\fR" 8 +.IX Item "chemformula or chemmacros" Treat \f(CW\*(C`\ech\*(C'\fR as a safe command outside equations, i.e. it will be highlighted (note that \f(CW\*(C`\ech\*(C'\fR will not be highlighted in equations as this leads to processing errors) .RE .RS 4 @@ -369,7 +378,7 @@ Print generated or included preamble commands to stdout. .IX Subsection "Configuration" .ie n .IP "\fB\-\-exclude\-safecmd=exclude\-file\fR or \fB\-A exclude-file\fR or \fB\-\-exclude\-safecmd=""cmd1,cmd2,...""\fR" 4 .el .IP "\fB\-\-exclude\-safecmd=exclude\-file\fR or \fB\-A exclude-file\fR or \fB\-\-exclude\-safecmd=``cmd1,cmd2,...''\fR" 4 -.IX Item "--exclude-safecmd=exclude-file or -A exclude-file or --exclude-safecmd=cmd1,cmd2,..." +.IX Item "--exclude-safecmd=exclude-file or -A exclude-file or --exclude-safecmd=cmd1,cmd2,..." .PD 0 .IP "\fB\-\-replace\-safecmd=replace\-file\fR" 4 .IX Item "--replace-safecmd=replace-file" @@ -438,7 +447,7 @@ their arguments. Define safe commands, which additionally need to be protected by encapsulating in an \e\embox{..}. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting -in the default style \s-1UNDERLINE\s0 as well as \s-1CULINECHBAR\s0 \s-1CFONTSTRIKE\s0 +in the default style \s-1UNDERLINE\s0 as well as \s-1CULINECHBAR CFONTSTRIKE\s0 .IP "\fB\-\-config var1=val1,var2=val2,...\fR or \fB\-c var1=val1,..\fR" 4 .IX Item "--config var1=val1,var2=val2,... or -c var1=val1,.." .PD 0 @@ -449,23 +458,27 @@ Set configuration variables. The option can be repeated to set different variables (as an alternative to the comma-separated list). Available variables (see below for further explanations): .Sp -\&\f(CW\*(C`MINWORDSBLOCK\*(C'\fR (integer) +\&\f(CW\*(C`ARRENV\*(C'\fR (RegEx) .Sp -\&\f(CW\*(C`FLOATENV\*(C'\fR (RegEx) +\&\f(CW\*(C`COUNTERCMD\*(C'\fR (RegEx) .Sp -\&\f(CW\*(C`PICTUREENV\*(C'\fR (RegEx) +\&\f(CW\*(C`FLOATENV\*(C'\fR (RegEx) .Sp -\&\f(CW\*(C`MATHENV\*(C'\fR (RegEx) +\&\f(CW\*(C`ITEMCMD\*(C'\fR (RegEx) .Sp -\&\f(CW\*(C`MATHREPL\*(C'\fR (String) +\&\f(CW\*(C`LISTENV\*(C'\fR (RegEx) .Sp \&\f(CW\*(C`MATHARRENV\*(C'\fR (RegEx) .Sp \&\f(CW\*(C`MATHARRREPL\*(C'\fR (String) .Sp -\&\f(CW\*(C`ARRENV\*(C'\fR (RegEx) +\&\f(CW\*(C`MATHENV\*(C'\fR (RegEx) .Sp -\&\f(CW\*(C`COUNTERCMD\*(C'\fR (RegEx) +\&\f(CW\*(C`MATHREPL\*(C'\fR (String) +.Sp +\&\f(CW\*(C`MINWORDSBLOCK\*(C'\fR (integer) +.Sp +\&\f(CW\*(C`PICTUREENV\*(C'\fR (RegEx) .IP "\fB\-\-show\-safecmd\fR" 4 .IX Item "--show-safecmd" Print list of RegEx matching and excluding safe commands. @@ -516,7 +529,7 @@ expected, e.g. correction of typos. .IP "\fB\-\-disable\-citation\-markup\fR or \fB\-\-disable\-auto\-mbox\fR" 4 .IX Item "--disable-citation-markup or --disable-auto-mbox" Suppress citation markup and markup of other vulnerable commands in styles -using ulem (\s-1UNDERLINE\s0,FONTSTRIKE, \s-1CULINECHBAR\s0) +using ulem (\s-1UNDERLINE,FONTSTRIKE, CULINECHBAR\s0) (the two options are identical and are simply aliases) .IP "\fB\-\-enable\-citation\-markup\fR or \fB\-\-enforce\-auto\-mbox\fR" 4 .IX Item "--enable-citation-markup or --enforce-auto-mbox" @@ -532,7 +545,7 @@ Default is to work silently. .IP "\fB\-\-driver=type\fR" 4 .IX Item "--driver=type" Choose driver for changebar package (only relevant for styles using - changebar: \s-1CCHANGEBAR\s0 \s-1CFONTCHBAR\s0 \s-1CULINECHBAR\s0 \s-1CHANGEBAR\s0). Possible + changebar: \s-1CCHANGEBAR CFONTCHBAR CULINECHBAR CHANGEBAR\s0). Possible drivers are listed in changebar manual, e.g. pdftex,dvips,dvitops [Default: dvips] .IP "\fB\-\-ignore\-warnings\fR" 4 @@ -688,13 +701,23 @@ Mark additions the same way as in the main text. Deleted environments are marke Make no difference between the main text and floats. .SS "Configuration Variables" .IX Subsection "Configuration Variables" -.ie n .IP """MINWORDSBLOCK""" 10 -.el .IP "\f(CWMINWORDSBLOCK\fR" 10 -.IX Item "MINWORDSBLOCK" -Minimum number of tokens required to form an independent block. This value is -used in the algorithm to detect changes of complete blocks by merging identical text parts of less than \f(CW\*(C`MINWORDSBLOCK\*(C'\fR to the preceding added and discarded parts. +.ie n .IP """ARRENV""" 10 +.el .IP "\f(CWARRENV\fR" 10 +.IX Item "ARRENV" +If a match to \f(CW\*(C`ARRENV\*(C'\fR is found within an inline math environment within a deleted or added block, then the inlined math +is surrounded by \f(CW\*(C`\embox{\*(C'\fR...\f(CW\*(C`}\*(C'\fR. This is necessary as underlining does not work within inlined array environments. .Sp -[ Default: 3 ] +[ Default: \f(CW\*(C`ARRENV\*(C'\fR=\f(CW\*(C`(?:array|[pbvBV]matrix)\*(C'\fR\ +.ie n .IP """COUNTERCMD""" 10 +.el .IP "\f(CWCOUNTERCMD\fR" 10 +.IX Item "COUNTERCMD" +If a command in a deleted block which is also in the textcmd list matches \f(CW\*(C`COUNTERCMD\*(C'\fR then an +additional command \f(CW\*(C`\eaddtocounter{\*(C'\fR\fIcntcmd\fR\f(CW\*(C`}{\-1}\*(C'\fR, where \fIcntcmd\fR is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the +numbering in the new file. +.Sp +[ Default: \f(CW\*(C`COUNTERCMD\*(C'\fR=\f(CW\*(C`(?:footnote|part|section|subsection\*(C'\fR ... +.Sp +\&\f(CW\*(C`|subsubsection|paragraph|subparagraph)\*(C'\fR ] .ie n .IP """FLOATENV""" 10 .el .IP "\f(CWFLOATENV\fR" 10 .IX Item "FLOATENV" @@ -703,19 +726,22 @@ considered floats. Within these environments, the \fIlatexdiff\fR markup comman are replaced by their \s-1FL\s0 variaties. .Sp [ Default: \f(CW\*(C`(?:figure|table|plate)[\ew\ed*@]*\*(C'\fR\ ] -.ie n .IP """PICTUREENV""" 10 -.el .IP "\f(CWPICTUREENV\fR" 10 -.IX Item "PICTUREENV" -Within environments whose name matches the regular expression in \f(CW\*(C`PICTUREENV\*(C'\fR -all latexdiff markup is removed (in pathologic cases this might lead to - inconsistent markup but this situation should be rare). -.Sp -[ Default: \f(CW\*(C`(?:picture|DIFnomarkup)[\ew\ed*@]*\*(C'\fR\ ] +.ie n .IP """ITEMCMD""" 10 +.el .IP "\f(CWITEMCMD\fR" 10 +.IX Item "ITEMCMD" +Commands representing new item line with list environments. +.Sp +[ Default: \e\f(CW\*(C`item\*(C'\fR ] +.ie n .IP """LISTENV""" 10 +.el .IP "\f(CWLISTENV\fR" 10 +.IX Item "LISTENV" +Environments whose name matches the regular expression in \f(CW\*(C`LISTENV\*(C'\fR are list environments. +.Sp +[ Default: \f(CW\*(C`(?:itemize|enumerate|description)\*(C'\fR\ ] .ie n .IP """MATHENV"",""MATHREPL""" 10 .el .IP "\f(CWMATHENV\fR,\f(CWMATHREPL\fR" 10 .IX Item "MATHENV,MATHREPL" -If both \ebegin and \eend for a math environment (environment name matching \f(CW\*(C`MATHENV\*(C'\fR -or \e[ and \e]) +If both \ebegin and \eend for a math environment (environment name matching \f(CW\*(C`MATHENV\*(C'\fR or \e[ and \e]) are within the same deleted block, they are replaced by a \ebegin and \eend commands for \f(CW\*(C`MATHREPL\*(C'\fR rather than being commented out. .Sp @@ -726,23 +752,21 @@ rather than being commented out. as \f(CW\*(C`MATHENV\*(C'\fR,\f(CW\*(C`MATHREPL\*(C'\fR but for equation arrays .Sp [ Default: \f(CW\*(C`MATHARRENV\*(C'\fR=\f(CW\*(C`eqnarray\e*?\*(C'\fR\ , \f(CW\*(C`MATHREPL\*(C'\fR=\f(CW\*(C`eqnarray\*(C'\fR\ ] -.ie n .IP """ARRENV""" 10 -.el .IP "\f(CWARRENV\fR" 10 -.IX Item "ARRENV" -If a match to \f(CW\*(C`ARRENV\*(C'\fR is found within an inline math environment within a deleted or added block, then the inlined math -is surrounded by \f(CW\*(C`\embox{\*(C'\fR...\f(CW\*(C`}\*(C'\fR. This is necessary as underlining does not work within inlined array environments. -.Sp -[ Default: \f(CW\*(C`ARRENV\*(C'\fR=\f(CW\*(C`(?:array|[pbvBV]matrix)\*(C'\fR\ -.ie n .IP """COUNTERCMD""" 10 -.el .IP "\f(CWCOUNTERCMD\fR" 10 -.IX Item "COUNTERCMD" -If a command in a deleted block which is also in the textcmd list matches \f(CW\*(C`COUNTERCMD\*(C'\fR then an -additional command \f(CW\*(C`\eaddtocounter{\*(C'\fR\fIcntcmd\fR\f(CW\*(C`}{\-1}\*(C'\fR, where \fIcntcmd\fR is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the -numbering in the new file. +.ie n .IP """MINWORDSBLOCK""" 10 +.el .IP "\f(CWMINWORDSBLOCK\fR" 10 +.IX Item "MINWORDSBLOCK" +Minimum number of tokens required to form an independent block. This value is +used in the algorithm to detect changes of complete blocks by merging identical text parts of less than \f(CW\*(C`MINWORDSBLOCK\*(C'\fR to the preceding added and discarded parts. .Sp -[ Default: \f(CW\*(C`COUNTERCMD\*(C'\fR=\f(CW\*(C`(?:footnote|part|section|subsection\*(C'\fR ... +[ Default: 3 ] +.ie n .IP """PICTUREENV""" 10 +.el .IP "\f(CWPICTUREENV\fR" 10 +.IX Item "PICTUREENV" +Within environments whose name matches the regular expression in \f(CW\*(C`PICTUREENV\*(C'\fR +all latexdiff markup is removed (in pathologic cases this might lead to +inconsistent markup but this situation should be rare). .Sp -\&\f(CW\*(C`|subsubsection|paragraph|subparagraph)\*(C'\fR ] +[ Default: \f(CW\*(C`(?:picture|DIFnomarkup)[\ew\ed*@]*\*(C'\fR\ ] .SH "COMMON PROBLEMS AND FAQ" .IX Header "COMMON PROBLEMS AND FAQ" .IP "Citations result in overfull boxes" 10 @@ -762,18 +786,17 @@ For custom packages you can define the commands which need to be protected by \f .IP "Changes in complicated mathematical equations result in latex processing errors" 10 .IX Item "Changes in complicated mathematical equations result in latex processing errors" Try options \f(CW\*(C`\-\-math\-markup=whole\*(C'\fR. If even that fails, you can turn off mark up for equations with \f(CW\*(C`\-\-math\-markup=off\*(C'\fR. -.IP "How can I just show the pages" 10 -.IX Item "How can I just show the pages" +.IP "How can I just show the pages where changes had been made" 10 +.IX Item "How can I just show the pages where changes had been made" Use options \-\f(CW\*(C`\-s ZLABEL\*(C'\fR (some postprocessing required) or \f(CW\*(C`\-s ONLYCHANGEDPAGE\*(C'\fR. \f(CW\*(C`latexdiff\-vc \-\-ps|\-\-pdf\*(C'\fR with \f(CW\*(C`\-\-only\-changes\*(C'\fR option takes care of -the post-processing for you (requires zref packages). +the post-processing for you (requires zref package to be installed). .SH "BUGS" .IX Header "BUGS" -Option allow-spaces not implemented entirely consistently. It breaks -the rules that number and type of white space does not matter, as -different numbers of inter-argument spaces are treated as significant. +.IP "Option allow-spaces not implemented entirely consistently. It breaks the rules that number and type of white space does not matter, as different numbers of inter-argument spaces are treated as significant." 10 +.IX Item "Option allow-spaces not implemented entirely consistently. It breaks the rules that number and type of white space does not matter, as different numbers of inter-argument spaces are treated as significant." .PP Please submit bug reports using the issue tracker of the github repository page \fIhttps://github.com/ftilmann/latexdiff.git\fR, -or send them to \fItilmann \*(-- \s-1AT\s0 \*(-- gfz\-potsdam.de\fR. Include the serial number of \fIlatexdiff\fR +or send them to \fItilmann \*(-- \s-1AT\s0 \*(-- gfz\-potsdam.de\fR. Include the version number of \fIlatexdiff\fR (from comments at the top of the source or use \fB\-\-version\fR). If you come across latex files that are error-free and conform to the specifications set out above, and whose differencing still does not result in error-free @@ -797,7 +820,7 @@ version, \fIlatexdiff-so\fR, which has this package inlined, is available, too. \&\fIlatexdiff-fast\fR requires the \fIdiff\fR command to be present. .SH "AUTHOR" .IX Header "AUTHOR" -Version 1.1.0 +Version 1.1.1 Copyright (C) 2004\-2015 Frederik Tilmann .PP This program is free software; you can redistribute it and/or modify diff --git a/Master/texmf-dist/doc/man/man1/latexdiff.man1.pdf b/Master/texmf-dist/doc/man/man1/latexdiff.man1.pdf Binary files differindex 72318cf6833..29bd56bf6b6 100644 --- a/Master/texmf-dist/doc/man/man1/latexdiff.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/latexdiff.man1.pdf diff --git a/Master/texmf-dist/doc/man/man1/latexrevise.1 b/Master/texmf-dist/doc/man/man1/latexrevise.1 index 259bbc29eea..cdb1aab46c8 100644 --- a/Master/texmf-dist/doc/man/man1/latexrevise.1 +++ b/Master/texmf-dist/doc/man/man1/latexrevise.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -38,6 +38,8 @@ . ds PI \(*p . ds L" `` . ds R" '' +. ds C` +. ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. @@ -48,17 +50,24 @@ .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. -.ie \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" Avoid warning from groff about undefined register 'F'. +.de IX .. -. nr % 0 -. rr F -.\} -.el \{\ -. de IX +.nr rF 0 +.if \n(.g .if rF .nr rF 1 +.if (\n(rF:(\n(.g==0)) \{ +. if \nF \{ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. +. if !\nF==2 \{ +. nr % 0 +. nr F 2 +. \} +. \} .\} +.rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. @@ -124,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXREVISE 1" -.TH LATEXREVISE 1 "2015-04-14" "perl v5.14.2" " " +.TH LATEXREVISE 1 "2015-04-14" "perl v5.18.2" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/Master/texmf-dist/doc/man/man1/latexrevise.man1.pdf b/Master/texmf-dist/doc/man/man1/latexrevise.man1.pdf Binary files differindex 19a4aa582f9..4f6e01660d5 100644 --- a/Master/texmf-dist/doc/man/man1/latexrevise.man1.pdf +++ b/Master/texmf-dist/doc/man/man1/latexrevise.man1.pdf diff --git a/Master/texmf-dist/doc/support/latexdiff/README b/Master/texmf-dist/doc/support/latexdiff/README index 911b585deec..428564ad23f 100644 --- a/Master/texmf-dist/doc/support/latexdiff/README +++ b/Master/texmf-dist/doc/support/latexdiff/README @@ -94,6 +94,14 @@ latexchanges (Author: Jan-Ake Larsson) Wrapper script for applying latexdiff wit Contributions by the following authors were incorporated into the latexdiff code, or inspired me to extend latexdiff in a similar way: J. Paisley, N. Becker, K. Huebner +EXTERNAL LATEXDIFF SUPPORT PROGRAMS + +LATEXDIFFCITE (Author: Christer van der Meeren) is a wrapper around latexdiff to make citations diff properly. It works by expanding \cite type commands using the bbl or bib file, such that citations are treated just like normal text rather than as atomic in the plain latexdiff. +https://latexdiffcite.readthedocs.org + +GIT-LATEXDIFF (lead author: Matthieu Moy) is a wrapper (bash scipt) around latexdiff that allows using it to diff two revisions of a LaTeX file under git revision control (similar functionality is provided by latexdiff-vc --git with --flatten option included with this distribution but git-latexdiff allows more fine-grained control on (not to be confused with latexdiff-git, which is normally installed as a soft link to latexdiff-vc) +https://gitorious.org/git-latexdiff/ + LICENSE (also see file COPYING) This program is free software; you can redistribute it and/or modify diff --git a/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.pdf b/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.pdf Binary files differindex f30d1869c86..7372b551dd5 100644 --- a/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.pdf +++ b/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.pdf diff --git a/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.tex b/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.tex index 2adffccd99a..1059eb25a3f 100644 --- a/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.tex +++ b/Master/texmf-dist/doc/support/latexdiff/doc/latexdiff-man.tex @@ -316,7 +316,7 @@ to make the markup visible. This is what it looks like: If you approve of all the changes in the revision, just continue with \verb|example-rev.tex| for the next revision. If you like to adopt most but not all changes you can use \verb|latexrevise| in the -following manner. Simply remove the \verb|\DIFdelbegin| and +following manner. Simply edit \verb|example-diff.tex| to remove the \verb|\DIFdelbegin| and \verb|\DIFdelend| tags around the text you would like to keep and simply remove the text between \verb|\DIFaddbegin| and \verb|\DIFaddend| tags, if you do not wish to keep them. Say you are happy with all proposed changes for the @@ -348,8 +348,20 @@ are identical}. } and run \begin{verbatim} -latexrevise -a example-rev.tex > example-final.tex +latexrevise -a example-diff.tex > example-final.tex \end{verbatim} \verb|example-final.tex| is then almost identical to \verb|example-rev.tex| except for the last paragraph. + +\section*{External tools} +The following is an incomplete list of wrappers written by others providing some added functionality. These are not included with the distribution but need to be downloaded and installed separately. + +\begin{description} + \item[latexdiffcite] (Author: Christer van der Meeren) is a wrapper around latexdiff to make citations diff properly. It works by expanding \verb|\cite| type commands using the bbl or bib file, such that citations are treated just like normal text rather than as atomic in the plain latexdiff. \\ +\verb|https://latexdiffcite.readthedocs.org| +\item[git-latexdiff] (lead author: Matthieu Moy) is a wrapper (bash scipt) around latexdiff that allows using it to diff two revisions of a LaTeX file under git revision control Similar functionality is provided by \verb|latexdiff-vc --git| with \verb|--flatten| option included with this distribution but git-latexdiff allows more fine-grained control on varous aspects. (Not to be confused with latexdiff-git, which is normally installed as a soft link to latexdiff-vc) \\ +\verb|https://gitorious.org/git-latexdiff/| + +\end{description} + \end{document} diff --git a/Master/texmf-dist/doc/support/latexdiff/latexdiff b/Master/texmf-dist/doc/support/latexdiff/latexdiff index bb75ce4ac85..864b74eb167 100755 --- a/Master/texmf-dist/doc/support/latexdiff/latexdiff +++ b/Master/texmf-dist/doc/support/latexdiff/latexdiff @@ -23,7 +23,14 @@ # Detailed usage information at the end of the file # # ToDo: -# DONE +# +# Version 1.1.1 +# - patch mhchem: allow ce in equations +# - flatten now also expands \input etc. in the preamble (but not \usepackage!) +# - Better support for Japanese ( contributed by github user kshramt ) +# - prevent duplicated verbatim hashes (patch contributed by github user therussianjig, issue #36) +# - disable deleted label commands (fixes issue #31) +# - introduce post-processing to reinstate most deleted environments and all needed item commands (fixes issue #1) # # Version 1.1.0 # - treat diacritics (\",\', etc) as safe commands @@ -125,7 +132,7 @@ my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.1.0 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) +This is LATEXDIFF 1.1.1 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) (c) 2004-2015 F J Tilmann EOF @@ -138,16 +145,19 @@ my $MATHENV='(?:equation[*]?|displaymath|DOLLARDOLLAR)[*]?' ; # Enviro my $MATHREPL='displaymath'; # Environment introducing deleted maths blocks my $MATHARRENV='(?:eqnarray|align|alignat|gather|multline|flalign)[*]?' ; # Environments turning on eqnarray math mode my $MATHARRREPL='eqnarray*'; # Environment introducing deleted maths blocks -my $ARRENV='(?:array|[pbvBV]?matrix|smallmatrix|cases|split)'; # Environments making arrays in math mode. The underlining style does not cope well with those - as a result in-text math environments are surrounded by \mbox{ } if any of these commands is used in an inline math block +my $ARRENV='(?:aligned|array|[pbvBV]?matrix|smallmatrix|cases|split)'; # Environments making arrays in math mode. The underlining style does not cope well with those - as a result in-text math environments are surrounded by \mbox{ } if any of these commands is used in an inline math block my $COUNTERCMD='(?:footnote|part|chapter|section|subsection|subsubsection|paragraph|subparagraph)'; # textcmds which are associated with a counter # If any of these commands occur in a deleted block # they will be succeeded by an \addtocounter{...}{-1} # for the associated counter such that the overall numbers # should be the same as in the new file -my @UNSAFEMATHCMD=('qedhere'); # Commands which are definitely unsafe for marking up (amsmath qedhere only tested to not work with UNDERLINE markup) +my $LABELCMD='(?:label)'; # matching commands are disabled within deleted blocks - mostly useful for maths mode, as otherwise it would be fine to just not add those to SAFECMDLIST +my @UNSAFEMATHCMD=('qedhere'); # Commands which are definitely unsafe for marking up in math mode (amsmath qedhere only tested to not work with UNDERLINE markup) (only affects WHOLE and COARSE math markup modes). Note that unlike text mode (or FINE math mode0 deleted unsafe commands are not deleted but simply taken outside \DIFdel my $MBOXINLINEMATH=0; # if set to 1 then surround marked-up inline maths expression with \mbox ( to get around compatibility # problems between some maths packages and ulem package +my $LISTENV='(?:itemize|description|enumerate)'; # list making environments - they will generally be kept +my $ITEMCMD='item'; # Markup strings # If at all possible, do not change these as parts of the program @@ -431,6 +441,8 @@ foreach $assign ( @config ) { $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; if ( $1 eq "MINWORDSBLOCK" ) { $MINWORDSBLOCK = $2; } elsif ( $1 eq "FLOATENV" ) { $FLOATENV = $2 ; } + elsif ( $1 eq "ITEMCMD" ) { $ITEMCMD = $2 ; } + elsif ( $1 eq "LISTENV" ) { $LISTENV = $2 ; } elsif ( $1 eq "PICTUREENV" ) { $PICTUREENV = $2 ; } elsif ( $1 eq "MATHENV" ) { $MATHENV = $2 ; } elsif ( $1 eq "MATHREPL" ) { $MATHREPL = $2 ; } @@ -477,15 +489,17 @@ if ($showtext) { if ($showconfig) { print "Configuration variables:\n"; - print "MINWORDSBLOCK=$MINWORDSBLOCK\n"; + print "ARRENV=$ARRENV\n"; + print "COUNTERCMD=$COUNTERCMD\n"; print "FLOATENV=$FLOATENV\n"; - print "PICTUREENV=$PICTUREENV\n"; - print "MATHENV=$MATHENV\n"; - print "MATHREPL=$MATHREPL\n"; + print "ITEMCMD=$ITEMCMD\n"; + print "LISTENV=$LISTENV\n"; print "MATHARRENV=$MATHARRENV\n"; print "MATHARRREPL=$MATHARRREPL\n"; - print "ARRENV=$ARRENV\n"; - print "COUNTERCMD=$COUNTERCMD\n"; + print "MATHENV=$MATHENV\n"; + print "MATHREPL=$MATHREPL\n"; + print "MINWORDSBLOCK=$MINWORDSBLOCK\n"; + print "PICTUREENV=$PICTUREENV\n"; } if ($showconfig || $showtext || $showsafe || $showpreamble) { exit 0; } @@ -514,13 +528,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # Patterns. These are used by some of the subroutines, too # I can only define them down here because value of extraspace depends on an option + my $pat0 = '(?:[^{}])*'; - my $pat1 = '(?:[^{}]|\{'.$pat0.'\})*'; - my $pat2 = '(?:[^{}]|\{'.$pat1.'\})*'; - my $pat3 = '(?:[^{}]|\{'.$pat2.'\})*'; - my $pat4 = '(?:[^{}]|\{'.$pat3.'\})*'; - my $pat5 = '(?:[^{}]|\{'.$pat4.'\})*'; - my $pat6 = '(?:[^{}]|\{'.$pat5.'\})*'; + my $pat_n = $pat0; +# if you get "undefined control sequence MATHBLOCKmath" error, increase the maximum value in this loop + for (my $i_pat = 0; $i_pat < 20; ++$i_pat){ + $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; + } + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $abrat0 = '(?:[^<>])*'; @@ -534,11 +549,12 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # such that a\_b is interpreted as a{\_}b by latex but a{\_b} by perl my $quotedunderscore='\\\\_'; # word: sequence of letters or accents followed by letter - my $word='(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])+'; + my $word_ja='\p{Han}+|\p{InHiragana}+|\p{InKatakana}+'; + my $word='(?:' . $word_ja . '|(?:(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])(?!(?:' . $word_ja . ')))+)'; my $cmdleftright='\\\\(?:left|right|[Bb]igg?[lrm]?|middle)\s*(?:[<>()\[\]|]|\\\\(?:[|{}]|\w+))'; - my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat6 . '\}|\(' . $coords .'\))'.$extraspace.')*'; + my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat_n . '\}|\(' . $coords .'\))'.$extraspace.')*'; my $backslashnl='\\\\\n'; - my $oneletcmd='\\\\.\*?(?:\['.$brat0.'\]|\{'. $pat6 . '\})*'; + my $oneletcmd='\\\\.\*?(?:\['.$brat0.'\]|\{'. $pat_n . '\})*'; my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ## the current maths command cannot cope with newline within the math expression my $comment='%.*?\n'; @@ -548,10 +564,10 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { - die "Input file $oldfile does not exist."; + die "Input file $oldfile does not exist"; } if ( ! -e $newfile ) { - die "Input file $newfile does not exist."; + die "Input file $newfile does not exist"; } @@ -595,6 +611,10 @@ exetime(1); if ($flatten) { $oldbody=flatten($oldbody,$oldpreamble,$oldfile,$encoding); $newbody=flatten($newbody,$newpreamble,$newfile,$encoding); + # flatten preamble + $oldpreamble=flatten($oldpreamble,$oldpreamble,$oldfile,$encoding); + $newpreamble=flatten($newpreamble,$newpreamble,$newfile,$encoding); + } @@ -722,7 +742,7 @@ if (defined $packages{"glossaries"} ) { } } -if (defined $packages{"chemformula"} ) { +if (defined $packages{"chemformula"} or defined $packages{"chemmacros"} ) { print STDERR "chemformula package detected.\n" if $verbose ; init_regex_arr_ext(\@SAFECMDLIST,'ch'); push(@UNSAFEMATHCMD,'ch'); @@ -734,7 +754,7 @@ if (defined $packages{"chemformula"} ) { if (defined $packages{"mhchem"} ) { print STDERR "mhchem package detected.\n" if $verbose ; init_regex_arr_ext(\@SAFECMDLIST,'ce'); - push(@UNSAFEMATHCMD,'cee'); + push(@UNSAFEMATHCMD,'ce','cee'); # The next command would be needed to allow highlighting the interior of \cee commands in math environments # but the redefinitions in chemformula are too deep to make this viable # push(@MATHTEXTCMDLIST,'cee'); @@ -778,6 +798,11 @@ foreach $mboxcmd ( @MBOXCMDLIST ) { init_regex_arr_ext(\@SAFECMDLIST, $mboxcmd); } +# check if \label is in SAFECMDLIST, and if yes replace "label" in $LABELCMD by something that never matches (we hope!) +if ( iscmd("label",\@SAFECMDLIST,\@SAFECMDEXCL) ) { + $LABELCMD=~ s/label/NEVERMATCHLABEL/; +} + print STDERR "Preprocessing body. " if $verbose; @@ -792,14 +817,14 @@ if ( $debug ) { print RAWDIFF $diffbo; close(RAWDIFF); } -print STDERR "(",exetime()," s)\n","Postprocessing body. \n " if $verbose; +print STDERR "(",exetime()," s)\n","Postprocessing body. \n" if $verbose; postprocess($diffbo); $diffall =join("\n",@diffpreamble) ; # add visible labels if (defined($visiblelabel)) { # Give information right after \begin{document} (or at the beginning of the text for files without preamble ### if \date command is used, add information to \date argument, otherwise give right after \begin{document} - ### $diffall=~s/(\\date$extraspace(?:\[$brat0\])?$extraspace)\{($pat6)\}/$1\{$2 \\ LATEXDIFF comparison \\ Old: $oldlabel \\ New: $newlabel \}/ or + ### $diffall=~s/(\\date$extraspace(?:\[$brat0\])?$extraspace)\{($pat_n)\}/$1\{$2 \\ LATEXDIFF comparison \\ Old: $oldlabel \\ New: $newlabel \}/ or $diffbo = "\\begin{verbatim}LATEXDIFF comparison\nOld: $oldlabel\nNew: $newlabel\\end{verbatim}\n$diffbo" ; } @@ -890,18 +915,24 @@ sub read_file_with_encoding { # %packages=list_packages($preamble) # scans the arguments for \documentclass,\RequirePackage and \usepackage statements and constructs a hash # whose keys are the included packages, and whose values are the associated optional arguments +# if argument of \usepackage or \RequirePackage is comma separated list, treat as different packages sub list_packages { my ($preamble)=@_; my %packages=(); + my $pkg; # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat0)\])?\{(.*?)\}/gs ) { if (defined($1)) { - $packages{$2}=$1; + foreach $pkg ( split /,/,$2 ) { + $packages{$pkg}=$1; + } } else { - $packages{$2}=""; + foreach $pkg ( split /,/,$2 ) { + $packages{$pkg}=""; + } } } return (%packages); @@ -932,7 +963,7 @@ sub add_safe_commands { } } - while ( $preamble =~ m/\\(?:new|renew|provide)command\s*{\\(\w*)\}(?:|\[\d*\])\s*\{(${pat6})\}/osg ) { + while ( $preamble =~ m/\\(?:new|renew|provide)command\s*{\\(\w*)\}(?:|\[\d*\])\s*\{(${pat_n})\}/osg ) { my $maybe_to_test = $1; my $should_be_safe = $2; my $success = 0; @@ -986,7 +1017,7 @@ sub flatten { print STDERR "DEBUG: includeonly $includeonly\n" if $debug; # recursively replace \\input and \\include files - $text=~s/(^(?:[^%\n]|\\%)*)\\input{(.*?)}|\\include{(${includeonly}(?:\.tex)?)}/{ + 1 while $text=~s/(^(?:[^%\n]|\\%)*)\\input{(.*?)}|\\include{(${includeonly}(?:\.tex)?)}/{ $begline=(defined($1)? $1 : "") ; $fname = $2 if defined($2) ; $fname = $3 if defined($3) ; @@ -1267,7 +1298,7 @@ sub pass1 { # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat0\]|\{$pat6\})*)/o + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat0\]|\{$pat_n\})*)/o && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { @@ -1399,7 +1430,7 @@ sub extracttextblocks { for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat6\})*)/o + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat_n\})*)/o && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text @@ -1453,7 +1484,7 @@ sub extractcommands { # $2: \cmd # $3: last argument # $4: } + trailing spaces - if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat6\})*${extraspace}\{)($pat6)(\}\s*)$/so ) + if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; @@ -1605,8 +1636,8 @@ sub marktags { # $2: cmd # $3: last argument # $4: } + trailing spaces - ### pre-0.3 if ( ( $token =~ m/^(\\([\w\d\*]+)(?:\[$brat0\]|\{$pat6\})*\{)($pat6)(\}\s*)$/so ) - if ( ( $word =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat6\})*${extraspace}\{)($pat6)(\}\s*)$/so ) + ### pre-0.3 if ( ( $token =~ m/^(\\([\w\d\*]+)(?:\[$brat0\]|\{$pat_n\})*\{)($pat_n)(\}\s*)$/so ) + if ( ( $word =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && (iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL)|| iscmd($2,\@MATHTEXTCMDLIST,\@MATHTEXTCMDEXCL)) && ( !$cmdcomment || !iscmd($2,\@CONTEXT2CMDLIST, \@CONTEXT2CMDEXCL) ) ) { # Condition 1: word is a command? - if yes, $1,$2,.. will be set as above @@ -1640,7 +1671,6 @@ sub marktags { # "" local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); - ### print STDERR "DEBUG: Command $command argtext ",join(",",@argtext),"\n" if $debug; push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { @@ -1654,6 +1684,7 @@ sub marktags { push (@$retval,$opencmd) if $cmd==-1 ; push (@$retval,$close,$opencmd) if $cmd==0 ; $word =~ s/\n/\n${opencmd}/sg if $cmdcomment ; # if opencmd is a comment, repeat this at the beginning of every line + ### print STDERR "MARKTAGS: Add command |$word|\n"; push (@$retval,$word); $cmd=1; } @@ -1670,7 +1701,7 @@ sub marktags { ###print STDERR "DEBUG Mboxsafecmd detected:$word:\n" if $debug ; push(@$retval,"\\mbox{$AUXCMD\n\\" . $1 . $2 . $3 ."}$AUXCMD\n" ); } else { - # $word is a normal word or a safe command (not in MBOXCMDLIST + # $word is a normal word or a safe command (not in MBOXCMDLIST) push (@$retval,$word); } $cmd=0; @@ -1683,6 +1714,53 @@ sub marktags { return @$retval; } +#used in preprocess +sub take_comments_and_enter_from_frac() { + ###*************take the \n and % between frac and {}*********** + ###notice all of the substitution are made none global + while( m/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/s ) { + ### if there isn't any % or \n in the pattern $2 then there should be an \\end{...} in $2 + if( $2 !~ m/\\end{$1}/s ) { + ### take out % and \n from the next match only (none global) + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/\\begin{$1}$2\\frac{$5\\end{$1}/s; + } + else{ + ###there are no more % and \n in $2, we want to find the next one so we clear the begin-end from the pattern + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s; + } + } + ###cleaning up + while( s/MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)(.*?)MATHBLOCKEND/\\begin{$1}$2\\end{$1}/s ){} + ###*************take the \n and % between frac and {}*********** + + ###**********take the \n and % between {} and {} of the frac*************** + while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\frac\{(.*?)\\end\{\1\}/s ) { + ### if there isn't any more //frac before the first //end in the pattern $2 then there should be an \\end{...} in $2 + if( $2 !~ m/\\end\{$1\}/s ) { + ### from now on CURRFRAC is the frac we are looking at + s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\frac\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\\end\{$1\}/s; + while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{(.*?)\\end\{\1\}/s ) { + if( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end{\1}/s ) { + s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\}\{$6\\end\{$1\}/s; + } + else { # there is no comment or \n between the two brackets {}{} + ### change CURRFRAC to FRACSTART so we can change them all back to //frac{ when we finish + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)CURRFRAC\{(.*?)\\end{\1}/\\begin{$1}$2FRACSTART\{$3\\end{$1}/s; + } + } + } + else{ + ###there are no more frac in $2, we want to find the next one so we clear the begin-end from the pattern + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s; + } + + } + ###cleaning up + while( s/MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)(.*?)MATHBLOCKEND/\\begin{$1}$2\\end{$1}/s ){} + s/FRACSTART/\\frac/g; + ###***************take the \n and % between {} and {} of the frac********************* +} + # preprocess($string, ..) # carry out the following pre-processing steps for all arguments: # 1. Remove leading white-space @@ -1708,7 +1786,7 @@ sub marktags { # Returns: leading white space removed in step 1 sub preprocess { for (@_) { - # Change \{ to \QLEFTBRACE and \} to \QRIGHTBRACE + # Change \{ to \QLEFTBRACE, \} to \QRIGHTBRACE, and \& to \AMPERSAND s/(?<!\\)\\{/\\QLEFTBRACE /sg; s/(?<!\\)\\}/\\QRIGHTBRACE /sg; s/(?<!\\)\\&/\\AMPERSAND /sg; @@ -1722,11 +1800,14 @@ sub preprocess { s/(\\verb\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg; s/\\begin\{(verbatim\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg; # Convert _n or _\cmd into \SUBSCRIPTNB{n} or \SUBSCRIPTNB{\cmd} and _{nnn} into \SUBSCRIPT{nn} - 1 while s/(?<!\\)_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)_{($pat6)}/\\SUBSCRIPT{$1}/g ; + 1 while s/(?<!\\)_(\s*([^{\\\s]|\\\w+))/\\SUBSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} - 1 while s/(?<!\\)\^([^{\\]|\\\w+)/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^{($pat6)}/\\SUPERSCRIPT{$1}/g ; + 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$1/g ; + # Convert \sqrt{n} into \SQRT{n} and \sqrt nn into SQRTNB{nn} + 1 while s/(?<!\\)\\sqrt(\s*([^{\\\s]|\\\w+))/\\SQRTNB{$1}/g ; + 1 while s/(?<!\\)\\sqrt(\s*{($pat_n)})/\\SQRT$1/g ; # Convert $$ $$ into \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} s/\$\$(.*?)\$\$/\\begin{DOLLARDOLLAR}$1\\end{DOLLARDOLLAR}/sg; # Convert \[ \] into \begin{SQUAREBRACKET} \end{SQUAREBRACKET} @@ -1739,6 +1820,9 @@ sub preprocess { # Also convert all array environments into ARRAYBLOCK environments if ( $mathmarkup != FINE ) { s/\\begin{($ARRENV)}(.*?)\\end{\1}/\\ARRAYBLOCK$1\{$2\}/sg; + + take_comments_and_enter_from_frac(); + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/\\MATHBLOCK$1\{$2\}/sg; } # add final token " STOP" @@ -1756,16 +1840,17 @@ sub tohash { @arr=unpack('c*',$string); - foreach $val (@arr) { - $sum += $i*$val; - $i++; - } - $hstr= "$sum"; - if (defined($hash->{$hstr}) && $string ne $hash->{$hstr}) { - warn "Repeated hash value for verbatim mode in spite of different content."; - $hstr="-$hstr"; + while (1) { + foreach $val (@arr) { + $sum += $i*$val; + $i++; + } + $hstr= "$sum"; + last unless (defined($hash->{$hstr}) && $string ne $hash->{$hstr}); + # else found a duplicate HASH need to repeat for a higher hash value } $hash->{$hstr}=$string; + ### print STDERR "Hash:$hstr: Content:$string:\n"; return($hstr); } @@ -1836,6 +1921,8 @@ sub postprocess { # second level blocks my ($begin2,$cnt2,$len2,$eqarrayblock,$mathblock); + my (@textparts,@newtextparts,@liststack,$listtype,$listlast); + for (@_) { # change $'s in comments to something harmless @@ -1918,14 +2005,25 @@ sub postprocess { # Convert MATHBLOCKmath commands to their uncounted numbers (e.g. convert equation -> displaymath # (environments defined in $MATHENV will be replaced by $MATHREPL, and environments in $MATHARRENV # will be replaced by $MATHARRREPL - $delblock=~ s/\\MATHBLOCK($MATHENV)\{($pat6)\}/\\MATHBLOCK$MATHREPL\{$2\}/sg; - $delblock=~ s/\\MATHBLOCK($MATHARRENV)\{($pat6)\}/\\MATHBLOCK$MATHARRREPL\{$2\}/sg; + $delblock=~ s/\\MATHBLOCK($MATHENV)\{($pat_n)\}/\\MATHBLOCK$MATHREPL\{$2\}/sg; + $delblock=~ s/\\MATHBLOCK($MATHARRENV)\{($pat_n)\}/\\MATHBLOCK$MATHARRREPL\{$2\}/sg; } + # Reinstate completely deleted list environments. note that items within the + # environment will still be commented out. They will be restored later + $delblock=~ s/(\%DIFDELCMD < \s*\\begin\{($LISTENV)\}\s*?(?:\n|$DELCMDCLOSE))(.*?)(\%DIFDELCMD < \s*\\end\{\2\})/{ + ### # block within the search; replacement environment + ### "$1\\begin{$2}$AUXCMD\n". restore_item_commands($3). "\n\\end{$2}$AUXCMD\n$4"; + "$1\\begin{$2}$AUXCMD\n$3\n\\end{$2}$AUXCMD\n$4"; + }/esg; # b.where one of the commands matching $COUNTERCMD is used as a DIFAUXCMD, add a statement # subtracting one from the respective counter to keep numbering consistent with new file - $delblock=~ s/\\($COUNTERCMD)((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat6\})*\s*${AUXCMD}\n)/\\$1$2\\addtocounter{$1}{-1}${AUXCMD}\n/sg ; + $delblock=~ s/\\($COUNTERCMD)((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat_n\})*\s*${AUXCMD}\n)/\\$1$2\\addtocounter{$1}{-1}${AUXCMD}\n/sg ; + +# bb. disable active labels within deleted blocks (as these are not safe commands, this should normally only +# happen within deleted maths blocks + $delblock=~ s/(\\$LABELCMD(?:${extraspace})\{(?:[^{}])*\}[\t ]*)\n?/${DELCMDOPEN}$1${DELCMDCLOSE}/smg ; # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es @@ -1973,6 +2071,36 @@ sub postprocess { pos = $begin + length($addblock); } + # Go through whole text, and by counting list environment commands, find out when we are within a list environment. + # Within those restore deleted \item commands + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; + @liststack=(); + @newtextparts=map { + ### print STDERR ":::::::: $_\n"; + if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { + print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; + push @liststack,$listtype; + } elsif ( ($listtype) = m/^\\end\{($LISTENV)\}$/ ) { + print STDERR "DEBUG: postprocess \\end{$listtype}\n" if $debug; + if (scalar @liststack > 0) { + $listlast=pop(@liststack); + ($listtype eq $listlast) or warn "Invalid nesting of list environments: $listlast environment closed by \\end{$listtype}."; + } else { + warn "Invalid nesting of list environments: \\end{$listtype} encountered without matching \\begin{$listtype}."; + } + } else { + print STDERR "DEBUG: postprocess \@liststack=(",join(",",@liststack),")\n" if $debug; + if (scalar @liststack > 0 ) { + # we are within a list environment and should replace all item commands + $_=restore_item_commands($_); + } + # else: we are outside a list environment and do not need to do anything + } + $_ } @textparts; # end of map command + # replace the main text with the modified version + $_= "@newtextparts"; + + # Replace MATHMODE environments from step 1a above by the correct Math environment @@ -1992,12 +2120,12 @@ sub postprocess { s/\\begin{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end{\1}$AUXCMD\n/$2/sg; } else { # math modes OFF,WHOLE,COARSE: Convert \MATHBLOCKmath{..} commands back to environments - s/\\MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; # convert ARRAYBLOCK.. commands back to environments - s/\\ARRAYBLOCK($ARRENV)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\ARRAYBLOCK($ARRENV)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; } # Convert all PICTUREblock{..} commands back to the appropriate environments - s/\\PICTUREBLOCK($PICTUREENV)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\PICTUREBLOCK($PICTUREENV)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; #0.5: # Remove all mark up within picture environments # while ( m/\\begin\{($PICTUREENV)\}.*?\\end\{\1\}/sg ) { # $cnt=0; @@ -2006,10 +2134,10 @@ sub postprocess { # $float=$&; # $float =~ s/\\DIFaddbegin //g; # $float =~ s/\\DIFaddend //g; -# $float =~ s/\\DIFadd\{($pat6)\}/$1/g; +# $float =~ s/\\DIFadd\{($pat_n)\}/$1/g; # $float =~ s/\\DIFdelbegin //g; # $float =~ s/\\DIFdelend //g; -# $float =~ s/\\DIFdel\{($pat6)\}//g; +# $float =~ s/\\DIFdel\{($pat_n)\}//g; # $float =~ s/$DELCMDOPEN.*//g; # substr($_,$begin,$len)=$float; # pos = $begin + length($float); @@ -2072,11 +2200,15 @@ sub postprocess { # 4. Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ s/\\begin\{DOLLARDOLLAR\}(.*?)\\end\{DOLLARDOLLAR\}/\$\$$1\$\$/sg; # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} - 1 while s/\\SUPERSCRIPT{($pat6)}/^{$1}/g ; - 1 while s/\\SUPERSCRIPTNB{($pat0)}/^$1/g ; + 1 while s/\\SUPERSCRIPT(\s*{($pat_n)})/^$1/g ; + 1 while s/\\SUPERSCRIPTNB{(\s*$pat0)}/^$1/g ; # Convert \SUBSCRIPNB{n} into _n and \SUBCRIPT{nn} into _{nnn} - 1 while s/\\SUBSCRIPT{($pat6)}/_{$1}/g ; - 1 while s/\\SUBSCRIPTNB{($pat0)}/_$1/g ; + 1 while s/\\SUBSCRIPT(\s*{($pat_n)})/_$1/g ; + 1 while s/\\SUBSCRIPTNB{(\s*$pat0)}/_$1/g ; + # Convert \SQRT{n} into \sqrt{n} and \SQRTNB{nn} into \sqrt nn + 1 while s/\\SQRT(\s*{($pat_n)})/\\sqrt$1/g ; + 1 while s/\\SQRTNB{(\s*$pat0)}/\\sqrt$1/g ; + 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -2090,6 +2222,24 @@ sub postprocess { } } +# $out = restore_item_commands($listenviron) +# short helper function for post-process, which restores deleted \item commands in its argument (as DIFAUXCMDs) +sub restore_item_commands { + my ($string)=@_ ; + my ($itemarg,@itemargs); + $string =~ s/(\%DIFDELCMD < \s*(\\$ITEMCMD)((?:<$abrat0>)?)((?:\[$brat0\])?)\s*?(?:\n|$DELCMDCLOSE))/ + # if \item has an []argument, then mark up the argument as deleted) + if (length($4)>0) { + # use substr to exclude square brackets at end points + @itemargs=splitlatex(substr($4,1,length($4)-2)); + $itemarg="[".join("",marktags("","",$DELOPEN,$DELCLOSE,$DELCMDOPEN,$DELCMDCLOSE,$DELCOMMENT,\@itemargs))."]"; + } else { + $itemarg=""; + } + "$1$2$3$itemarg$AUXCMD\n"/sge; + return($string); +} + # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) @@ -2116,7 +2266,7 @@ sub preprocess_preamble { # resue in a more complex regex $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: - $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat0)\])?(?:\{($pat6)\}))/ms; + $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat0)\])?(?:\{($pat_n)\}))/ms; @oldtitlecommands= ( $$oldpreambleref =~ m/$titlecmdpat/g ); @newtitlecommands= ( $$newpreambleref =~ m/$titlecmdpat/g ); @@ -2344,7 +2494,7 @@ format as new.tex but has all changes relative to old.tex marked up or commented --subtype=markstyle -s markstyle Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin) - Available styles: SAFE MARGINAL DVIPSCOL COLOR ZLABEL ONLYCHANGEDPAGE (LABEL)* + Available styles: SAFE MARGIN DVIPSCOL COLOR ZLABEL ONLYCHANGEDPAGE (LABEL)* [ Default: SAFE ] * LABEL subtype is deprecated @@ -2435,15 +2585,17 @@ format as new.tex but has all changes relative to old.tex marked up or commented --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. -c configfile Available variables: - MINWORDSBLOCK (integer) + ARRENV (RegEx) + COUNTERCMD (RegEx) FLOATENV (RegEx) - PICTUREENV (RegEx) - MATHENV (RegEx) - MATHREPL (String) + ITEMCMD (RegEx) + LISTENV (RegEx) MATHARRENV (RegEx) MATHARRREPL (String) - ARRENV (RegEx) - COUNTERCMD (RegEx) + MATHENV (RegEx) + MATHREPL (String) + MINWORDSBLOCK (integer) + PICTUREENV (RegEx) This option can be repeated. @@ -2454,7 +2606,7 @@ format as new.tex but has all changes relative to old.tex marked up or commented Use of the --packages option disables automatic scanning, so if for any reason package specific parsing needs to be switched off, use --packages=none. The following packages trigger special behaviour: - endfloat hyperref amsmath apacite siunitx cleveref glossaries mhchem chemformula + endfloat hyperref amsmath apacite siunitx cleveref glossaries mhchem chemformula/chemmacros [ Default: scan the preamble for \\usepackage commands to determine loaded packages.] @@ -2702,7 +2854,7 @@ B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines C<\DIFaddbegin>, C<\DIFaddend>, C<\DIFdelbegin> and C<\DIFdelend> commands. -Available styles: C<SAFE MARGINAL COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> +Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> [ Default: C<SAFE> ] * Subtype C<LABEL> is deprecated @@ -2793,7 +2945,7 @@ Define most of the glossaries commands as safe, protecting them with \mbox'es wh Treat C<\ce> as a safe command, i.e. it will be highlighted (note that C<\cee> will not be highlighted in equations as this leads to processing errors) -=item C<chemformula> +=item C<chemformula> or C<chemmacros> Treat C<\ch> as a safe command outside equations, i.e. it will be highlighted (note that C<\ch> will not be highlighted in equations as this leads to processing errors) @@ -2894,23 +3046,27 @@ Set configuration variables. The option can be repeated to set different variables (as an alternative to the comma-separated list). Available variables (see below for further explanations): -C<MINWORDSBLOCK> (integer) +C<ARRENV> (RegEx) -C<FLOATENV> (RegEx) +C<COUNTERCMD> (RegEx) -C<PICTUREENV> (RegEx) +C<FLOATENV> (RegEx) -C<MATHENV> (RegEx) +C<ITEMCMD> (RegEx) -C<MATHREPL> (String) +C<LISTENV> (RegEx) C<MATHARRENV> (RegEx) C<MATHARRREPL> (String) -C<ARRENV> (RegEx) +C<MATHENV> (RegEx) -C<COUNTERCMD> (RegEx) +C<MATHREPL> (String) + +C<MINWORDSBLOCK> (integer) + +C<PICTUREENV> (RegEx) =item B<--show-safecmd> @@ -3184,12 +3340,22 @@ Make no difference between the main text and floats. =over 10 -=item C<MINWORDSBLOCK> +=item C<ARRENV> -Minimum number of tokens required to form an independent block. This value is -used in the algorithm to detect changes of complete blocks by merging identical text parts of less than C<MINWORDSBLOCK> to the preceding added and discarded parts. +If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math +is surrounded by C<\mbox{>...C<}>. This is necessary as underlining does not work within inlined array environments. -[ Default: 3 ] +[ Default: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > + +=item C<COUNTERCMD> + +If a command in a deleted block which is also in the textcmd list matches C<COUNTERCMD> then an +additional command C<\addtocounter{>F<cntcmd>C<}{-1}>, where F<cntcmd> is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the +numbering in the new file. + +[ Default: C<COUNTERCMD>=C<(?:footnote|part|section|subsection> ... + +C<|subsubsection|paragraph|subparagraph)> ] =item C<FLOATENV> @@ -3199,18 +3365,21 @@ are replaced by their FL variaties. [ Default: S<C<(?:figure|table|plate)[\w\d*@]*> >] -=item C<PICTUREENV> +=item C<ITEMCMD> -Within environments whose name matches the regular expression in C<PICTUREENV> -all latexdiff markup is removed (in pathologic cases this might lead to - inconsistent markup but this situation should be rare). +Commands representing new item line with list environments. -[ Default: S<C<(?:picture|DIFnomarkup)[\w\d*@]*> >] +[ Default: \C<item> ] + +=item C<LISTENV> + +Environments whose name matches the regular expression in C<LISTENV> are list environments. + +[ Default: S<C<(?:itemize|enumerate|description)> >] =item C<MATHENV>,C<MATHREPL> -If both \begin and \end for a math environment (environment name matching C<MATHENV> -or \[ and \]) +If both \begin and \end for a math environment (environment name matching C<MATHENV> or \[ and \]) are within the same deleted block, they are replaced by a \begin and \end commands for C<MATHREPL> rather than being commented out. @@ -3222,22 +3391,20 @@ as C<MATHENV>,C<MATHREPL> but for equation arrays [ Default: C<MATHARRENV>=S<C<eqnarray\*?> >, C<MATHREPL>=S<C<eqnarray> >] -=item C<ARRENV> - -If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math -is surrounded by C<\mbox{>...C<}>. This is necessary as underlining does not work within inlined array environments. +=item C<MINWORDSBLOCK> -[ Default: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > +Minimum number of tokens required to form an independent block. This value is +used in the algorithm to detect changes of complete blocks by merging identical text parts of less than C<MINWORDSBLOCK> to the preceding added and discarded parts. -=item C<COUNTERCMD> +[ Default: 3 ] -If a command in a deleted block which is also in the textcmd list matches C<COUNTERCMD> then an -additional command C<\addtocounter{>F<cntcmd>C<}{-1}>, where F<cntcmd> is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the -numbering in the new file. +=item C<PICTUREENV> -[ Default: C<COUNTERCMD>=C<(?:footnote|part|section|subsection> ... +Within environments whose name matches the regular expression in C<PICTUREENV> +all latexdiff markup is removed (in pathologic cases this might lead to +inconsistent markup but this situation should be rare). -C<|subsubsection|paragraph|subparagraph)> ] +[ Default: S<C<(?:picture|DIFnomarkup)[\w\d*@]*> >] =back @@ -3264,21 +3431,25 @@ For custom packages you can define the commands which need to be protected by C< Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -=item How can I just show the pages +=item How can I just show the pages where changes had been made Use options -C<-s ZLABEL> (some postprocessing required) or C<-s ONLYCHANGEDPAGE>. C<latexdiff-vc --ps|--pdf> with C<--only-changes> option takes care of -the post-processing for you (requires zref packages). +the post-processing for you (requires zref package to be installed). =back =head1 BUGS -Option allow-spaces not implemented entirely consistently. It breaks +=over 10 + +=item Option allow-spaces not implemented entirely consistently. It breaks the rules that number and type of white space does not matter, as different numbers of inter-argument spaces are treated as significant. +=back + Please submit bug reports using the issue tracker of the github repository page I<https://github.com/ftilmann/latexdiff.git>, -or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the serial number of I<latexdiff> +or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the version number of I<latexdiff> (from comments at the top of the source or use B<--version>). If you come across latex files that are error-free and conform to the specifications set out above, and whose differencing still does not result in error-free @@ -3305,7 +3476,7 @@ I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.1.0 +Version 1.1.1 Copyright (C) 2004-2015 Frederik Tilmann This program is free software; you can redistribute it and/or modify @@ -3326,7 +3497,7 @@ dashbox emph fbox framebox -hspace +hspace\*? math.* makebox mbox @@ -3536,6 +3707,8 @@ _ AMPERSAND (SUPER|SUB)SCRIPTNB (SUPER|SUB)SCRIPT +SQRT +SQRTNB PERCENTAGE DOLLAR %%END SAFE COMMANDS diff --git a/Master/texmf-dist/doc/support/latexdiff/latexdiff-fast b/Master/texmf-dist/doc/support/latexdiff/latexdiff-fast index 01638677113..24be387b417 100755 --- a/Master/texmf-dist/doc/support/latexdiff/latexdiff-fast +++ b/Master/texmf-dist/doc/support/latexdiff/latexdiff-fast @@ -23,7 +23,14 @@ # Detailed usage information at the end of the file # # ToDo: -# DONE +# +# Version 1.1.1 +# - patch mhchem: allow ce in equations +# - flatten now also expands \input etc. in the preamble (but not \usepackage!) +# - Better support for Japanese ( contributed by github user kshramt ) +# - prevent duplicated verbatim hashes (patch contributed by github user therussianjig, issue #36) +# - disable deleted label commands (fixes issue #31) +# - introduce post-processing to reinstate most deleted environments and all needed item commands (fixes issue #1) # # Version 1.1.0 # - treat diacritics (\",\', etc) as safe commands @@ -686,7 +693,7 @@ my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.1.0 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) +This is LATEXDIFF 1.1.1 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) (c) 2004-2015 F J Tilmann EOF @@ -699,16 +706,19 @@ my $MATHENV='(?:equation[*]?|displaymath|DOLLARDOLLAR)[*]?' ; # Enviro my $MATHREPL='displaymath'; # Environment introducing deleted maths blocks my $MATHARRENV='(?:eqnarray|align|alignat|gather|multline|flalign)[*]?' ; # Environments turning on eqnarray math mode my $MATHARRREPL='eqnarray*'; # Environment introducing deleted maths blocks -my $ARRENV='(?:array|[pbvBV]?matrix|smallmatrix|cases|split)'; # Environments making arrays in math mode. The underlining style does not cope well with those - as a result in-text math environments are surrounded by \mbox{ } if any of these commands is used in an inline math block +my $ARRENV='(?:aligned|array|[pbvBV]?matrix|smallmatrix|cases|split)'; # Environments making arrays in math mode. The underlining style does not cope well with those - as a result in-text math environments are surrounded by \mbox{ } if any of these commands is used in an inline math block my $COUNTERCMD='(?:footnote|part|chapter|section|subsection|subsubsection|paragraph|subparagraph)'; # textcmds which are associated with a counter # If any of these commands occur in a deleted block # they will be succeeded by an \addtocounter{...}{-1} # for the associated counter such that the overall numbers # should be the same as in the new file -my @UNSAFEMATHCMD=('qedhere'); # Commands which are definitely unsafe for marking up (amsmath qedhere only tested to not work with UNDERLINE markup) +my $LABELCMD='(?:label)'; # matching commands are disabled within deleted blocks - mostly useful for maths mode, as otherwise it would be fine to just not add those to SAFECMDLIST +my @UNSAFEMATHCMD=('qedhere'); # Commands which are definitely unsafe for marking up in math mode (amsmath qedhere only tested to not work with UNDERLINE markup) (only affects WHOLE and COARSE math markup modes). Note that unlike text mode (or FINE math mode0 deleted unsafe commands are not deleted but simply taken outside \DIFdel my $MBOXINLINEMATH=0; # if set to 1 then surround marked-up inline maths expression with \mbox ( to get around compatibility # problems between some maths packages and ulem package +my $LISTENV='(?:itemize|description|enumerate)'; # list making environments - they will generally be kept +my $ITEMCMD='item'; # Markup strings # If at all possible, do not change these as parts of the program @@ -992,6 +1002,8 @@ foreach $assign ( @config ) { $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; if ( $1 eq "MINWORDSBLOCK" ) { $MINWORDSBLOCK = $2; } elsif ( $1 eq "FLOATENV" ) { $FLOATENV = $2 ; } + elsif ( $1 eq "ITEMCMD" ) { $ITEMCMD = $2 ; } + elsif ( $1 eq "LISTENV" ) { $LISTENV = $2 ; } elsif ( $1 eq "PICTUREENV" ) { $PICTUREENV = $2 ; } elsif ( $1 eq "MATHENV" ) { $MATHENV = $2 ; } elsif ( $1 eq "MATHREPL" ) { $MATHREPL = $2 ; } @@ -1038,15 +1050,17 @@ if ($showtext) { if ($showconfig) { print "Configuration variables:\n"; - print "MINWORDSBLOCK=$MINWORDSBLOCK\n"; + print "ARRENV=$ARRENV\n"; + print "COUNTERCMD=$COUNTERCMD\n"; print "FLOATENV=$FLOATENV\n"; - print "PICTUREENV=$PICTUREENV\n"; - print "MATHENV=$MATHENV\n"; - print "MATHREPL=$MATHREPL\n"; + print "ITEMCMD=$ITEMCMD\n"; + print "LISTENV=$LISTENV\n"; print "MATHARRENV=$MATHARRENV\n"; print "MATHARRREPL=$MATHARRREPL\n"; - print "ARRENV=$ARRENV\n"; - print "COUNTERCMD=$COUNTERCMD\n"; + print "MATHENV=$MATHENV\n"; + print "MATHREPL=$MATHREPL\n"; + print "MINWORDSBLOCK=$MINWORDSBLOCK\n"; + print "PICTUREENV=$PICTUREENV\n"; } if ($showconfig || $showtext || $showsafe || $showpreamble) { exit 0; } @@ -1075,13 +1089,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # Patterns. These are used by some of the subroutines, too # I can only define them down here because value of extraspace depends on an option + my $pat0 = '(?:[^{}])*'; - my $pat1 = '(?:[^{}]|\{'.$pat0.'\})*'; - my $pat2 = '(?:[^{}]|\{'.$pat1.'\})*'; - my $pat3 = '(?:[^{}]|\{'.$pat2.'\})*'; - my $pat4 = '(?:[^{}]|\{'.$pat3.'\})*'; - my $pat5 = '(?:[^{}]|\{'.$pat4.'\})*'; - my $pat6 = '(?:[^{}]|\{'.$pat5.'\})*'; + my $pat_n = $pat0; +# if you get "undefined control sequence MATHBLOCKmath" error, increase the maximum value in this loop + for (my $i_pat = 0; $i_pat < 20; ++$i_pat){ + $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; + } + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $abrat0 = '(?:[^<>])*'; @@ -1095,11 +1110,12 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # such that a\_b is interpreted as a{\_}b by latex but a{\_b} by perl my $quotedunderscore='\\\\_'; # word: sequence of letters or accents followed by letter - my $word='(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])+'; + my $word_ja='\p{Han}+|\p{InHiragana}+|\p{InKatakana}+'; + my $word='(?:' . $word_ja . '|(?:(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])(?!(?:' . $word_ja . ')))+)'; my $cmdleftright='\\\\(?:left|right|[Bb]igg?[lrm]?|middle)\s*(?:[<>()\[\]|]|\\\\(?:[|{}]|\w+))'; - my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat6 . '\}|\(' . $coords .'\))'.$extraspace.')*'; + my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:<'.$abrat0.'>|\['.$brat0.'\]|\{'. $pat_n . '\}|\(' . $coords .'\))'.$extraspace.')*'; my $backslashnl='\\\\\n'; - my $oneletcmd='\\\\.\*?(?:\['.$brat0.'\]|\{'. $pat6 . '\})*'; + my $oneletcmd='\\\\.\*?(?:\['.$brat0.'\]|\{'. $pat_n . '\})*'; my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ## the current maths command cannot cope with newline within the math expression my $comment='%.*?\n'; @@ -1109,10 +1125,10 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { - die "Input file $oldfile does not exist."; + die "Input file $oldfile does not exist"; } if ( ! -e $newfile ) { - die "Input file $newfile does not exist."; + die "Input file $newfile does not exist"; } @@ -1156,6 +1172,10 @@ exetime(1); if ($flatten) { $oldbody=flatten($oldbody,$oldpreamble,$oldfile,$encoding); $newbody=flatten($newbody,$newpreamble,$newfile,$encoding); + # flatten preamble + $oldpreamble=flatten($oldpreamble,$oldpreamble,$oldfile,$encoding); + $newpreamble=flatten($newpreamble,$newpreamble,$newfile,$encoding); + } @@ -1283,7 +1303,7 @@ if (defined $packages{"glossaries"} ) { } } -if (defined $packages{"chemformula"} ) { +if (defined $packages{"chemformula"} or defined $packages{"chemmacros"} ) { print STDERR "chemformula package detected.\n" if $verbose ; init_regex_arr_ext(\@SAFECMDLIST,'ch'); push(@UNSAFEMATHCMD,'ch'); @@ -1295,7 +1315,7 @@ if (defined $packages{"chemformula"} ) { if (defined $packages{"mhchem"} ) { print STDERR "mhchem package detected.\n" if $verbose ; init_regex_arr_ext(\@SAFECMDLIST,'ce'); - push(@UNSAFEMATHCMD,'cee'); + push(@UNSAFEMATHCMD,'ce','cee'); # The next command would be needed to allow highlighting the interior of \cee commands in math environments # but the redefinitions in chemformula are too deep to make this viable # push(@MATHTEXTCMDLIST,'cee'); @@ -1339,6 +1359,11 @@ foreach $mboxcmd ( @MBOXCMDLIST ) { init_regex_arr_ext(\@SAFECMDLIST, $mboxcmd); } +# check if \label is in SAFECMDLIST, and if yes replace "label" in $LABELCMD by something that never matches (we hope!) +if ( iscmd("label",\@SAFECMDLIST,\@SAFECMDEXCL) ) { + $LABELCMD=~ s/label/NEVERMATCHLABEL/; +} + print STDERR "Preprocessing body. " if $verbose; @@ -1353,14 +1378,14 @@ if ( $debug ) { print RAWDIFF $diffbo; close(RAWDIFF); } -print STDERR "(",exetime()," s)\n","Postprocessing body. \n " if $verbose; +print STDERR "(",exetime()," s)\n","Postprocessing body. \n" if $verbose; postprocess($diffbo); $diffall =join("\n",@diffpreamble) ; # add visible labels if (defined($visiblelabel)) { # Give information right after \begin{document} (or at the beginning of the text for files without preamble ### if \date command is used, add information to \date argument, otherwise give right after \begin{document} - ### $diffall=~s/(\\date$extraspace(?:\[$brat0\])?$extraspace)\{($pat6)\}/$1\{$2 \\ LATEXDIFF comparison \\ Old: $oldlabel \\ New: $newlabel \}/ or + ### $diffall=~s/(\\date$extraspace(?:\[$brat0\])?$extraspace)\{($pat_n)\}/$1\{$2 \\ LATEXDIFF comparison \\ Old: $oldlabel \\ New: $newlabel \}/ or $diffbo = "\\begin{verbatim}LATEXDIFF comparison\nOld: $oldlabel\nNew: $newlabel\\end{verbatim}\n$diffbo" ; } @@ -1451,18 +1476,24 @@ sub read_file_with_encoding { # %packages=list_packages($preamble) # scans the arguments for \documentclass,\RequirePackage and \usepackage statements and constructs a hash # whose keys are the included packages, and whose values are the associated optional arguments +# if argument of \usepackage or \RequirePackage is comma separated list, treat as different packages sub list_packages { my ($preamble)=@_; my %packages=(); + my $pkg; # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat0)\])?\{(.*?)\}/gs ) { if (defined($1)) { - $packages{$2}=$1; + foreach $pkg ( split /,/,$2 ) { + $packages{$pkg}=$1; + } } else { - $packages{$2}=""; + foreach $pkg ( split /,/,$2 ) { + $packages{$pkg}=""; + } } } return (%packages); @@ -1493,7 +1524,7 @@ sub add_safe_commands { } } - while ( $preamble =~ m/\\(?:new|renew|provide)command\s*{\\(\w*)\}(?:|\[\d*\])\s*\{(${pat6})\}/osg ) { + while ( $preamble =~ m/\\(?:new|renew|provide)command\s*{\\(\w*)\}(?:|\[\d*\])\s*\{(${pat_n})\}/osg ) { my $maybe_to_test = $1; my $should_be_safe = $2; my $success = 0; @@ -1547,7 +1578,7 @@ sub flatten { print STDERR "DEBUG: includeonly $includeonly\n" if $debug; # recursively replace \\input and \\include files - $text=~s/(^(?:[^%\n]|\\%)*)\\input{(.*?)}|\\include{(${includeonly}(?:\.tex)?)}/{ + 1 while $text=~s/(^(?:[^%\n]|\\%)*)\\input{(.*?)}|\\include{(${includeonly}(?:\.tex)?)}/{ $begline=(defined($1)? $1 : "") ; $fname = $2 if defined($2) ; $fname = $3 if defined($3) ; @@ -1828,7 +1859,7 @@ sub pass1 { # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat0\]|\{$pat6\})*)/o + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat0\]|\{$pat_n\})*)/o && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { @@ -1960,7 +1991,7 @@ sub extracttextblocks { for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat6\})*)/o + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat_n\})*)/o && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text @@ -2014,7 +2045,7 @@ sub extractcommands { # $2: \cmd # $3: last argument # $4: } + trailing spaces - if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat6\})*${extraspace}\{)($pat6)(\}\s*)$/so ) + if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; @@ -2166,8 +2197,8 @@ sub marktags { # $2: cmd # $3: last argument # $4: } + trailing spaces - ### pre-0.3 if ( ( $token =~ m/^(\\([\w\d\*]+)(?:\[$brat0\]|\{$pat6\})*\{)($pat6)(\}\s*)$/so ) - if ( ( $word =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat6\})*${extraspace}\{)($pat6)(\}\s*)$/so ) + ### pre-0.3 if ( ( $token =~ m/^(\\([\w\d\*]+)(?:\[$brat0\]|\{$pat_n\})*\{)($pat_n)(\}\s*)$/so ) + if ( ( $word =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat0\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && (iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL)|| iscmd($2,\@MATHTEXTCMDLIST,\@MATHTEXTCMDEXCL)) && ( !$cmdcomment || !iscmd($2,\@CONTEXT2CMDLIST, \@CONTEXT2CMDEXCL) ) ) { # Condition 1: word is a command? - if yes, $1,$2,.. will be set as above @@ -2201,7 +2232,6 @@ sub marktags { # "" local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); - ### print STDERR "DEBUG: Command $command argtext ",join(",",@argtext),"\n" if $debug; push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { @@ -2215,6 +2245,7 @@ sub marktags { push (@$retval,$opencmd) if $cmd==-1 ; push (@$retval,$close,$opencmd) if $cmd==0 ; $word =~ s/\n/\n${opencmd}/sg if $cmdcomment ; # if opencmd is a comment, repeat this at the beginning of every line + ### print STDERR "MARKTAGS: Add command |$word|\n"; push (@$retval,$word); $cmd=1; } @@ -2231,7 +2262,7 @@ sub marktags { ###print STDERR "DEBUG Mboxsafecmd detected:$word:\n" if $debug ; push(@$retval,"\\mbox{$AUXCMD\n\\" . $1 . $2 . $3 ."}$AUXCMD\n" ); } else { - # $word is a normal word or a safe command (not in MBOXCMDLIST + # $word is a normal word or a safe command (not in MBOXCMDLIST) push (@$retval,$word); } $cmd=0; @@ -2244,6 +2275,53 @@ sub marktags { return @$retval; } +#used in preprocess +sub take_comments_and_enter_from_frac() { + ###*************take the \n and % between frac and {}*********** + ###notice all of the substitution are made none global + while( m/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/s ) { + ### if there isn't any % or \n in the pattern $2 then there should be an \\end{...} in $2 + if( $2 !~ m/\\end{$1}/s ) { + ### take out % and \n from the next match only (none global) + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/\\begin{$1}$2\\frac{$5\\end{$1}/s; + } + else{ + ###there are no more % and \n in $2, we want to find the next one so we clear the begin-end from the pattern + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s; + } + } + ###cleaning up + while( s/MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)(.*?)MATHBLOCKEND/\\begin{$1}$2\\end{$1}/s ){} + ###*************take the \n and % between frac and {}*********** + + ###**********take the \n and % between {} and {} of the frac*************** + while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\frac\{(.*?)\\end\{\1\}/s ) { + ### if there isn't any more //frac before the first //end in the pattern $2 then there should be an \\end{...} in $2 + if( $2 !~ m/\\end\{$1\}/s ) { + ### from now on CURRFRAC is the frac we are looking at + s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\frac\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\\end\{$1\}/s; + while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{(.*?)\\end\{\1\}/s ) { + if( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end{\1}/s ) { + s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\}\{$6\\end\{$1\}/s; + } + else { # there is no comment or \n between the two brackets {}{} + ### change CURRFRAC to FRACSTART so we can change them all back to //frac{ when we finish + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)CURRFRAC\{(.*?)\\end{\1}/\\begin{$1}$2FRACSTART\{$3\\end{$1}/s; + } + } + } + else{ + ###there are no more frac in $2, we want to find the next one so we clear the begin-end from the pattern + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s; + } + + } + ###cleaning up + while( s/MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)(.*?)MATHBLOCKEND/\\begin{$1}$2\\end{$1}/s ){} + s/FRACSTART/\\frac/g; + ###***************take the \n and % between {} and {} of the frac********************* +} + # preprocess($string, ..) # carry out the following pre-processing steps for all arguments: # 1. Remove leading white-space @@ -2269,7 +2347,7 @@ sub marktags { # Returns: leading white space removed in step 1 sub preprocess { for (@_) { - # Change \{ to \QLEFTBRACE and \} to \QRIGHTBRACE + # Change \{ to \QLEFTBRACE, \} to \QRIGHTBRACE, and \& to \AMPERSAND s/(?<!\\)\\{/\\QLEFTBRACE /sg; s/(?<!\\)\\}/\\QRIGHTBRACE /sg; s/(?<!\\)\\&/\\AMPERSAND /sg; @@ -2283,11 +2361,14 @@ sub preprocess { s/(\\verb\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg; s/\\begin\{(verbatim\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg; # Convert _n or _\cmd into \SUBSCRIPTNB{n} or \SUBSCRIPTNB{\cmd} and _{nnn} into \SUBSCRIPT{nn} - 1 while s/(?<!\\)_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)_{($pat6)}/\\SUBSCRIPT{$1}/g ; + 1 while s/(?<!\\)_(\s*([^{\\\s]|\\\w+))/\\SUBSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} - 1 while s/(?<!\\)\^([^{\\]|\\\w+)/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^{($pat6)}/\\SUPERSCRIPT{$1}/g ; + 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$1/g ; + # Convert \sqrt{n} into \SQRT{n} and \sqrt nn into SQRTNB{nn} + 1 while s/(?<!\\)\\sqrt(\s*([^{\\\s]|\\\w+))/\\SQRTNB{$1}/g ; + 1 while s/(?<!\\)\\sqrt(\s*{($pat_n)})/\\SQRT$1/g ; # Convert $$ $$ into \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} s/\$\$(.*?)\$\$/\\begin{DOLLARDOLLAR}$1\\end{DOLLARDOLLAR}/sg; # Convert \[ \] into \begin{SQUAREBRACKET} \end{SQUAREBRACKET} @@ -2300,6 +2381,9 @@ sub preprocess { # Also convert all array environments into ARRAYBLOCK environments if ( $mathmarkup != FINE ) { s/\\begin{($ARRENV)}(.*?)\\end{\1}/\\ARRAYBLOCK$1\{$2\}/sg; + + take_comments_and_enter_from_frac(); + s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/\\MATHBLOCK$1\{$2\}/sg; } # add final token " STOP" @@ -2317,16 +2401,17 @@ sub tohash { @arr=unpack('c*',$string); - foreach $val (@arr) { - $sum += $i*$val; - $i++; - } - $hstr= "$sum"; - if (defined($hash->{$hstr}) && $string ne $hash->{$hstr}) { - warn "Repeated hash value for verbatim mode in spite of different content."; - $hstr="-$hstr"; + while (1) { + foreach $val (@arr) { + $sum += $i*$val; + $i++; + } + $hstr= "$sum"; + last unless (defined($hash->{$hstr}) && $string ne $hash->{$hstr}); + # else found a duplicate HASH need to repeat for a higher hash value } $hash->{$hstr}=$string; + ### print STDERR "Hash:$hstr: Content:$string:\n"; return($hstr); } @@ -2397,6 +2482,8 @@ sub postprocess { # second level blocks my ($begin2,$cnt2,$len2,$eqarrayblock,$mathblock); + my (@textparts,@newtextparts,@liststack,$listtype,$listlast); + for (@_) { # change $'s in comments to something harmless @@ -2479,14 +2566,25 @@ sub postprocess { # Convert MATHBLOCKmath commands to their uncounted numbers (e.g. convert equation -> displaymath # (environments defined in $MATHENV will be replaced by $MATHREPL, and environments in $MATHARRENV # will be replaced by $MATHARRREPL - $delblock=~ s/\\MATHBLOCK($MATHENV)\{($pat6)\}/\\MATHBLOCK$MATHREPL\{$2\}/sg; - $delblock=~ s/\\MATHBLOCK($MATHARRENV)\{($pat6)\}/\\MATHBLOCK$MATHARRREPL\{$2\}/sg; + $delblock=~ s/\\MATHBLOCK($MATHENV)\{($pat_n)\}/\\MATHBLOCK$MATHREPL\{$2\}/sg; + $delblock=~ s/\\MATHBLOCK($MATHARRENV)\{($pat_n)\}/\\MATHBLOCK$MATHARRREPL\{$2\}/sg; } + # Reinstate completely deleted list environments. note that items within the + # environment will still be commented out. They will be restored later + $delblock=~ s/(\%DIFDELCMD < \s*\\begin\{($LISTENV)\}\s*?(?:\n|$DELCMDCLOSE))(.*?)(\%DIFDELCMD < \s*\\end\{\2\})/{ + ### # block within the search; replacement environment + ### "$1\\begin{$2}$AUXCMD\n". restore_item_commands($3). "\n\\end{$2}$AUXCMD\n$4"; + "$1\\begin{$2}$AUXCMD\n$3\n\\end{$2}$AUXCMD\n$4"; + }/esg; # b.where one of the commands matching $COUNTERCMD is used as a DIFAUXCMD, add a statement # subtracting one from the respective counter to keep numbering consistent with new file - $delblock=~ s/\\($COUNTERCMD)((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat6\})*\s*${AUXCMD}\n)/\\$1$2\\addtocounter{$1}{-1}${AUXCMD}\n/sg ; + $delblock=~ s/\\($COUNTERCMD)((?:${extraspace}\[$brat0\]${extraspace}|${extraspace}\{$pat_n\})*\s*${AUXCMD}\n)/\\$1$2\\addtocounter{$1}{-1}${AUXCMD}\n/sg ; + +# bb. disable active labels within deleted blocks (as these are not safe commands, this should normally only +# happen within deleted maths blocks + $delblock=~ s/(\\$LABELCMD(?:${extraspace})\{(?:[^{}])*\}[\t ]*)\n?/${DELCMDOPEN}$1${DELCMDCLOSE}/smg ; # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es @@ -2534,6 +2632,36 @@ sub postprocess { pos = $begin + length($addblock); } + # Go through whole text, and by counting list environment commands, find out when we are within a list environment. + # Within those restore deleted \item commands + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; + @liststack=(); + @newtextparts=map { + ### print STDERR ":::::::: $_\n"; + if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { + print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; + push @liststack,$listtype; + } elsif ( ($listtype) = m/^\\end\{($LISTENV)\}$/ ) { + print STDERR "DEBUG: postprocess \\end{$listtype}\n" if $debug; + if (scalar @liststack > 0) { + $listlast=pop(@liststack); + ($listtype eq $listlast) or warn "Invalid nesting of list environments: $listlast environment closed by \\end{$listtype}."; + } else { + warn "Invalid nesting of list environments: \\end{$listtype} encountered without matching \\begin{$listtype}."; + } + } else { + print STDERR "DEBUG: postprocess \@liststack=(",join(",",@liststack),")\n" if $debug; + if (scalar @liststack > 0 ) { + # we are within a list environment and should replace all item commands + $_=restore_item_commands($_); + } + # else: we are outside a list environment and do not need to do anything + } + $_ } @textparts; # end of map command + # replace the main text with the modified version + $_= "@newtextparts"; + + # Replace MATHMODE environments from step 1a above by the correct Math environment @@ -2553,12 +2681,12 @@ sub postprocess { s/\\begin{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end{\1}$AUXCMD\n/$2/sg; } else { # math modes OFF,WHOLE,COARSE: Convert \MATHBLOCKmath{..} commands back to environments - s/\\MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; # convert ARRAYBLOCK.. commands back to environments - s/\\ARRAYBLOCK($ARRENV)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\ARRAYBLOCK($ARRENV)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; } # Convert all PICTUREblock{..} commands back to the appropriate environments - s/\\PICTUREBLOCK($PICTUREENV)\{($pat6)\}/\\begin{$1}$2\\end{$1}/sg; + s/\\PICTUREBLOCK($PICTUREENV)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg; #0.5: # Remove all mark up within picture environments # while ( m/\\begin\{($PICTUREENV)\}.*?\\end\{\1\}/sg ) { # $cnt=0; @@ -2567,10 +2695,10 @@ sub postprocess { # $float=$&; # $float =~ s/\\DIFaddbegin //g; # $float =~ s/\\DIFaddend //g; -# $float =~ s/\\DIFadd\{($pat6)\}/$1/g; +# $float =~ s/\\DIFadd\{($pat_n)\}/$1/g; # $float =~ s/\\DIFdelbegin //g; # $float =~ s/\\DIFdelend //g; -# $float =~ s/\\DIFdel\{($pat6)\}//g; +# $float =~ s/\\DIFdel\{($pat_n)\}//g; # $float =~ s/$DELCMDOPEN.*//g; # substr($_,$begin,$len)=$float; # pos = $begin + length($float); @@ -2633,11 +2761,15 @@ sub postprocess { # 4. Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ s/\\begin\{DOLLARDOLLAR\}(.*?)\\end\{DOLLARDOLLAR\}/\$\$$1\$\$/sg; # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} - 1 while s/\\SUPERSCRIPT{($pat6)}/^{$1}/g ; - 1 while s/\\SUPERSCRIPTNB{($pat0)}/^$1/g ; + 1 while s/\\SUPERSCRIPT(\s*{($pat_n)})/^$1/g ; + 1 while s/\\SUPERSCRIPTNB{(\s*$pat0)}/^$1/g ; # Convert \SUBSCRIPNB{n} into _n and \SUBCRIPT{nn} into _{nnn} - 1 while s/\\SUBSCRIPT{($pat6)}/_{$1}/g ; - 1 while s/\\SUBSCRIPTNB{($pat0)}/_$1/g ; + 1 while s/\\SUBSCRIPT(\s*{($pat_n)})/_$1/g ; + 1 while s/\\SUBSCRIPTNB{(\s*$pat0)}/_$1/g ; + # Convert \SQRT{n} into \sqrt{n} and \SQRTNB{nn} into \sqrt nn + 1 while s/\\SQRT(\s*{($pat_n)})/\\sqrt$1/g ; + 1 while s/\\SQRTNB{(\s*$pat0)}/\\sqrt$1/g ; + 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -2651,6 +2783,24 @@ sub postprocess { } } +# $out = restore_item_commands($listenviron) +# short helper function for post-process, which restores deleted \item commands in its argument (as DIFAUXCMDs) +sub restore_item_commands { + my ($string)=@_ ; + my ($itemarg,@itemargs); + $string =~ s/(\%DIFDELCMD < \s*(\\$ITEMCMD)((?:<$abrat0>)?)((?:\[$brat0\])?)\s*?(?:\n|$DELCMDCLOSE))/ + # if \item has an []argument, then mark up the argument as deleted) + if (length($4)>0) { + # use substr to exclude square brackets at end points + @itemargs=splitlatex(substr($4,1,length($4)-2)); + $itemarg="[".join("",marktags("","",$DELOPEN,$DELCLOSE,$DELCMDOPEN,$DELCMDCLOSE,$DELCOMMENT,\@itemargs))."]"; + } else { + $itemarg=""; + } + "$1$2$3$itemarg$AUXCMD\n"/sge; + return($string); +} + # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) @@ -2677,7 +2827,7 @@ sub preprocess_preamble { # resue in a more complex regex $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: - $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat0)\])?(?:\{($pat6)\}))/ms; + $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat0)\])?(?:\{($pat_n)\}))/ms; @oldtitlecommands= ( $$oldpreambleref =~ m/$titlecmdpat/g ); @newtitlecommands= ( $$newpreambleref =~ m/$titlecmdpat/g ); @@ -2905,7 +3055,7 @@ format as new.tex but has all changes relative to old.tex marked up or commented --subtype=markstyle -s markstyle Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin) - Available styles: SAFE MARGINAL DVIPSCOL COLOR ZLABEL ONLYCHANGEDPAGE (LABEL)* + Available styles: SAFE MARGIN DVIPSCOL COLOR ZLABEL ONLYCHANGEDPAGE (LABEL)* [ Default: SAFE ] * LABEL subtype is deprecated @@ -2996,15 +3146,17 @@ format as new.tex but has all changes relative to old.tex marked up or commented --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. -c configfile Available variables: - MINWORDSBLOCK (integer) + ARRENV (RegEx) + COUNTERCMD (RegEx) FLOATENV (RegEx) - PICTUREENV (RegEx) - MATHENV (RegEx) - MATHREPL (String) + ITEMCMD (RegEx) + LISTENV (RegEx) MATHARRENV (RegEx) MATHARRREPL (String) - ARRENV (RegEx) - COUNTERCMD (RegEx) + MATHENV (RegEx) + MATHREPL (String) + MINWORDSBLOCK (integer) + PICTUREENV (RegEx) This option can be repeated. @@ -3015,7 +3167,7 @@ format as new.tex but has all changes relative to old.tex marked up or commented Use of the --packages option disables automatic scanning, so if for any reason package specific parsing needs to be switched off, use --packages=none. The following packages trigger special behaviour: - endfloat hyperref amsmath apacite siunitx cleveref glossaries mhchem chemformula + endfloat hyperref amsmath apacite siunitx cleveref glossaries mhchem chemformula/chemmacros [ Default: scan the preamble for \\usepackage commands to determine loaded packages.] @@ -3263,7 +3415,7 @@ B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines C<\DIFaddbegin>, C<\DIFaddend>, C<\DIFdelbegin> and C<\DIFdelend> commands. -Available styles: C<SAFE MARGINAL COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> +Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> [ Default: C<SAFE> ] * Subtype C<LABEL> is deprecated @@ -3354,7 +3506,7 @@ Define most of the glossaries commands as safe, protecting them with \mbox'es wh Treat C<\ce> as a safe command, i.e. it will be highlighted (note that C<\cee> will not be highlighted in equations as this leads to processing errors) -=item C<chemformula> +=item C<chemformula> or C<chemmacros> Treat C<\ch> as a safe command outside equations, i.e. it will be highlighted (note that C<\ch> will not be highlighted in equations as this leads to processing errors) @@ -3455,23 +3607,27 @@ Set configuration variables. The option can be repeated to set different variables (as an alternative to the comma-separated list). Available variables (see below for further explanations): -C<MINWORDSBLOCK> (integer) +C<ARRENV> (RegEx) -C<FLOATENV> (RegEx) +C<COUNTERCMD> (RegEx) -C<PICTUREENV> (RegEx) +C<FLOATENV> (RegEx) -C<MATHENV> (RegEx) +C<ITEMCMD> (RegEx) -C<MATHREPL> (String) +C<LISTENV> (RegEx) C<MATHARRENV> (RegEx) C<MATHARRREPL> (String) -C<ARRENV> (RegEx) +C<MATHENV> (RegEx) -C<COUNTERCMD> (RegEx) +C<MATHREPL> (String) + +C<MINWORDSBLOCK> (integer) + +C<PICTUREENV> (RegEx) =item B<--show-safecmd> @@ -3745,12 +3901,22 @@ Make no difference between the main text and floats. =over 10 -=item C<MINWORDSBLOCK> +=item C<ARRENV> -Minimum number of tokens required to form an independent block. This value is -used in the algorithm to detect changes of complete blocks by merging identical text parts of less than C<MINWORDSBLOCK> to the preceding added and discarded parts. +If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math +is surrounded by C<\mbox{>...C<}>. This is necessary as underlining does not work within inlined array environments. -[ Default: 3 ] +[ Default: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > + +=item C<COUNTERCMD> + +If a command in a deleted block which is also in the textcmd list matches C<COUNTERCMD> then an +additional command C<\addtocounter{>F<cntcmd>C<}{-1}>, where F<cntcmd> is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the +numbering in the new file. + +[ Default: C<COUNTERCMD>=C<(?:footnote|part|section|subsection> ... + +C<|subsubsection|paragraph|subparagraph)> ] =item C<FLOATENV> @@ -3760,18 +3926,21 @@ are replaced by their FL variaties. [ Default: S<C<(?:figure|table|plate)[\w\d*@]*> >] -=item C<PICTUREENV> +=item C<ITEMCMD> -Within environments whose name matches the regular expression in C<PICTUREENV> -all latexdiff markup is removed (in pathologic cases this might lead to - inconsistent markup but this situation should be rare). +Commands representing new item line with list environments. -[ Default: S<C<(?:picture|DIFnomarkup)[\w\d*@]*> >] +[ Default: \C<item> ] + +=item C<LISTENV> + +Environments whose name matches the regular expression in C<LISTENV> are list environments. + +[ Default: S<C<(?:itemize|enumerate|description)> >] =item C<MATHENV>,C<MATHREPL> -If both \begin and \end for a math environment (environment name matching C<MATHENV> -or \[ and \]) +If both \begin and \end for a math environment (environment name matching C<MATHENV> or \[ and \]) are within the same deleted block, they are replaced by a \begin and \end commands for C<MATHREPL> rather than being commented out. @@ -3783,22 +3952,20 @@ as C<MATHENV>,C<MATHREPL> but for equation arrays [ Default: C<MATHARRENV>=S<C<eqnarray\*?> >, C<MATHREPL>=S<C<eqnarray> >] -=item C<ARRENV> - -If a match to C<ARRENV> is found within an inline math environment within a deleted or added block, then the inlined math -is surrounded by C<\mbox{>...C<}>. This is necessary as underlining does not work within inlined array environments. +=item C<MINWORDSBLOCK> -[ Default: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > +Minimum number of tokens required to form an independent block. This value is +used in the algorithm to detect changes of complete blocks by merging identical text parts of less than C<MINWORDSBLOCK> to the preceding added and discarded parts. -=item C<COUNTERCMD> +[ Default: 3 ] -If a command in a deleted block which is also in the textcmd list matches C<COUNTERCMD> then an -additional command C<\addtocounter{>F<cntcmd>C<}{-1}>, where F<cntcmd> is the matching command, is appended in the diff file such that the numbering in the diff file remains synchronized with the -numbering in the new file. +=item C<PICTUREENV> -[ Default: C<COUNTERCMD>=C<(?:footnote|part|section|subsection> ... +Within environments whose name matches the regular expression in C<PICTUREENV> +all latexdiff markup is removed (in pathologic cases this might lead to +inconsistent markup but this situation should be rare). -C<|subsubsection|paragraph|subparagraph)> ] +[ Default: S<C<(?:picture|DIFnomarkup)[\w\d*@]*> >] =back @@ -3825,21 +3992,25 @@ For custom packages you can define the commands which need to be protected by C< Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -=item How can I just show the pages +=item How can I just show the pages where changes had been made Use options -C<-s ZLABEL> (some postprocessing required) or C<-s ONLYCHANGEDPAGE>. C<latexdiff-vc --ps|--pdf> with C<--only-changes> option takes care of -the post-processing for you (requires zref packages). +the post-processing for you (requires zref package to be installed). =back =head1 BUGS -Option allow-spaces not implemented entirely consistently. It breaks +=over 10 + +=item Option allow-spaces not implemented entirely consistently. It breaks the rules that number and type of white space does not matter, as different numbers of inter-argument spaces are treated as significant. +=back + Please submit bug reports using the issue tracker of the github repository page I<https://github.com/ftilmann/latexdiff.git>, -or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the serial number of I<latexdiff> +or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the version number of I<latexdiff> (from comments at the top of the source or use B<--version>). If you come across latex files that are error-free and conform to the specifications set out above, and whose differencing still does not result in error-free @@ -3866,7 +4037,7 @@ I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.1.0 +Version 1.1.1 Copyright (C) 2004-2015 Frederik Tilmann This program is free software; you can redistribute it and/or modify @@ -3887,7 +4058,7 @@ dashbox emph fbox framebox -hspace +hspace\*? math.* makebox mbox @@ -4097,6 +4268,8 @@ _ AMPERSAND (SUPER|SUB)SCRIPTNB (SUPER|SUB)SCRIPT +SQRT +SQRTNB PERCENTAGE DOLLAR %%END SAFE COMMANDS |