diff options
Diffstat (limited to 'support')
193 files changed, 6314 insertions, 8764 deletions
diff --git a/support/SQLTeX/Makefile.in b/support/SQLTeX/Makefile.in index aaec779cb4..2284b7696f 100644 --- a/support/SQLTeX/Makefile.in +++ b/support/SQLTeX/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -134,7 +134,7 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck + cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -152,11 +152,8 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in install-sh missing +am__DIST_COMMON = $(srcdir)/Makefile.in README.md install-sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -195,6 +192,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -206,11 +205,14 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -301,8 +303,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -419,8 +421,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am -distdir: $(DISTFILES) +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -485,7 +489,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -500,6 +504,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -511,7 +519,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -529,7 +537,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -539,9 +547,11 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -557,7 +567,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -718,7 +728,7 @@ uninstall-am: am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-tags \ + dist-zstd distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/support/SQLTeX/README.md b/support/SQLTeX/README.md index b980c7a9a7..37e4946bbf 100644 --- a/support/SQLTeX/README.md +++ b/support/SQLTeX/README.md @@ -1,16 +1,38 @@ -SQLTeX v2.1 +SQLTeX v2.2 =========== **SQLTeX** is a preprocessor to enable the use of SQL statements in LaTeX. It is a -perl script that reads an input file containing the SQL commands, and writes a -LaTeX file that can be processed with your LaTeX package. +perl script that reads one or more input files containing the SQL commands, and writes a +single LaTeX file or multiple files based on the data read from the database. +Those files can be processed with your LaTeX package. The SQL commands will be replaced by their values. It's possible to select a single field for substitution substitution in your LaTeX document, or to be used as input in another SQL command. -When an SQL command returns multiple fields and or rows, the values can only be -used for substitution in the document. +### Features ### + +* Replace the SQL statements with their result. This can be a single field, a row or multiple rows, +* Configurable replace file to translate special characters or strings to LaTeX format, with support for regular expressions, +* Use info read from the database as input for new SQL statements, +* Process parts of the LaTeX input file in a loop generating multiple pages or documents, +* Write updates to the database when data has been processed, +* Process parts of the document conditionally using `\sqlif` and `\sqlendif` commands, +* Process data by external scripts and use the output with the `\sqlsystem` command (by default disabled in the config file), + +and more. + +### Supported databases ### + +* MySQL/MariaDB +* Sybase +* Oracle +* PostgreSQL +* MSSQL + +ODBC is supported. + +Others database (Ingres, mSQL, ...) '*should work*'™ but haven´t been tested. Installing SQLTeX ----------------- @@ -19,8 +41,8 @@ Installing SQLTeX On a linux system, download the archive and unpack: - $ tar vxzf sqltex-2.1.tar.gz - $ cd sqltex-2.1 + $ tar vxzf sqltex-2.2.tar.gz + $ cd sqltex-2.2 Next, install **SQLTeX** with the following commands: @@ -42,8 +64,8 @@ type: This distribution contains an .EXE file that was generated using `PAR::Packer` with Strawberry Perl. -The files `sqltex-2.1\SQLTeX.EXE`, `sqltex-2.1\src\SQLTeX.cfg` and `sqltex-2.1\src\SQLTeX_r.dat` must be placed manually -in the directory of your choice, all in the same direcrtory. +The files `sqltex-2.2\SQLTeX.EXE`, `sqltex-2.2\src\SQLTeX.cfg` and `sqltex-2.2\src\SQLTeX_r.dat` must be placed manually +in the directory of your choice, all in the same directory. #### OpenVMS #### @@ -52,9 +74,9 @@ it manually. On OpenVMS it would be something like: - $ COPY [.SQLTEX-2_1.SRC]SQLTEX.PL SYS$SYSTEM: - $ COPY [.SQLTEX-2_1.SRC]SQLTEX.CFG SYS$SYSTEM: - $ COPY [.SQLTEX-2_1.SRC]SQLTEX_R.DAT SYS$SYSTEM: + $ COPY [.SQLTEX-2_2.SRC]SQLTEX.PL SYS$SYSTEM: + $ COPY [.SQLTEX-2_2.SRC]SQLTEX.CFG SYS$SYSTEM: + $ COPY [.SQLTEX-2_2.SRC]SQLTEX_R.DAT SYS$SYSTEM: $ SET FILE/PROTECTION=(W:R) SYS$SYSTEM:SQLTEX*.* However, on OpenVMS you also need to define the command SQLTEX by setting a @@ -89,6 +111,7 @@ Credits * **Ingo Reich** for the comment on Mac OS * **Johan W. Klüwer** for verifying the SyBase support * **Paolo Cavallini** for adding PostgreSQL support +* **Silpa Suresh** for testing the ODBC support ---------- @@ -99,5 +122,5 @@ For bugs, questions and comments, please use the [issue tracker](https://github. This software is subject to the terms of the LaTeX Project Public License; see [http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html](http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html) -Copyright (c) 2001-2022 - Oscar van Eijk, Oveas Functionality Provider +Copyright (c) 2001-2024 - Oscar van Eijk, Oveas Functionality Provider diff --git a/support/SQLTeX/aclocal.m4 b/support/SQLTeX/aclocal.m4 index 433d545f67..6d04fca5b5 100644 --- a/support/SQLTeX/aclocal.m4 +++ b/support/SQLTeX/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -138,6 +138,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -174,7 +178,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -197,8 +201,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -226,6 +230,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -265,7 +283,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -307,7 +325,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -328,7 +346,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -349,7 +367,7 @@ AC_SUBST([am__leading_dot])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -370,12 +388,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -388,7 +401,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -419,7 +432,7 @@ AC_DEFUN([_AM_IF_OPTION], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -500,7 +513,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -560,7 +573,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -588,7 +601,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -607,7 +620,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/support/SQLTeX/configure b/support/SQLTeX/configure index 4b758dc66c..345e365772 100755 --- a/support/SQLTeX/configure +++ b/support/SQLTeX/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for SQLTeX 2.1. +# Generated by GNU Autoconf 2.71 for SQLTeX 2.2. # # Report bugs to <support@oveas.com>. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,41 +169,52 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -229,14 +222,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -254,18 +254,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and support@oveas.com + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and support@oveas.com $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do @@ -293,6 +294,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -310,6 +312,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -324,7 +334,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -333,7 +343,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -372,12 +382,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -389,18 +400,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -412,9 +432,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -441,7 +461,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -485,7 +505,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -499,6 +519,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -512,6 +536,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -579,8 +610,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='SQLTeX' PACKAGE_TARNAME='sqltex' -PACKAGE_VERSION='2.1' -PACKAGE_STRING='SQLTeX 2.1' +PACKAGE_VERSION='2.2' +PACKAGE_STRING='SQLTeX 2.2' PACKAGE_BUGREPORT='support@oveas.com' PACKAGE_URL='' @@ -591,6 +622,9 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__untar am__tar AMTAR @@ -729,8 +763,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -771,9 +803,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -797,9 +829,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1010,9 +1042,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1026,9 +1058,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1072,9 +1104,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1090,7 +1122,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1154,7 +1186,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1211,7 +1243,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures SQLTeX 2.1 to adapt to many kinds of systems. +\`configure' configures SQLTeX 2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1278,7 +1310,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of SQLTeX 2.1:";; + short | recursive ) echo "Configuration of SQLTeX 2.2:";; esac cat <<\_ACEOF @@ -1305,9 +1337,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1335,7 +1367,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1343,7 +1376,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1352,10 +1385,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -SQLTeX configure 2.1 -generated by GNU Autoconf 2.69 +SQLTeX configure 2.2 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1365,14 +1398,34 @@ fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by SQLTeX $as_me 2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by SQLTeX $as_me 2.2, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1405,8 +1458,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -1441,7 +1498,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -1476,11 +1533,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -1491,8 +1550,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1516,7 +1575,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1524,14 +1583,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -1539,15 +1598,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -1555,8 +1614,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1570,63 +1629,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -1636,19 +1680,117 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi + +# Auxiliary files required by this configure script. +ac_aux_files="missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -1659,12 +1801,12 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -1673,24 +1815,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1700,11 +1842,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -1718,38 +1861,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.15' +am__api_version='1.16' -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -# Find a good install program. We prefer a C program (faster), + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -1763,20 +1879,25 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -1786,13 +1907,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -1800,12 +1921,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -1821,7 +1942,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -1831,8 +1952,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -1842,8 +1963,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -1897,8 +2018,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -1917,26 +2038,23 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -1956,11 +2074,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -1968,11 +2087,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -1983,11 +2106,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -1996,11 +2119,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -2008,11 +2132,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2023,11 +2151,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -2035,8 +2163,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -2048,25 +2176,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -2077,7 +2211,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -2087,18 +2221,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -2106,11 +2241,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2121,24 +2260,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -2154,12 +2294,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2173,7 +2313,8 @@ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -2183,12 +2324,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -2200,8 +2342,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -2233,17 +2375,13 @@ fi # Define the identity of the package. PACKAGE='sqltex' - VERSION='2.1' + VERSION='2.2' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -2263,8 +2401,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> -# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> +# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2283,6 +2421,20 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -2315,7 +2467,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <http://www.gnu.org/software/coreutils/>. +that behaves properly: <https://www.gnu.org/software/coreutils/>. If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -2337,15 +2489,18 @@ fi + + # Make sure we have perl if test -z "$PERL"; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PERL+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # Let the user override the test. else @@ -2353,11 +2508,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PERL="perl" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2368,11 +2527,11 @@ fi fi PERL=$ac_cv_prog_PERL if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +printf "%s\n" "$PERL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2380,19 +2539,19 @@ fi if test "x$PERL" != x; then ax_perl_modules_failed=0 - for ax_perl_module in 'DBI' 'Getopt::Long' 'Term::ReadKey' ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5 -$as_echo_n "checking for perl module $ax_perl_module... " >&6; } + for ax_perl_module in 'DBI' 'DBD::mysql' 'Getopt::Long' 'Term::ReadKey' ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5 +printf %s "checking for perl module $ax_perl_module... " >&6; } # Would be nice to log result here, but can't rely on autoconf internals $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 if test $? -ne 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; }; ax_perl_modules_failed=1 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; }; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; }; fi done @@ -2402,14 +2561,15 @@ $as_echo "ok" >&6; }; else : + as_fn_error $? "Not all required perl modules are installed" "$LINENO" 5 fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5 -$as_echo "$as_me: WARNING: could not find perl" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5 +printf "%s\n" "$as_me: WARNING: could not find perl" >&2;} fi -# Makefile to be generated in the subdircetories as welll +# Makefile to be generated in the subdirectories as well ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile man/Makefile" @@ -2440,8 +2600,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2471,15 +2631,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -2493,8 +2653,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -2547,7 +2707,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -2558,22 +2718,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -2596,14 +2756,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -2613,46 +2775,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi +if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -2661,13 +2823,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -2676,8 +2831,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -2689,30 +2848,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -2725,13 +2864,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -2758,18 +2898,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -2781,12 +2923,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -2817,7 +2960,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -2839,6 +2982,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -2852,6 +2999,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -2893,7 +3046,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -2902,7 +3055,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -2964,8 +3117,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by SQLTeX $as_me 2.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by SQLTeX $as_me 2.2, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3014,14 +3167,16 @@ $config_files Report bugs to <support@oveas.com>." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -SQLTeX config.status 2.1 -configured by $0, generated by GNU Autoconf 2.69, +SQLTeX config.status 2.2 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -3061,21 +3216,21 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -3103,7 +3258,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -3117,7 +3272,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -3145,7 +3300,7 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree @@ -3373,7 +3528,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -3381,17 +3536,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -3408,7 +3563,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -3432,9 +3587,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -3496,8 +3651,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -3541,9 +3696,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -3590,7 +3745,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + diff --git a/support/SQLTeX/configure.ac b/support/SQLTeX/configure.ac index 057a159734..ff773a4ae5 100644 --- a/support/SQLTeX/configure.ac +++ b/support/SQLTeX/configure.ac @@ -1,5 +1,5 @@ # Autoconf configfile for SQLTeX. -# To create a new distribuition, 3execute the following steps: +# To create a new distribution, execute the following steps: # aclocal # autoconf # automake --add-missing @@ -16,13 +16,16 @@ AC_PREREQ([2.69]) # Ensure configure can check for the required perl modules. m4_include([aclocal/ax_prog_perl_modules.m4]) -AC_INIT([SQLTeX], [2.1], [support@oveas.com]) +AC_INIT([SQLTeX], [2.2], [support@oveas.com]) AM_INIT_AUTOMAKE -AX_PROG_PERL_MODULES(DBI Getopt::Long Term::ReadKey, , ) +AX_PROG_PERL_MODULES([DBI DBD::mysql Getopt::Long Term::ReadKey] + , + ,[AC_MSG_ERROR([Not all required perl modules are installed])] +) -# Makefile to be generated in the subdircetories as welll +# Makefile to be generated in the subdirectories as well AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile man/Makefile]) AC_OUTPUT diff --git a/support/SQLTeX/doc/Makefile.am b/support/SQLTeX/doc/Makefile.am index c100c1012b..56ee693ded 100644 --- a/support/SQLTeX/doc/Makefile.am +++ b/support/SQLTeX/doc/Makefile.am @@ -13,4 +13,5 @@ SQLTeX.pdf: SQLTeX.tex @pdflatex $^ install: SQLTeX.pdf + @if [ ! -d ${pdfdir} ]; then mkdir -p ${pdfdir}; fi cp $^ ${pdfdir} diff --git a/support/SQLTeX/doc/Makefile.in b/support/SQLTeX/doc/Makefile.in index 0c4a9a76f4..f42b41992e 100644 --- a/support/SQLTeX/doc/Makefile.in +++ b/support/SQLTeX/doc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -125,11 +125,14 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -214,8 +217,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -232,6 +235,37 @@ ctags CTAGS: cscope cscopelist: + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am all-am: Makefile @@ -358,6 +392,7 @@ SQLTeX.pdf: SQLTeX.tex @pdflatex $^ install: SQLTeX.pdf + @if [ ! -d ${pdfdir} ]; then mkdir -p ${pdfdir}; fi cp $^ ${pdfdir} # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/support/SQLTeX/doc/SQLTeX.pdf b/support/SQLTeX/doc/SQLTeX.pdf Binary files differindex 5b8d934189..8d0b404360 100644 --- a/support/SQLTeX/doc/SQLTeX.pdf +++ b/support/SQLTeX/doc/SQLTeX.pdf diff --git a/support/SQLTeX/doc/SQLTeX.tex b/support/SQLTeX/doc/SQLTeX.tex index 2361476460..bc49991cb1 100644 --- a/support/SQLTeX/doc/SQLTeX.tex +++ b/support/SQLTeX/doc/SQLTeX.tex @@ -8,8 +8,8 @@ ,linkcolor=blue ,unicode]{hyperref} \begin{document} -\title{SQL\TeX\\v2.1} -\date{Jan 21, 2022} +\title{SQL\TeX\\v2.2} +\date{July 31, 2024} \author{Oscar van Eijk} \maketitle \hrulefill @@ -34,7 +34,6 @@ in the document. \item The \LaTeX\ \texttt{\bs includeonly} directive is ignored; all documents included with \texttt{\bs include} will be parsed and written to the output file. \item Currently, only 9 command- line parameters (1-9), and 10 variables (0-9) can be used in SQL statements. \item Replace files can hold only 1,000 items. -\item In multidocument mode, only one parameter can be retrieved. \end{itemize} \section{Installing SQL\TeX} @@ -63,7 +62,7 @@ To install SQL\TeX, unpack the archive in a location of your choice and follow t \subsubsection{Linux} -Go to the top directory where the archive was unpacked (`\texttt{cd sqltex-2.1}') and execute the following commands: +Go to the top directory where the archive was unpacked (`\texttt{cd sqltex-2.2}') and execute the following commands: \vs @@ -105,15 +104,15 @@ This distribution contains an \texttt{.EXE} file that was generated using \textt \vs -The files \texttt{sqltex-2.1\ensuremath{\backslash}SQLTeX.EXE}, \texttt{sqltex-2.1\ensuremath{\backslash}src\ensuremath{\backslash}SQLTeX.cfg} and \\ \texttt{sqltex-2.1\ensuremath{\backslash}src\ensuremath{\backslash}SQLTeX\_r.dat} must be placed manually in the directory of your choice, all in the same direcrtory. +The files \texttt{sqltex-2.2\ensuremath{\backslash}SQLTeX.EXE}, \texttt{sqltex-2.2\ensuremath{\backslash}src\ensuremath{\backslash}SQLTeX.cfg} and \\ \texttt{sqltex-2.2\ensuremath{\backslash}src\ensuremath{\backslash}SQLTeX\_r.dat} must be placed manually in the directory of your choice, all in the same direcrtory. \subsubsection{OpenVMS} On \textsc{OpenVMS} the files must be copied manually to the destination. All files must reside in the same location:\\ -\texttt{\$ COPY [.SQLTEX-2\_1.SRC]SQLTEX.PL SYS\$SYSTEM:\\ -\$ COPY [.SQLTEX-2\_1.SRC]SQLTEX.CFG SYS\$SYSTEM:\\ -\$ COPY [.SQLTEX-2\_1.SRC]SQLTEX\_R.DAT SYS\$SYSTEM:\\ +\texttt{\$ COPY [.SQLTEX-2\_2.SRC]SQLTEX.PL SYS\$SYSTEM:\\ +\$ COPY [.SQLTEX-2\_2.SRC]SQLTEX.CFG SYS\$SYSTEM:\\ +\$ COPY [.SQLTEX-2\_2.SRC]SQLTEX\_R.DAT SYS\$SYSTEM:\\ \$ SET FILE/PROTECTION=(W:RE) SYS\$SYSTEM:SQLTEX.PL} \vs @@ -142,12 +141,18 @@ Some values can be overwritten using command line options (see section~\ref{cmdl \begin{description} \item[dbdriver] Database driver. The default is \texttt{mysql}. -Other supported databases are \texttt{Pg}, \texttt{Sybase}, \texttt{Oracle}, -\texttt{Ingres}, \texttt{mSQL} and \texttt{PostgreSQL}, but also others might -work without modification. \\ +Other supported databases are \texttt{Pg}, \texttt{Sybase}, \texttt{Oracle}\footnote{ This requires the configuration setting \texttt{oracle\_sid}}, \texttt{Ingres}, \texttt{mSQL}, \texttt{PostgreSQL} and \texttt{ODBC}\footnote{ The actual driver can specified with the configuration setting \texttt{odbc\_driver}}, but also others might work without modification. \\ + +\vs + If your database driver is not support, look for the function \texttt{db\_connect} to add support (and please notify me :) +\item[oracle\_sid] Oracle Site Identifier, required when the \texttt{Oracle} database driver is selected. + +\item[odbc\_driver] Specification of the ODBC driver. Default is ``\texttt{SQL Server}'' + + \item[texex] The default file extension for \LaTeX\ file. When SQL\TeX\ is called, the first parameter should be the name of the input file. If this filename has no extension, SQL\TeX\ looks for one with the default extension. @@ -202,6 +207,8 @@ With the default configuration this command is ``\texttt{\bs sqluse}''. \item[sql\_end] This string is appended to the \texttt{cmd\_prefix} to get the complete SQL\TeX\ command to end a loop context (see section~\ref{loops}).\\ With the default configuration this command is ``\texttt{\bs sqlend}''. +\item[sqlsystem\_allowed] Set this to ``1'' to allow the use of the \texttt{\bs sqlsystem} command (see section~\ref{sqlsystem}. + \item[repl\_step] Replacing strings (see section~\ref{replfiles} below) is done two steps, to prevent values from being replaced twice. This setting---followed by a three-digit integer - ``000'' to ``999''---is used in the first step and replaces values from the first column. In the second step, values from the second column replace the temporary value. \\ @@ -214,15 +221,15 @@ Normally, this setting should never change, but if the value for \texttt{cmd\_pr \subsection{Create replace files}\label{replfiles} -Replace files can be used to substitute values in the output of your SQL commands with a different value. This is especially usefull when the database +Replace files can be used to substitute values in the output of your SQL commands with a different value. This is especially useful when the database contains characters that are special characters in \LaTeX, like the percent sign (`\%'), underscore (`\_') etc. -When SQL\TeX\ is installed, it comes with a standard file---\texttt{SQLTeX\_r.dat}---which is located in \texttt{/etc} (linux) or the same location where -SQL\TeX\ is installed (all other operating systems), with the following replacements: +When SQL\TeX\ is installed, it comes with a standard file---\texttt{SQLTeX\_r.dat}---which is located in \texttt{/usr/local/etc}\footnote{ if a replace file with that name already exists, it will be stored there as \texttt{SQLTeX\_r.dat.new}} (linux) or the same location where SQL\TeX\ is installed (all other operating systems). \vspace{3mm} -\noindent\begin{verbatim} +\noindent Example: +\begin{verbatim} $ \$ _ \_ % \% @@ -238,8 +245,14 @@ _ \_ \vspace{3mm} -These are all single character replacements, but you can add your own replacements that consist of a single character or a character sequence (or even regular expressions, see section~\ref{regexp}).\\ -To do so, enter a new line with the character(string) that should be replaced, followed by one or more \texttt{TAB}-character(s) (\textit{not} blanks!) and the character(string) it should be replaced with. +These are all single character replacements, but you can add your own replacements that consist of a single character or a character sequence (or even regular expressions, see section~\ref{regexp}). + +\vs + +To do so, enter a new line with the character(string) that should be replaced, followed by one or more \texttt{TAB}-character(s) (\textit{not} blanks!) and the character(string) it should be replaced with.\\ +That last one can be empty if the input character(string) should be ignored, but the \texttt{TAB} after the input character(string) is mandatory! + +\vs If the first non-blank character is a semicolon (`;'), the line is considered a comment line\footnote{ in the default configuration. See the description for \texttt{rfile\_comment} in section~\ref{config} to change of disable comment lines.}. Blank lines are ignored. @@ -266,7 +279,7 @@ This also requires \texttt{rfile\_regexp} to be changed. Its new value has to be \vs Both in the default configuration and with the modification example given above, the key for regular expressions is \texttt{re(<\textit{regular expression}>)}, e.g.:\\ -\hspace{3mm}\verb+re(<p\.*?>) \paragraph*{}+ \\ +\hspace{3mm}\verb+re(<p.*?>) \paragraph*{}+ \\ will replace all HTML \texttt{<}p\texttt{>} variants (\texttt{<}p style='font-size: normal'\texttt{>}, \texttt{<}p align='center'\texttt{>} etc) \vs @@ -296,7 +309,7 @@ re(</h\d>) } For SQL\TeX, you write your \LaTeX\ document just as you're used to. SQL\TeX\ provides you with some extra commands that you can include in your file.\\ -The basic format\footnote{in this document, in all examples will be asumed the default values in the +The basic format\footnote{in this document, in all examples will be assumed the default values in the configuration section as described in section~\ref{config}, have not been changed} of an SQL\TeX\ command is: \\ \texttt{\bs sql\emph{cmd}[options]\{SQL statement\}} @@ -355,7 +368,7 @@ Details about the SQL\TeX\ commands will be described in the next sections. \vs -Let's look at a simple example. Suppose we want to retreive all header information from the database +Let's look at a simple example. Suppose we want to retrieve all header information from the database for a specific invoice. The SQL statement could look something like this: \\ \texttt{SELECT $\ast$ FROM INVOICE WHERE NR = 20190062;}\\ To implement this statement in an SQL\TeX\ file, the \texttt{\bs sqlrow} command should be used (see @@ -414,14 +427,14 @@ Forcing a user to enter a database password when SQL\TeX\ runs can be achieved b \vs -When different database users should be able to use the same SQL\TeX\ file, the username can also be a questionmark, forcing SQL\TeX +When different database users should be able to use the same SQL\TeX\ file, the username can also be a question mark, forcing SQL\TeX to prompt for a username:\\ \texttt{\bs sqldb[user=?,passwd=?]\{database\}} \subsection{Reading a single field}\label{sqlfield} When a single field of information is to be read from the database, the command \texttt{\textbf{\bs sqlfield}} -is used. By default, the command in the inputfile is replaced by its result in the outputfile.\\ +is used. By default, the command in the input file is replaced by its result in the output file.\\ The SQL command is enclosed by curly braces. Square brackets can optionally be used to enter some extra options. Currently, the only supported option is \texttt{setvar} (see section~\ref{vars}). @@ -445,11 +458,11 @@ Therefore, the option \texttt{\textbf{[setvar=\textit{n}]}} is used, where \text Suppose you have an invoice in \LaTeX. SQL\TeX\ is executed to retrieve the invoice header information from the database for a specific customer. Next, the invoice lines are read from the database. -You could pass the invoice number as a paramater to SQL\TeX\ for use in your queries, but that could +You could pass the invoice number as a parameter to SQL\TeX\ for use in your queries, but that could change every month. It is easier to :\\ \begin{itemize} \item pass the customer number as a parameter, -\item retrieve the current date (asuming that is the invoice date as stored in +\item retrieve the current date (assuming that is the invoice date as stored in the database by another program), and store it in a variable: \\ \texttt{\bs sqlfield[setvar=0]\{SELECT DATE\_FORMAT(NOW(), "\%Y-\%m-\%d")\}} \\ This creates a variable that can be used as \texttt{\$VAR0}, @@ -471,7 +484,7 @@ The SQL queries used here do not display any output in your \LaTeX\ document. When an SQL query returns more information than one single field, the SQL\TeX\ command \texttt{\textbf{\bs sqlrow}} should be used. As with the \texttt{\bs sqlfield}, command, SQL\TeX\ replaces the command with the values it returns, but \texttt{\bs sqlrow} -accepts different options for formating the output. +accepts different options for formatting the output. \vs @@ -479,8 +492,8 @@ By default, fields are separated by a comma and a blank (`\texttt{,~}'), and row a newline character (`\texttt{\bs\bs}'). To change this, the options ``\texttt{fldsep}'' and ``\texttt{rowsep}'' can be used. -e.g. In a \texttt{tabular} enviroment the fields should be seperated by an amphesand (\texttt{\&}), -perhaps a line should seperate the rows of information. (\texttt{\bs\bs~\bs hline}). +e.g. In a \texttt{tabular} environment the fields should be separated by an ampersand (\texttt{\&}), +perhaps a line should separate the rows of information. (\texttt{\bs\bs~\bs hline}). To do this, the options can be used with \texttt{\bs sqlrow} as shown here: \\ \texttt{\bs sqlrow[fldsep=\&,rowsep=\bs\bs~\bs hline]\{SELECT I.NR, A.NR, A.PRICE, I.AMOUNT, (A.PRICE * I.AMOUNT) FROM ARTICLE A, INVOICE\_LINE I WHERE I.NR = \$VAR1 @@ -494,9 +507,9 @@ This will produce an output like: \\ 3 \& 4363 \& 1.95 \& 10 \& 19.5 \bs\bs~\bs hline 4 \& 8375 \& 12.5 \& 2 \& 25 \bs\bs~\bs hline} -\subsubsection{Output rows on seperate lines} +\subsubsection{Output rows on separate lines} -Some \LaTeX\ packages require input on a seperate line. If this output is to be +Some \LaTeX\ packages require input on a separate line. If this output is to be read from a database, this can be set with the \texttt{rowsep} option using the fixed text ``\texttt{NEWLINE}''. @@ -507,7 +520,7 @@ AND I.ARTICLE\_NR = A.NR\}} \vs -would procude the following result: \\ +would produce the following result: \\ \texttt{1 \& 9712 \& 12 \& 1 \& 12 \bs\bs~\bs hline \\ 2 \& 4768 \& 9.75 \& 3 \& 29.25 \bs\bs~\bs hline \\ 3 \& 4363 \& 1.95 \& 10 \& 19.5 \bs\bs~\bs hline \\ @@ -526,13 +539,13 @@ Therefore, the option \texttt{\textbf{[setarr=\textit{n}]}} is used, where \text \subsection{Loop context}\label{loops} In a loop context, an array is filled with data from the database using \texttt{\bs sqlrow}.\\ -Later in the document, the data can be used in a textblock that will be written to the outputfile once for every record retrieved. +Later in the document, the data can be used in a text block that will be written to the output file once for every record retrieved. \vs -The textblock is between the \texttt{\bs sqlstart\{\textit{n}\}} and \texttt{\bs sqlend\{\textit{n}\}} commands, where \textit{n} is the sequence number of the array to use\footnote{ in \texttt{\bs sqlend}, the sequence number is ignored, but required by syntax.}. +The text block is between the \texttt{\bs sqlstart\{\textit{n}\}} and \texttt{\bs sqlend\{\textit{n}\}} commands, where \textit{n} is the sequence number of the array to use\footnote{ in \texttt{\bs sqlend}, the sequence number is ignored, but required by syntax.}. -Multiple textblocks can occur in the document, but they can \textit{not} be nested! +Multiple text blocks can occur in the document, but they can \textit{not} be nested! \vs @@ -549,8 +562,8 @@ In the example below, data for unpaid invoices is stored in an array identified \vs -To use this data, a textblock must start with: \texttt{\bs sqlstart\{0\}}\\ -Between this command and the first occurrence of \texttt{\bs sqlend\{\}}, an unlimited amount\footnote{ limited by your computer's memory only} of \LaTeX\ text can be written. Within this text, every occurence of \texttt{\bs sqluse\{<\textit{field name}>\}} will be replaced with the matching field from the current row, e.g.: +To use this data, a text block must start with: \texttt{\bs sqlstart\{0\}}\\ +Between this command and the first occurrence of \texttt{\bs sqlend\{\}}, an unlimited amount\footnote{ limited by your computer's memory only} of \LaTeX\ text can be written. Within this text, every occurrence of \texttt{\bs sqluse\{<\textit{field name}>\}} will be replaced with the matching field from the current row, e.g.: \noindent\begin{verbatim} \sqlstart{0} @@ -570,21 +583,80 @@ as soon as possible. \sqlend{} \end{verbatim} +\subsubsection{If-endif control block} + +In the loop context, parts of the document can be enabled if certain conditions are met, using a control block with \texttt{\bs sqlif\{\textit{condition(s)}\}} and \texttt{\bs sqlendif\{\}}. + +\vs + +\textit{Conditions} can be up to 2 conditions separated by an \textit{and} (\texttt{\&\&}) or \textit{or} (\texttt{||}). + +The condition(s) consist of an left value and an right value seperated by 1 of the following comparisson operators: `\texttt{==}', `\texttt{!=}', `\texttt{<}',. `\texttt{>}', `\texttt{<=}' or `\texttt{>=}'.\\ +Numeric values will be used as is. When the value is text, it is expected to be the name of a field and `\texttt{\bs sqluse\{\}}` will be called to retrieve the value. +\vs + +\noindent Example:\\ +\texttt{\bs sqlif\{article\_nr == 123 \&\& \bs stock < 5\}\\ +Stock is below threshold, please reorder. +}\\ +\bs sqlendif\{\} + +\vs + +Note the conditions are very basic with the following limitations: +\begin{itemize} +\item A maximum of 2 conditions is supported per if-statement. +\item Only numeric comparissons are supported. +\item If-elsif blocks cannot be nested. +\end{itemize} + +When checks are needed that are not supported by SQL\TeX, a workaround can be implemented in the SQL code. + + +\subsection{Get input from external programs}\label{sqlsystem} + +The \texttt{\bs sqlsystem} command can be used to call commands at the operating system or external scripts and use their output in the location where the command was given. Any command arguments can be given in the command line. + +When used in a loop context (see section~\ref{loops}), \texttt{\bs sqluse} can also be used to provide data to the script. If command arguments must be given for database access, the following tags can be used: + +\begin{itemize} +\item[\texttt{<SRV>}] Name of the database server. +\item[\texttt{<USR>}] Username to connect to the database. +\item[\texttt{<PWD>}] Password to connect to the database. +\item[\texttt{<DB>}] Name of the database. +\end{itemize} + +They will be replaced by the credentials for connecting to the database (see section~\ref{opendb}). + + +\vs + +\noindent Example:\\ +\texttt{\bs sqlsystem\{./add\_vat --usr <USR> --db <DB> --pwd <PWD> \\ +--inv \bs sqluse\{invoice\_nr\}\}} + +\vs + +By default, use of this command is disallowed. To enable it, set the value of \texttt{sqlsystem\_allowed} to ``1'' in the configuration file (see also section~\ref{config}. + +If the command is disabled, occurances of this command will be replaced by the fixed text ``\texttt{use of the \bs sqlsystem command is disallowed in the configuration}''. + \subsection{Output multiple documents}\label{multidoc} A single input file can be created to generate more output files using the \texttt{--multidoc-numbered} or \texttt{--multidoc-named} commandline option. -The input document must contain the command \texttt{\bs sqlsetparams} without any options. The query that follows can return an unlimited number of rows all containing exactly 1 field: \\ -\texttt{\bs sqlsetparams\{SELECT NR FROM INVOICES WHERE PAY\_DATE = NULL\}} +The input document must contain the command \texttt{\bs sqlsetparams} without any options. The query that follows can return an unlimited number of rows: \\ +\texttt{\bs sqlsetparams\{SELECT NR, CUST\_NR FROM INVOICES WHERE REMINDERS = \$PAR1\}} \vs By processing this command, SQL\TeX\ builds a list with all values retrieved and -processes the input file again for each value.\\ +processes the input file again for each row.\\ In those runs, the queries are executed as described in the previous sections, -using the value as a parameter:\\ -\texttt{\bs sqlrow\{SELECT * FROM INVOICES WHERE NR = \$PAR1\}} +using the returned fields to replace \texttt{\$MPAR\textit{n}} placeholders, where \textit{n} starts with 1 and represents the fields in the order as they have been retrieved:\\ +\texttt{\bs sqlrow\{SELECT * FROM INVOICES WHERE NR = \$MPAR1\}} \\ +\texttt{\bs sqlrow\{SELECT * FROM CUSTOMER WHERE CUST\_NR = \$MPAR2\}} \vs @@ -595,9 +667,10 @@ document will be created, ignoring the \texttt{\bs sqlsetparams} command. \vs With the \texttt{--multidoc-numbered} option, output filenames will be numbered \texttt{\emph{filename}\_1.tex} to \texttt{\emph{filename}\_\emph{n}.tex}.\\ -With the \texttt{--multidoc-named} option, output filenames will be numbered \texttt{\emph{filename}\_\emph{parameter}.tex}, where \emph{parameter} is the value taken from the database (the incoie number \texttt{nr} in the example above). \\ +With the \texttt{--multidoc-named} option, output filenames will be numbered \\\texttt{\emph{filename}\_\emph{parameter}.tex}, where \emph{parameter} is the first value taken from the database (\texttt{\$MPAR1}, the invoice number \texttt{nr} in the example above). \\ Note the parameter will not be formatted to be filename-friendly!\\ + \subsection{Update database records} Since version 1.5, SQL\TeX\ supports database updates as well: \\ @@ -608,7 +681,7 @@ This command accepts no options. \vs -By default, the update statements will be ignored. The actually process them, the commandline options \texttt{--updates} must be given! +By default, the update statements will be ignored. To actually process them, the commandline options \texttt{--updates} must be given! \section{Process your SQL\TeX\ file} @@ -690,7 +763,7 @@ Default is \texttt{SQLTeX{\_}r.dat} in the same location where SQL\TeX\ is insta they appear on the command line, overwriting each other.\\ For backwards compatibility, \texttt{-rn} is also still supported. -\item[\texttt{--use-local-config, -l}] Use the current installation directory as default location for the config- and replacement files in stead of \texttt{/etc}\footnote{ linux only}. +\item[\texttt{--use-local-config, -l}]\footnote{ linux only} Use the current installation directory as default location for the config- and replacement files in stead of \texttt{/usr/local/etc}. \item[\texttt{--sqlserver \textit{server}, -s \textit{server}}] SQL server to connect to. Default is \texttt{localhost}. @@ -810,7 +883,7 @@ Otherwise, SQL\TeX\ exits. \\ \vspace{1mm} \noindent In multidocument mode, the lis of parameters retrieved on line -\textit{line nr} returned more than one fiels per row. \\ +\textit{line nr} returned more than one fields per row. \\ \textit{Action:} Check your query. \vs @@ -860,7 +933,7 @@ For bugs, questions and comments, please use the issue tracker available at \url \vspace{3mm} -\noindent Copyright\copyright\ 2001-2022 - Oscar van Eijk, Oveas Functionality Provider +\noindent Copyright\copyright\ 2001-2024 - Oscar van Eijk, Oveas Functionality Provider \noindent\hrulefill \\ @@ -870,6 +943,16 @@ see \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html}. \section{History} \begin{description} +\item[v2.2] \textit{released: Jul 31, 2024} +\begin{itemize} +\item Extended the default replace file (see \ref{replfiles}) with more special characters (e.g. with diacritics) and HTML tags. +\item Issue \#6 (\url{https://github.com/oveas/sqltex/issues/6}): added support for ODBC drivers +\item Issue \#8 (\url{https://github.com/oveas/sqltex/issues/8}): added support for parameter-driven in \texttt{\bs sqlsetparams} statements (multi-document mode).\\ +\textit{\textbf{Note:}} This requires an update of your input files for multi-document mode that have been created before v2.2. Refer to section \ref{mdocupdates} for details. +\item Added the \texttt{\bs sqlsystem} command. +\item Added the \texttt{\bs sqlif}-\texttt{\bs sqlendif} control block. +\end{itemize} + \item[v2.1] \textit{released: Jan 21, 2022} \begin{itemize} \item Fix bug \#2 (\url{https://github.com/oveas/sqltex/issues/2}): standard path management for output files.\\ @@ -886,7 +969,6 @@ See config item \texttt{def\_out\_is\_in} in section \ref{config} to revert to p \item Added option \texttt{--use-local-config}. \end{itemize} - \item[v2.0] \textit{released: Jan 12, 2016} \begin{itemize} \item Fix: Oracle support using ORASID @@ -918,4 +1000,16 @@ First public release \end{description} +\subsection{Changes that require updates in your input files} + +\subsubsection{Multi-document mode since v2.2}\label{mdocupdates} + +Up until v2.1, the statement in \texttt{\bs sqlsetparams} could return only one field per row and the statement itself could not handle parameters. The placeholder \texttt{\$PAR1} was reserved for the subsequent statements. + +Since v2.2 it is possible to retrieve multiple values per row. They will replace the placeholders \texttt{\$MPAR\textit{n}} in the subsequent statements, while \texttt{\$PAR\textit{n}} placeholders can now also be used for regular parametes in the \texttt{\bs sqlsetparams} statement itself. + +\vs + +This means, in input documents created before v2.2, all ``\texttt{\$PAR1}'' placeholders must be replaced by ``\texttt{\$MPAR1}''. + \end{document} diff --git a/support/SQLTeX/install-sh b/support/SQLTeX/install-sh index 59990a1049..ec298b5374 100755 --- a/support/SQLTeX/install-sh +++ b/support/SQLTeX/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2014-09-12.12; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -271,15 +295,18 @@ do fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,27 +315,16 @@ do fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -318,50 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # $RANDOM is not portable (e.g. dash); use it when possible to - # lower collision chance - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # As "mkdir -p" follows symlinks and we work in /tmp possibly; so - # create the $tmpdir first (and fail if unsuccessful) to make sure - # that nobody tries to guess the $tmpdir name. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -372,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -401,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -434,14 +449,25 @@ do else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -467,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -481,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 @@ -500,9 +533,9 @@ do done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/support/SQLTeX/man/Makefile.am b/support/SQLTeX/man/Makefile.am index 26b80bc375..f10c3cf610 100644 --- a/support/SQLTeX/man/Makefile.am +++ b/support/SQLTeX/man/Makefile.am @@ -6,10 +6,11 @@ DISTFILES = Makefile.am Makefile.in SQLTeX.man all : SQLTeX.1 : SQLTeX.man - cat $^ | sed -e 's#{BINDIR}#$(bindir)#;s#{SYSCONFDIR}#$(sysconfdir)#' > $@ + @cat $^ | sed -e 's#{BINDIR}#$(bindir)#;s#{SYSCONFDIR}#$(sysconfdir)#' > $@ distdir : ${DISTFILES} cp ${DISTFILES} $(distdir) install: SQLTeX.1 + @if [ ! -d ${mandir} ]; then mkdir -p ${mandir}; fi cp $^ ${mandir}/man1 diff --git a/support/SQLTeX/man/Makefile.in b/support/SQLTeX/man/Makefile.in index 530e2bda19..ff94a3a8af 100644 --- a/support/SQLTeX/man/Makefile.in +++ b/support/SQLTeX/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -125,11 +125,14 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -214,8 +217,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -232,6 +235,37 @@ ctags CTAGS: cscope cscopelist: + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am all-am: Makefile @@ -352,12 +386,13 @@ uninstall-am: all : SQLTeX.1 : SQLTeX.man - cat $^ | sed -e 's#{BINDIR}#$(bindir)#;s#{SYSCONFDIR}#$(sysconfdir)#' > $@ + @cat $^ | sed -e 's#{BINDIR}#$(bindir)#;s#{SYSCONFDIR}#$(sysconfdir)#' > $@ distdir : ${DISTFILES} cp ${DISTFILES} $(distdir) install: SQLTeX.1 + @if [ ! -d ${mandir} ]; then mkdir -p ${mandir}; fi cp $^ ${mandir}/man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/support/SQLTeX/man/SQLTeX.man b/support/SQLTeX/man/SQLTeX.man index d685815e7a..daf9dfb4f7 100644 --- a/support/SQLTeX/man/SQLTeX.man +++ b/support/SQLTeX/man/SQLTeX.man @@ -100,7 +100,7 @@ Prefix used in the SQLTeX file. Default is 'sql' (see documentation) Run in quiet mode .IP "\fB-r|--replacementfile\fP <file>" -Specify a file that contains replace characters. This is a list with two tab- seperated fields per line. The first field holds a string that will be replaced in the SQL output by the second string. +Specify a file that contains replace characters. This is a list with two tab-separated fields per line. The first field holds a string that will be replaced in the SQL output by the second string. .IP "\fB-R|-rn|--no-replacementfile\fP" Do not use a replace file. '--replacementfile' '--no-replacementfile' are handled in the same order as they appear on the command line. diff --git a/support/SQLTeX/missing b/support/SQLTeX/missing index f62bbae306..1fe1611f18 100755 --- a/support/SQLTeX/missing +++ b/support/SQLTeX/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ else exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/support/SQLTeX/src/Makefile.am b/support/SQLTeX/src/Makefile.am index b8194eeba5..c15c25ba5b 100644 --- a/support/SQLTeX/src/Makefile.am +++ b/support/SQLTeX/src/Makefile.am @@ -16,5 +16,13 @@ SQLTeX: SQLTeX.pl @chmod +x $@ install : SQLTeX ${DATAFILES} - @cp $< $(bindir) - @cp $(DATAFILES) $(sysconfdir) + @if [ ! -d ${bindir} ]; then mkdir -p ${bindir}; fi + @if [ ! -d ${sysconfdir} ]; then mkdir -p ${sysconfdir}; fi + cp $< $(bindir) + @$(foreach datafile, $(DATAFILES), \ + if [ -e $(sysconfdir)/$(datafile) ]; \ + then echo 'cp $(datafile) $(sysconfdir)/$(datafile).new'; \ + cp $(datafile) $(sysconfdir)/$(datafile).new; \ + else echo 'cp $(datafile) $(sysconfdir)/$(datafile)'; \ + cp $(datafile) $(sysconfdir)/$(datafile); \ + fi;) diff --git a/support/SQLTeX/src/Makefile.in b/support/SQLTeX/src/Makefile.in index 234100000c..bae98236db 100644 --- a/support/SQLTeX/src/Makefile.in +++ b/support/SQLTeX/src/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -125,11 +125,14 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ +ETAGS = @ETAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -216,8 +219,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -234,6 +237,37 @@ ctags CTAGS: cscope cscopelist: + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done check-am: all-am check: check-am all-am: Makefile @@ -361,8 +395,16 @@ SQLTeX: SQLTeX.pl @chmod +x $@ install : SQLTeX ${DATAFILES} - @cp $< $(bindir) - @cp $(DATAFILES) $(sysconfdir) + @if [ ! -d ${bindir} ]; then mkdir -p ${bindir}; fi + @if [ ! -d ${sysconfdir} ]; then mkdir -p ${sysconfdir}; fi + cp $< $(bindir) + @$(foreach datafile, $(DATAFILES), \ + if [ -e $(sysconfdir)/$(datafile) ]; \ + then echo 'cp $(datafile) $(sysconfdir)/$(datafile).new'; \ + cp $(datafile) $(sysconfdir)/$(datafile).new; \ + else echo 'cp $(datafile) $(sysconfdir)/$(datafile)'; \ + cp $(datafile) $(sysconfdir)/$(datafile); \ + fi;) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/support/SQLTeX/src/SQLTeX.cfg b/support/SQLTeX/src/SQLTeX.cfg index 0ba20c4ff5..1dd33f05d9 100644 --- a/support/SQLTeX/src/SQLTeX.cfg +++ b/support/SQLTeX/src/SQLTeX.cfg @@ -1,7 +1,11 @@ -# Pg, Sybase, Oracle, Ingres, mSQL, ... +# Pg, Sybase, Oracle, Ingres, mSQL, ODBC,... # dbdriver = mysql +# Driver for ODBC, ignored for other databases +# +odbc_driver = SQL Server + # SID for Oracle users, ignored for other databases # oracle_sid = ORASID @@ -33,7 +37,7 @@ rfile_comment = ; rfile_regexploc = ... rfile_regexp = re(...) -# Commend section. All SQLTeX commands start with <cmd_prefix> and are followed +# Command section. All SQLTeX commands start with <cmd_prefix> and are followed # by the actual command. Change this only if latex commands are used that conflict # with the defaults. # @@ -47,11 +51,18 @@ sql_start = start sql_end = end sql_use = use -# Are the commands 'less' and/or 'ore' available on this system ? +# Are the commands 'less' and/or 'more' available on this system ? # less_av = 1 more_av = 1 +# Defines if the \sqlsystem{} command is allowed. +# This is disabled by default, enable only if you are sure no SQLTeX files can be called that +# might harm your system +# +sqlsystem_allowed = 0 + + # The values below are used internally only. There's no need to change these, # unless there are conflicts. Refer to the documentation for more info. # diff --git a/support/SQLTeX/src/SQLTeX.pl b/support/SQLTeX/src/SQLTeX.pl index e44daede41..29d1d2d20b 100644 --- a/support/SQLTeX/src/SQLTeX.pl +++ b/support/SQLTeX/src/SQLTeX.pl @@ -13,7 +13,7 @@ # This software is subject to the terms of the LaTeX Project Public License; # see http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html. # -# Copyright: (c) 2001-2022, Oscar van Eijk, Oveas Functionality Provider +# Copyright: (c) 2001-2024, Oscar van Eijk, Oveas Functionality Provider # ========== oscar@oveas.com # # History: @@ -24,6 +24,10 @@ # v1.5 Nov 23, 2007 # v2.0 Jan 12, 2016 # v2.1 Jan 21, 2022 +# v2.1-1 Apr 19, 2022 (test version for MSSQL, no official release) +# v2.1-2 Jun 25, 2023 (test version parameter in sql_setparams(), no official release) +# v2.1-3 Nov 30, 2023 (test version \sqlif-\sqlendif & \sqlsystem, no official release) +# v2.2 Jul 31, 2024 # Refer to the documentation for changes per release # # TODO: @@ -32,7 +36,7 @@ # ################################################################################ # -use strict; +#use strict; use DBI; use Getopt::Long; use Term::ReadKey; @@ -220,7 +224,7 @@ sub print_help { $helptext .= " run in quiet mode\n"; $helptext .= " --replacementfile <file>\n"; $helptext .= " -r <file>\n"; - $helptext .= " specify a file that contains replace characters. This is a list with two tab- seperated\n"; + $helptext .= " specify a file that contains replace characters. This is a list with two tab-separated\n"; $helptext .= " fields per line. The first field holds a string that will be replaced in the SQL output\n"; $helptext .= " by the second string.\n"; $helptext .= " By default the file \'$main::config_location/SQLTeX_r.dat\' is used.\n"; @@ -292,6 +296,7 @@ sub get_password ($$) { } } ReadMode(0); + print "\n"; return $pwd; } @@ -432,6 +437,13 @@ sub get_filenames { return; } +##### +# Trim functions +# +sub ltrim { my $s = shift; $s =~ s/^\s+//; return $s }; +sub rtrim { my $s = shift; $s =~ s/\s+$//; return $s }; +sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; + ####### # Connect to the database # @@ -502,19 +514,37 @@ sub db_connect($$) { } elsif ($main::configuration{'dbdriver'} eq "Sybase") { $data_source = "DBI:$main::configuration{'dbdriver'}:$db"; $data_source .= ";server=$hn" unless ($hn eq ""); + } elsif ($main::configuration{'dbdriver'} eq "ODBC") { + if (!exists ($main::configuration{'odbc_driver'})) { + $main::configuration{'odbc_driver'} = 'SQL Server'; + } + if ($hn eq "") { + $hn = 'localhost'; + } + $data_source = "DBI:ODBC:Driver={$main::configuration{'odbc_driver'}};Server=$hn"; + $data_source .= ";Database=$db"; + $data_source .= ";UID=$un" unless ($un eq ""); + $data_source .= ";PWD=$pw" unless ($pw eq ""); } else { # MySQL, mSQL, ... $data_source = "DBI:$main::configuration{'dbdriver'}:database=$db"; $data_source .= ";host=$hn" unless ($hn eq ""); } } - if (!defined $main::options{'q'}) { my $msg = "Connect to database $db on "; - $msg .= $hn|| 'localhost'; + $msg .= $hn || 'localhost'; $msg .= " as user $un" unless ($un eq ''); $msg .= " using a password" unless ($pw eq ''); &print_message ($msg); } + if ($main::configuration{'sqlsystem_allowed'}) { + %main::connect_info = ( + 'hn' => $hn + ,'un' => $un + ,'pw' => $pw + ,'db' => $db + ); + } $main::db_handle = DBI->connect ($data_source, $un, $pw, { RaiseError => 0, PrintError => 1 }) || &just_died (1); # TODO Proper errorhandling return; } @@ -586,9 +616,9 @@ sub replace_values ($) { ##### # Select multiple rows from the database. This function can have # the [fldsep=s] and [rowsep=s] options to define the string which -# should be used to seperate the fields and rows. -# By default, fields are seperated with a comma and blank (', '), and rows -# are seperated with a newline character ('\\') +# should be used to separate the fields and rows. +# By default, fields are separated with a comma and blank (', '), and rows +# are separated with a newline character ('\\') # sub sql_row ($$) { my ($options, $query) = @_; @@ -702,7 +732,12 @@ sub sql_start ($) { # sub sql_use ($$) { my ($field, $loop) = @_; - return $main::arr[$#main::current_array][$loop]->{$field}; + my $return_value = $main::configuration{'no_such_used_fld'}; + if ($main::arr[$#main::current_array][$loop]->{$field}) { + $return_value = $main::arr[$#main::current_array][$loop]->{$field}; + } + return $return_value; + } @@ -716,6 +751,25 @@ sub sql_end () { for (my $lines = 0; $lines < $#{$main::loop_data[$#main::current_array]}; $lines++) { my $buffered_line = ${$main::loop_data[$#main::current_array]}[$lines]; my $cmdPrefix = $main::configuration{'alt_cmd_prefix'}; + if ($buffered_line =~ s/\\$cmdPrefix$main::configuration{'sql_endif'}\{\}//) { + $main::if_enabled = 1; + } + if ($buffered_line =~ /\\$cmdPrefix$main::configuration{'sql_if'}/) { + my $lin1 = $`; + my $lin2 = $'; + $lin2 =~ s/^\{//; + $lin2 =~ /\}/; + my $statement = $`; + $lin2 = $'; + $main::if_enabled = &sql_if($statement, $cnt); + $buffered_line = $lin1; + if ($main::if_enabled) { + $buffered_line .= $lin2; + } + } + if (!$main::if_enabled) { + next; + } while (($buffered_line =~ /\\$cmdPrefix[a-z]+(\[|\{)/) && !($buffered_line =~ /\\\\$cmdPrefix[a-z]+(\[|\{)/)) { my $cmdfound = $&; $cmdfound =~ s/\\//; @@ -727,10 +781,32 @@ sub sql_end () { $buffered_line =~ /\}/; my $statement = $`; my $lin2 = $'; + if ($cmdfound =~ /$main::configuration{'sql_use'}/) { $buffered_line = $lin1 . &sql_use($statement, $cnt) . $lin2; } } + if ($buffered_line =~ /\\$main::configuration{'last_cmd_prefix'}$main::configuration{'sql_system'}/) { + my $cmdfound = $&; + $cmdfound =~ s/\\//; + $cmdfound =~ s/\{/\\\{/; + + $buffered_line =~ /\\$cmdfound/; + my $lin1 = $`; + $buffered_line = $'; + $buffered_line =~ /\}/; + my $statement = $`; + my $lin2 = $'; + $statement =~ s/^\{//; + + while ($buffered_line =~ /\\$main::configuration{'alt_cmd_prefix'}$main::configuration{'sql_use'}\{(\w+)\}/) { + my $usereplacement = &sql_use($1, $cnt); + $buffered_line =~ s/\\$main::configuration{'last_cmd_prefix'}$main::configuration{'sql_use'}\{(\w+)\}/$usereplacement/; + } + if ($cmdfound =~ /$main::configuration{'sql_system'}/) { + $buffered_line = $lin1 . &sql_system($statement) . $lin2; + } + } $result .= $buffered_line; } } @@ -739,16 +815,66 @@ sub sql_end () { return $result; } +##### +# Start a conditional block +# +sub sql_if ($$) { + my ($condition, $cnt) = @_; + if ($condition =~ /(&&|\|\|)/) { + my $c1 = &check_condition($`, $cnt); + my $c2 = &check_condition($', $cnt); + return eval("$c1 $& $c2"); + } else { + return &check_condition($condition, $cnt); + } +} +##### +# Helper function for sql_if +# +sub check_condition ($$) { + my ($condition, $cnt) = @_; + $condition =~ /(==|!=|<|>|<=|>=)/; + + my $lval = $`; + my $rval = $'; + my $comparisson = $&; + $lval = &trim($lval); + $rval = &trim($rval); + + my $uf = &sql_use($lval, $cnt); + if ($uf ne $main::configuration{'no_such_used_fld'}) { + $lval = $uf; + } + $uf = &sql_use($rval, $cnt); + if ($uf ne $main::configuration{'no_such_used_fld'}) { + $rval = $uf; + } + + my $result = 0; + if ($comparisson eq "==") { + $result = ($lval == $rval); + } elsif ($comparisson eq '!=') { + $result = ($lval != $rval); + } elsif ($comparisson eq '<') { + $result = ($lval < $rval); + } elsif ($comparisson eq '>') { + $result = ($lval > $rval); + } elsif ($comparisson eq '<=') { + $result = ($lval <= $rval); + } elsif ($comparisson eq '>=') { + $result = ($lval >= $rval); + } + return $result; +} ##### -# Select a (list of) single field(s) from the database. This list is used in -# multidocument mode as the first parameter in all queries. -# Currently, only 1 parameter per run is supported. +# Select a list of rows from the database. Each row will be input +# for a document in multidocument mode. # sub sql_setparams ($$) { my ($options, $query) = @_; - my (@values, @return_values, $rc); + my (@values, @return_values); &check_options ($options); @@ -757,18 +883,19 @@ sub sql_setparams ($$) { my $stat_handle = $main::db_handle->prepare ($query); $stat_handle->execute (); - while (@values = $stat_handle->fetchrow_array ()) { - &just_died (9) if ($#values > 0); # Only one allowed TODO Proper errorhandling - push @return_values, @values; + for (my $i = 0; @values = $stat_handle->fetchrow_array (); $i++) { + for ($j = 0; $j <= $#values; $j++) { + $return_values[$i][$j] = $values[$j]; + } } + $stat_handle->finish (); if ($#return_values < 0) { &just_died (8); # TODO Proper errorhandling } - $rc = $#return_values + 1; - &print_message ("Multidocument parameters found; $rc documents will be created: handle document $main::multidoc_cnt"); + &print_message ('Multidocument parameters found; ' . $#return_values+1 ." documents will be created: handle document $main::multidoc_cnt") unless ($main::multidoc_cnt == 0); return (@return_values); } @@ -792,6 +919,23 @@ sub sql_update ($$) { &print_message ("$rc rows updated"); } +#### +# Call an external script or system command +# +sub sql_system ($) { + my $cmd = shift; + + my $return_value = '\\textbf{use of the \\textbackslash sqlsystem command is disallowed in the configuration}'; + if ($main::configuration{'sqlsystem_allowed'}) { + $cmd =~ s/\<SRV\>/$main::connect_info{'hn'}/; + $cmd =~ s/\<USR\>/$main::connect_info{'un'}/; + $cmd =~ s/\<PWD\>/$main::connect_info{'pw'}/; + $cmd =~ s/\<DB\>/$main::connect_info{'db'}/; + $return_value = `$cmd`; + } + return $return_value; +} + ##### # Some error handling (mainly cleanup stuff) # Files will be closed if opened, and if no sql output was written yet, @@ -833,14 +977,16 @@ sub just_died ($) { $msg = "trying to overwrite an existing variable on line $main::lcount[$main::fcount]"; } elsif ($step == 8) { $msg = "no parameters for multidocument found on line $main::lcount[$main::fcount]"; - } elsif ($step == 9) { - $msg = "too many fields returned in multidocument mode on $main::lcount[$main::fcount]"; +# } elsif ($step == 9) { +# $msg = "too many fields returned in multidocument mode on $main::lcount[$main::fcount]"; } elsif ($step == 10) { $msg = "unrecognized command on line $main::lcount[$main::fcount]"; } elsif ($step == 11) { $msg = "start using a non-existing array on line $main::lcount[$main::fcount]"; } elsif ($step == 12) { $msg = "\\sqluse command encountered outside loop context on line $main::lcount[$main::fcount]"; + } elsif ($step == 13) { + $msg = "\\sqlif command encountered outside loop context on line $main::lcount[$main::fcount]"; } if ($main::fcount > 0) { for (my $fcnt = 0; $fcnt < $main::fcount; $fcnt++) { @@ -884,43 +1030,51 @@ sub parse_command ($$$) { my $statement = $`; my $lin2 = $'; + my $raw_statement = $statement; + $raw_statement =~ s/^\{//; $statement =~ s/(\[|\{)//g; if ($statement =~ /\]/) { $options = $`; $statement = $'; } - if ($varallowed) { if (($main::multidoc_cnt > 0) && $main::multidoc) { - $statement =~ s/\$PAR1/$multidoc_par/g; - } else { - for (my $i = 1; $i <= $#ARGV; $i++) { - $statement =~ s/\$PAR$i/$ARGV[$i]/g; + for (my $i = 1; $i <= $#main::parameters; $i++) { + $statement =~ s/\$MPAR$i/$main::parameters[$main::multidoc_cnt-1][$i-1]/g; } } + for (my $i = 1; $i <= $#ARGV; $i++) { + $statement =~ s/\$PAR$i/$ARGV[$i]/g; + } while ($statement =~ /\$VAR[0-9]/) { my $varno = $&; $varno =~ s/\$VAR//; &just_died (6) if (!defined ($main::var[$varno])); # TODO Proper errorhandling $statement =~ s/\$VAR$varno/$main::var[$varno]/g; } - &just_died (3) if ($statement =~ /\$PAR/ && ($main::multidoc_cnt > 0) && $main::multidoc); # TODO Proper errorhandling + if ($statement =~ /\$PAR/ && ($main::multidoc_cnt > 0) && $main::multidoc) { + print "Did you update your input file to reflect the changes in v2.2?\n"; + print "Multidoc parameters are now used to replace \$MPARn (was \$PARn).\n"; + print "Please check the documentation for more info.\n"; + die ("No parameters found to replace in multidoc mode"); + } $statement =~ s/\{//; } - if ($cmdfound =~ /$main::configuration{'sql_open'}/) { + $cmdfound =~ s/^$main::configuration{'cmd_prefix'}//; + if ($cmdfound eq $main::configuration{'sql_open'} + ) { &db_connect($options, $statement); $main::db_opened = 1; return 0; } &just_died (2) if (!$main::db_opened); # TODO Proper errorhandling - - if ($cmdfound =~ /$main::configuration{'sql_field'}/) { + if ($cmdfound eq $main::configuration{'sql_field'}) { $main::line = $lin1 . &sql_field($options, $statement) . $lin2; - } elsif ($cmdfound =~ /$main::configuration{'sql_row'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_row'}) { $main::line = $lin1 . &sql_row($options, $statement) . $lin2; - } elsif ($cmdfound =~ /$main::configuration{'sql_params'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_params'}) { if ($main::multidoc) { # Ignore otherwise @main::parameters = &sql_setparams($options, $statement); $main::line = $lin1 . $lin2; @@ -928,21 +1082,27 @@ sub parse_command ($$$) { } else { $main::line = $lin1 . $lin2; } - } elsif ($cmdfound =~ /$main::configuration{'sql_update'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_update'}) { &sql_update($options, $statement); $main::line = $lin1 . $lin2; - } elsif ($cmdfound =~ /$main::configuration{'sql_start'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_start'}) { &sql_start($statement); $main::line = $lin1 . $lin2; - } elsif ($cmdfound =~ /$main::configuration{'sql_use'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_use'}) { &just_died (12) if (!@main::current_array); # TODO Proper errorhandling $main::line = $lin1 . "\\" . $main::configuration{'alt_cmd_prefix'} . $main::configuration{'sql_use'} . "{" . $statement . "}" . $lin2; # Restore the line, will be processed later - } elsif ($cmdfound =~ /$main::configuration{'sql_end'}/) { + } elsif ($cmdfound eq $main::configuration{'sql_end'}) { $main::line = $lin1 . &sql_end() . $lin2; + } elsif ($cmdfound eq $main::configuration{'sql_endif'}) { + $main::line = $lin1 . "\\" . $main::configuration{'alt_cmd_prefix'} . $main::configuration{'sql_endif'} . "{}" . $lin2; # Restore the line, will be processed later + } elsif ($cmdfound eq $main::configuration{'sql_if'}) { + &just_died (13) if (!@main::current_array); # TODO Proper errorhandling + $main::line = $lin1 . "\\" . $main::configuration{'alt_cmd_prefix'} . $main::configuration{'sql_if'} . "{" . $statement . "}" . $lin2; # Restore the line, will be processed later + } elsif ($cmdfound =~ /$main::configuration{'sql_system'}/) { + $main::line = $lin1 . &sql_system($raw_statement) . $lin2; } else { &just_died (10); # TODO Proper errorhandling } - return 0; } @@ -960,6 +1120,7 @@ sub read_input($$$$) { while ($main::line = <$fileIn>) { $main::lcount[$main::fcount]++; + next if ($main::line =~ /^\s*%/); if ($main::line =~ /(.*?)(\\in(put|clude))(\s*?)\{(.*?)\}(.*)/) { print $output_handle "$1" unless ($output_handle == -1); @@ -968,6 +1129,10 @@ sub read_input($$$$) { print $output_handle "$6\n" unless ($output_handle == -1); } my $cmdPrefix = $main::configuration{'cmd_prefix'}; + if (@main::current_array) { + # Inside loop contect the \sqlsystem{} command can contain \sqluse{} + $main::line =~ s/$cmdPrefix$main::configuration{'sql_system'}/$main::configuration{'last_cmd_prefix'}$main::configuration{'sql_system'}/; + } while (($main::line =~ /\\$cmdPrefix[a-z]+(\[|\{)/) && !($main::line =~ /\\\\$cmdPrefix[a-z]+(\[|\{)/)) { if (&parse_command($&, $multidoc_par, $fileIn) && $main::multidoc && ($main::multidoc_cnt == 0)) { close $fileIn; @@ -1003,7 +1168,7 @@ sub process_file { $main::saved_outfile_template = $main::outputfile if ($main::multidoc_cnt == 1); # New global name; should be a static $main::outputfile = $main::saved_outfile_template if ($main::multidoc_cnt > 1); $main::outputfile =~ s/\#M\#/$main::multidoc_cnt/; - $main::outputfile =~ s/\#P\#/$main::parameters[($main::multidoc_cnt-1)]/; + $main::outputfile =~ s/\#P\#/$main::parameters[($main::multidoc_cnt-1)][0]/; $multidoc_par = @main::parameters[$main::multidoc_cnt - 1]; } my $fileOut; @@ -1043,6 +1208,7 @@ sub process_file { ,'rfile_regexploc' => '...' ,'rfile_regexp' => 're(...)' ,'cmd_prefix' => 'sql' + ,'sql_system' => 'system' ,'sql_open' => 'db' ,'sql_field' => 'field' ,'sql_row' => 'row' @@ -1051,8 +1217,13 @@ sub process_file { ,'sql_start' => 'start' ,'sql_end' => 'end' ,'sql_use' => 'use' + ,'sql_if' => 'if' + ,'sql_endif' => 'endif' + ,'sqlsystem_allowed'=> 0 ,'repl_step' => 'OSTX' ,'alt_cmd_prefix' => 'processedsqlcommand' + ,'last_cmd_prefix' => 'lastsqlcommand' + ,'no_such_used_fld' => '\textit{SQL\TeX\ use-field does not exist}' ); ##### @@ -1062,6 +1233,7 @@ sub process_file { my @dir_list = split /\//, $0; pop @dir_list; $main::my_location = join '/', @dir_list; + $main::if_enabled = 1; if (&is_linux) { $main::config_location = '{SYSCONFDIR}'; @@ -1072,14 +1244,15 @@ sub process_file { # Check config # Used for loops, should not start with $main::configuration{'cmd_prefix'} !! -if ($main::configuration{'alt_cmd_prefix'} =~ /^$main::configuration{'cmd_prefix'}/) { - die "Configuration item 'alt_cmd_prefix' cannot start with $main::configuration{'cmd_prefix'}"; +if ($main::configuration{'alt_cmd_prefix'} =~ /^$main::configuration{'cmd_prefix'}/ + || $main::configuration{'last_cmd_prefix'} =~ /^$main::configuration{'cmd_prefix'}/) { + die "Configuration items 'alt_cmd_prefix' and ĺast_cnd_prefix' cannot start with $main::configuration{'cmd_prefix'}"; } $main::myself = $0; -$main::version = '2.1'; -$main::rdate = 'Jan 21, 2022'; +$main::version = '2.2'; +$main::rdate = 'Jul 31, 2024'; &parse_options; if (defined $main::options{'l'}) { @@ -1094,7 +1267,7 @@ if (defined $main::configurationfile) { next if ($main::line =~ /^\s*#/); next if ($main::line =~ /^\s*$/); chomp $main::line; - my ($ck, $cv) = split /=/, $main::line; + my ($ck, $cv) = split /=/, $main::line, 2; $ck =~ s/\s//g; $cv =~ s/\s//g; if ($cv ne '') { diff --git a/support/SQLTeX/src/SQLTeX_r.dat b/support/SQLTeX/src/SQLTeX_r.dat index c4f56bda08..e71e66f82b 100644 --- a/support/SQLTeX/src/SQLTeX_r.dat +++ b/support/SQLTeX/src/SQLTeX_r.dat @@ -1,29 +1,134 @@ ; This file contains all characters or character sequences that ; will be be replaced by SQLTeX when the occur in the response ; of an SQL query. -; It is mainly used for escaping the (La)TeX special characters, -; but any value can be added here. +; ; The first column is the character (sequence) that will be replaced. ; The second column is the value to replace col 1 with. -; Columns are sepated with one or more tab- characters. +; Columns are separated with one or more tab characters. ; ; Note all values are case sensitive; if you add the line: ; LaTeX \LaTeX\ ; the word "latex" will be untouched, but "LaTeX" will be replaced. ; -; To replace using regular expressions, use 're(<regular expression>)' as key (or any other -; regexp indicator if that has been changed in the config file), e.g. +; To replace using regular expressions, use 're(<regular expression>)' +; as key (or any other regexp indicator if that has been changed in the +; config file), e.g. ; re(<p\.*?>) \paragraph*{} -; will replace all HTML <p> variants (<p style='font-size: normal'>, <p align='center'> etc) -; -$ \$ -_ \_ -% \% -& \& -< \texttt{<} -> \texttt{>} -{ \{ -} \} -# \# -~ \~{} -\ \ensuremath{\backslash} +; will replace all HTML <p> variants (<p style='font-size: normal'>, +; <p align='center'> etc) +; +; +; LaTeX special characters +; ------------------------ +; +$ \$ +_ \_ +% \% +& \& +< \texttt{<} +> \texttt{>} +{ \{ +} \} +# \# +~ \~{} +\ \ensuremath{\backslash} +; +; Diacretics +; ---------- +; +ñ \~{n} +â \^{a} +ä \"{a} +á \'{a} +à \`{a} +ç \c{c} +ê \^{e} +ë \"{e} +è \`{e} +é \'{e} +î \^{i} +ï \"{i} +í \'{i} +ì \`{i} +ô \^{o} +ö \"{o} +ó \'{o} +ò \`{o} +û \^{u} +ü \"{u} +ú \'{u} +ù \`{u} +ÿ \"{y} +; +; Other special characters +; ------------------------ +; +" '' +´ ' +
. + ' + ' + ' + ' + --- +± $\pm$ +; +; HTML special characters +; ----------------------- +; + \hspace{1em} +& \& +& \& +' ' +; +; HTML font types +; --------------- +; +re(<strong.*?>) \textbf{ +</strong> } +re(<em.*?>) \textit{ +</em> } +<del> \sout{ +</del> } +<sup> $^{ +</sup> }$ +; +; HTML links (ignored) +; -------------------- +; +re(<a .*?>) +</a> +; +; HTML sections and breaks +; ------------------------ +; +re(<p.*?>) +</p> \\[0pt] +re(<h1.*?>) \section{ +re(<h2.*?>) \subsection{ +re(<h3.*?>) \subsubsection{ +re(</h\d>) } +<br /> \\ +; +; HTML lists +; ---------- +; +<ul> \begin{itemize} +<li> \item\ +</li> +</ul> \end{itemize} +; +; HTML tables +; ----------- +; This is meant as an example only and outcommented. +; Replace the tabular with the desired number of columns +; before using this. +; +;re(<table.*?>) \begin{tabular}{lll} +;re(</?tbody>) +;re(<tr.*?>) +;</tr> \\ +;re(<td.*?>) +;</td> & +;</table> \end{tabular} \\ +; diff --git a/support/TeX4ht/source/ChangeLog b/support/TeX4ht/source/ChangeLog index f98f416574..258f73400f 100644 --- a/support/TeX4ht/source/ChangeLog +++ b/support/TeX4ht/source/ChangeLog @@ -1,3 +1,81 @@ +2024-09-03 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-fonts-noncjk.tex ( + ./tex4ht.dir/texmf/tex4ht/ht-fonts/unicode/bbm/bbm.htf + ): added support for the BBM font. Thanks to Arkady Benediktov. + * tex4ht-fonts-noncjk.tex ( + ./tex4ht.dir/texmf/tex4ht/ht-fonts/unicode/TeXvect10/vect10.htf + ./tex4ht.dir/texmf/tex4ht/ht-fonts/unicode/TeXvect10/vect.htf + ): fixed Esvect fonts characters. Thanks to Arkady Benediktov. + * tex4ht-mathml.tex (mathml.4ht): use actual arrow symbol defined in + the vect10.htf font. + +2024-08-27 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-mathml.tex (mathml.4ht): fixed support of upper case Greek + letters inside pictures. + https://tex.stackexchange.com/q/725157/2891 + +2024-08-19 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-4ht.tex (moderncv.4ht), + * tex4ht-html4.tex (html4.4ht): added support for the Moderncv + package. + https://tex.stackexchange.com/q/721180/2891 + +2024-08-13 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-4ht.tex (amsfonts.4ht): fixed support for \mathbb and + \mathfrak. + + * tex4ht-jats.tex (jats.4ht): added support for LaTeX + bibliographies. + +2024-08-11 Karl Berry <karl@freefriends.org> + + * tex4ht-mathml.tex (html-mml.4ht): copyright 2024. + +2024-08-02 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-mathml.tex (mathml.4ht): added "texsource" option. It will + keep the original LaTeX code as an annotation in MathML. + https://chat.stackexchange.com/rooms/154333/discussion-on-question-by-yannisl-alternatives-to-mathml-for-pdf-tagging + + * tex4ht-4ht.tex (esvect.4ht), + * tex4ht-mathml.tex (mathml.4ht): added support for the Esvect + package. + https://tex.stackexchange.com/a/723587/2891 + +2024-07-31 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-fonts-noncjk.tex ( + ./tex4ht.dir/texmf/tex4ht/ht-fonts/unicode/TeXvect10/vect10.htf + ): Added support for the vector font from the Esvect package. + https://tex.stackexchange.com/q/723560/2891 + +2024-07-28 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-mathjax.tex (mathjax-latex-4ht.4ht): don't add spaces after + LaTeX commands. + +2024-07-26 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-4ht.tex (tagpdf-hooks.4ht, tagpdf-base-hooks.4ht): removed + \__tag_whatsits definitions, they fix is no longer necessary. + https://github.com/michal-h21/make4ht/issues/145#issuecomment-2085215582 + +2024-07-07 Karl Berry <karl@freefriends.org> + + * Makefile (tex4ht_env_derived), + * tex4ht-env.tex: no longer generate tex4ht.env, just + .env-unix and .env-win32, since those are the only ones we use. + +2024-07-06 Michal Hoftich <michal.h21@gmail.com> + + * tex4ht-html4.tex (html4.4ht): added itemize+ option. It will keep + original characters for itemize bullets. + https://tex.stackexchange.com/a/722062/2891 + 2024-07-03 Michal Hoftich <michal.h21@gmail.com> * tex4ht-4ht.tex (fontawesome5.4ht): use icon name as the alt text. diff --git a/support/TeX4ht/source/Makefile b/support/TeX4ht/source/Makefile index fd6995f4a5..5328185f78 100644 --- a/support/TeX4ht/source/Makefile +++ b/support/TeX4ht/source/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile 1503 2024-04-18 22:51:03Z karl $ +# $Id: Makefile 1538 2024-07-07 15:55:16Z karl $ # This file is public domain. Originally written 2010, Karl Berry. # Assumes GNU make. @@ -138,7 +138,7 @@ tex4ht_docbook_xtpipes_derived = docbook.4xt $(wd)/src/DbUtilities.java endif derived += $(tex4ht_env_derived) -tex4ht_env_derived = tex4ht.env-unix tex4ht.env-win32 tex4ht.env +tex4ht_env_derived = tex4ht.env-unix tex4ht.env-win32 derived += $(tex4ht_fonts_cjk_derived) tex4ht_fonts_cjk_derived = \ diff --git a/support/TeX4ht/source/mktex4ht-cnf.tex b/support/TeX4ht/source/mktex4ht-cnf.tex index 7bc692fff6..ee48ba93f7 100644 --- a/support/TeX4ht/source/mktex4ht-cnf.tex +++ b/support/TeX4ht/source/mktex4ht-cnf.tex @@ -1,4 +1,4 @@ -% $Id: mktex4ht-cnf.tex 1523 2024-05-27 14:16:04Z michal_h21 $ +% $Id: mktex4ht-cnf.tex 1547 2024-08-19 14:07:03Z michal_h21 $ % Manually-maintained file, listing *.4ht files created by tex4ht-4ht.tex. % Read by tex4ht-cond4ht. % @@ -238,6 +238,7 @@ \AddFile{9}{europecv} \AddFile{9}{resume} \AddFile{9}{curve} +\AddFile{9}{moderncv} \AddFile{9}{vowel} \AddFile{9}{enumitem} \AddFile{9}{esperanto} @@ -415,4 +416,5 @@ \AddFile{9}{fontawesome5} \AddFile{9}{mhchem} \AddFile{9}{chemfig} +\AddFile{9}{esvect} % \AddFile{9}{mktex4ht} diff --git a/support/TeX4ht/source/tex4ht-4ht.tex b/support/TeX4ht/source/tex4ht-4ht.tex index f3617f3757..53643102d6 100644 --- a/support/TeX4ht/source/tex4ht-4ht.tex +++ b/support/TeX4ht/source/tex4ht-4ht.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-4ht.tex 1536 2024-07-03 12:08:13Z michal_h21 $ +% $Id: tex4ht-4ht.tex 1549 2024-09-03 14:46:00Z michal_h21 $ % tex tex4ht-4ht or ht tex tex4ht-4ht % % Copyright 2009-2024 TeX Users Group @@ -5100,13 +5100,14 @@ as it leads to a fatal error. \Configure{PackageHooks}{tagpdf.sty}{tagpdf-hooks.4ht} >>> +% This is no longer useful, it was fixed in tagpdf code +% \cs_set_protected:Npn \__tag_whatsits: {} + \<tagpdf-hooks.4ht\><<< % tagpdf-hooks.4ht (|version), generated from |jobname.tex % Copyright 2022-2024 TeX Users Group |<TeX4ht license text|> \ExplSyntaxOn -% ignore tagpdf's specials -\cs_set_protected:Npn \__tag_whatsits: {} \ExplSyntaxOff \:AtEndOfPackage{% \RenewDocumentCommand \tagpdfsetup { m }{} @@ -5118,16 +5119,17 @@ as it leads to a fatal error. \Configure{PackageHooks}{tagpdf-base.sty}{tagpdf-base-hooks.4ht} >>> -This file can be used explicitly, we need to provide the whatsits command -here as well. +This file can be used explicitly, we used to provide the whatsits command +here as well, but it is no longer neeeded. + +% ignore tagpdf's specials +% we use csname, because \ExplSyntaxOn .. Off caused catcode issues +% \expandafter\def\csname __tag_whatsits:\endcsname{} \<tagpdf-base-hooks.4ht\><<< % tagpd-base-hooks.4ht (|version), generated from |jobname.tex % Copyright 2024 TeX Users Group |<TeX4ht license text|> -% ignore tagpdf's specials -% we use csname, because \ExplSyntaxOn .. Off caused catcode issues -\expandafter\def\csname __tag_whatsits:\endcsname{} \endinput >>> \AddFile{9}{tagpdf-base-hooks} @@ -22277,14 +22279,14 @@ $$ \<amsfonts sty\><<<< \NewConfigure{mathbb}{2} -\def\:temp#1{{\a:mathbb \o:@mathbb:{#1}\b:mathbb}} -\HLet\@mathbb\:temp +\def\:temp#1{{\a:mathbb \o:mathbb:{#1}\b:mathbb}} +\HLet\mathbb\:temp >>> \<amsfonts sty\><<<< \NewConfigure{mathfrak}{2} -\def\:temp#1{{\a:mathfrak \o:@mathfrak:{#1}\b:mathfrak}} -\HLet\@mathfrak\:temp +\def\:temp#1{{\a:mathfrak \o:mathfrak:{#1}\b:mathfrak}} +\HLet\mathfrak\:temp >>> Commands like \''\rm' need low level implemetation through @@ -30145,6 +30147,173 @@ A style file for resumes. >>> %%%%%%%%%%%%%%%%%%%%%%%%% +\Section{moderncv} +%%%%%%%%%%%%%%%%%%%%%%%%% + +\<moderncv.4ht\><<< +% moderncv.4ht (|version), generated from |jobname.tex +% Copyright 2024 TeX Users Group +|<TeX4ht license text|> +|<moderncv configs|> +\Hinput{moderncv} +\endinput +>>>\AddFile{9}{moderncv} + +This is a bit messy. We had to redefine a bunch of commands from various +files that Moderncv uses, mostly to prevent compilation errors and to +insert some basic formatting. + +\<moderncv configs\><<< +\NewConfigure{section}{2} +\RenewDocumentCommand\section{sm}{\a:section #2\b:section} + +\NewConfigure{subsection}{2} +\RenewDocumentCommand\subsection{sm}{\a:subsection #2\b:subsection} + + +\NewConfigure{cvitem}{3} +\renewcommand*{\cvitem}[3][.25em]{ +\a:cvitem #2\b:cvitem #3\c:cvitem +} + +\NewConfigure{cvdoubleitem}{2} +\renewcommand*{\cvdoubleitem}[5][.25em]{% +\a:cvdoubleitem +\cvitem{#2}{#3} +\cvitem{#4}{#5} +\b:cvdoubleitem +} + +\NewConfigure{cvlistitem}{2} +\renewcommand*{\cvlistitem}[2][.25em]{% + \a:cvlistitem\cvitem[#1]{\listitemsymbol}{#2}\b:cvlistitem +} + +\NewConfigure{cvlistdoubleitem}{2} +\renewcommand*{\cvlistdoubleitem}[3][.25em]{% + \a:cvlistdoubleitem% + \cvitem[#1]{\listitemsymbol}{#2}% + \cvitem[#1]{\listitemsymbol}{#3}% + \b:cvlistdoubleitem% +} + +\NewConfigure{cvhead}{2} +\NewConfigure{cvphoto}{2} + + +\renewcommand*{\makecvhead}{% + \a:cvhead + % recompute lengths (in case we are switching from letter to resume, or vice versa) + \recomputecvlengths% + % optional detailed information (pre-rendering) + \@initializebox{\makecvheaddetailsbox}% + \if@details% + \def\phonesdetails{}% + \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number + \protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}% + \def\socialsdetails{}% + \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link + \protected@edef\socialsdetails{\socialsdetails\protect\makenewline\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}% + \savebox{\makecvheaddetailsbox}{% + \addressfont\color{color2}% + \if@left\begin{tabular}[b]{@{}r@{}}\fi% + \if@right\begin{tabular}[b]{@{}l@{}}\fi% + \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet% + \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty + \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}% + \ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol\@born}% + \phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict + \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}% + \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httpslink{\@homepage}}% + \socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict + \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}% + \end{tabular} + }\fi% + % optional photo (pre-rendering) + \@initializebox{\makecvheadpicturebox}% + \savebox{\makecvheadpicturebox}{% + \ifthenelse{\isundefined{\@photo}}% + {}% + {% + \a:cvphoto\includegraphics[]{\@photo}\b:cvphoto}% + }% + % name and title (pre-rendering) + \@initializelength{\makecvheaddetailswidth}\settowidth{\makecvheaddetailswidth}{\usebox{\makecvheaddetailsbox}}% + \@initializelength{\makecvheadpicturewidth}\settowidth{\makecvheadpicturewidth}{\usebox{\makecvheadpicturebox}}% + \ifthenelse{\lengthtest{\makecvheadnamewidth=0pt}}% check for dummy value (equivalent to \ifdim\makecvheadnamewidth=0pt) + {\setlength{\makecvheadnamewidth}{\textwidth-\makecvheaddetailswidth-\makecvheadpicturewidth}}% + {}% + \@initializebox{\makecvheadnamebox}% + \savebox{\makecvheadnamebox}{% + \begin{minipage}[b]{\makecvheadnamewidth}% + \if@left\raggedright\fi% + \if@right\raggedleft\fi% + \namestyle{\@firstname\ \@lastname}% + \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}% + \end{minipage}}% + % rendering + \if@left% + \usebox{\makecvheadnamebox}% + \hfill% + \llap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced + \usebox{\makecvheadpicturebox}\fi% + \if@right% + \usebox{\makecvheadpicturebox}% + \rlap{\usebox{\makecvheaddetailsbox}}% \llap is used to suppress the width of the box, allowing overlap if the value of makecvheadnamewidth is forced + \hfill% + \usebox{\makecvheadnamebox}\fi% + \\[2.5em]% + % optional quote + \ifthenelse{\isundefined{\@quote}}% + {}% + {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}% + \b:cvhead\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead + + +\RenewDocumentCommand\cvskilllegend{s +O{.25em} +O{\skillLegend@defaultLevelOne} +O{\skillLegend@defaultLevelTwo} +O{\skillLegend@defaultLevelThree} +O{\skillLegend@defaultLevelFour} +O{\skillLegend@defaultLevelFive} +m}{% +\begin{tabular}{l l l l l l} + \raggedleft\hintstyle{#8} & \cvskill{1}\, & \,{\skillLegend@FontSize #3} & \cvskill{3}\, &\,{\skillLegend@FontSize #5 } \\% + % + & \cvskill{2}\, & \,\multirow{2}{\cvskilllegend@leftdescriptorwidth}{{\skillLegend@FontSize #4}} & \cvskill{4}\, &\,{\skillLegend@FontSize #6 } \\% + % + & & & \cvskill{5}\, &\,{\skillLegend@FontSize #7 }% + \end{tabular}% +}% + + +\NewConfigure{cvskill}{2} +\def\:tempa#1{\def\:cvskillamount{#1}\a:cvskill\o:cvskill:{#1}\b:cvskill} +\HLet\cvskill\:tempa + +\NewConfigure{cvskillhead}{2} +\NewConfigure{cvskillentry}{2} +\RenewDocumentCommand\cvskillhead{O{.25em} +O{\skillMatrix@HeaderDefaultOne} +O{\skillMatrix@HeaderDefaultTwo} +O{\skillMatrix@HeaderDefaultThree} +O{\skillMatrix@HeaderDefaultFour}}{% + \begingroup + \a:cvskillhead + \begin{tabular}{ p{6em} p{12em} p{4em} p{20em}}% + { #2} & { #3} & { #4} & { #5} + \end{tabular}% + \b:cvskillhead + \endgroup + \par\addvspace{#1} +} + +\RenewDocumentCommand\cvskillentry{s +O{.25em} +m +m +m +m +m}{% +\a:cvskillentry +\cvitem{#3}{ + \begin{tabular}{ p{6em} p{12em} p{4em} p{20em}} + \centering \cvskill{#4} &\centering {#5} & \centering {#6} &{\itshape#7}% + \end{tabular}}% + \b:cvskillentry + \par\addvspace{#2} +} + +>>> + +%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%% \Chapter{Small Ones} %%%%%%%%%%%%%%%%%%%%%%%%% @@ -31408,6 +31577,25 @@ for output formats. \ExplSyntaxOff >>> +%%%%%%%%%%%%%%% +\Section{Esvect} +%%%%%%%%%%%%%%% + +\<esvect.4ht\><<< +% esvect.4ht (|version), generated from |jobname.tex +% Copyright 2024 TeX Users Group +|<TeX4ht license text|> +|<esvect redefinitions|> + +\Hinput{esvect} +\endinput +>>> \AddFile{9}{esvect} + + +\<esvect redefinitions\><<< +>>> + + %%%%%%%%%%%%% \Section{Ushort} %%%%%%%%%%%%% diff --git a/support/TeX4ht/source/tex4ht-env.tex b/support/TeX4ht/source/tex4ht-env.tex index 5d66aa43d0..3ac0f4443d 100644 --- a/support/TeX4ht/source/tex4ht-env.tex +++ b/support/TeX4ht/source/tex4ht-env.tex @@ -1,8 +1,8 @@ -% $Id: tex4ht-env.tex 1419 2023-12-11 23:23:52Z karl $ +% $Id: tex4ht-env.tex 1538 2024-07-07 15:55:16Z karl $ % latex tex4ht-env % or htlatex tex4ht-env "xhtml,3" % -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright 1997-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. @@ -1650,27 +1650,30 @@ Note: the permission option `S' takes into account also trailing spaces. \<unix copyright\><<< % tex4ht.env-unix (@version), generated from @jobname.tex -% (can be used as ~/.tex4ht) -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright @CopyYear.1997. Eitan M. Gurari @<TeX4ht copyright@>>>> \<private copyright\><<< % tex4ht.env (private) (@version), generated from @jobname.tex % (can be used as ~/.tex4ht) -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright @CopyYear.1997. Eitan M. Gurari @<TeX4ht copyright@>>>> \<win32 copyright\><<< % tex4ht.env-win32 (@version), generated from @jobname.tex -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright @CopyYear.1997. Eitan M. Gurari @<TeX4ht copyright@>>>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\OutputCode\<tex4ht\> +% Let's no longer create tex4ht.env; it's too easy to mistakenly update +% a system version with it. Post-Eitan, we haven't tried to keep it in +% sync with the others. +%\OutputCode\<tex4ht\> + \OutputCodE\<tex4ht.env-unix\> \OutputCodE\<tex4ht.env-win32\> diff --git a/support/TeX4ht/source/tex4ht-fonts-noncjk.tex b/support/TeX4ht/source/tex4ht-fonts-noncjk.tex index ae68aa34d5..91e506635d 100644 --- a/support/TeX4ht/source/tex4ht-fonts-noncjk.tex +++ b/support/TeX4ht/source/tex4ht-fonts-noncjk.tex @@ -1,8 +1,8 @@ -% $Id: tex4ht-fonts-noncjk.tex 1517 2024-05-10 11:27:42Z michal_h21 $ +% $Id: tex4ht-fonts-noncjk.tex 1551 2024-09-03 22:26:09Z karl $ % tex tex4ht-fonts-noncjk % or ht tex tex4ht-fonts-noncjk % -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright 1997-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. @@ -24483,6 +24483,168 @@ fplmbb 49 90 +\Section{Esvect} + +Font file for the Esvect package. + +% writing vect10.htf hash: d9018d0b41b7639bd8c3bf0419c3b8a5 +\<vect10\><<< +vect10 0 47 +'→' '' 0000 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +'→' '' 0001 1 %% vect.htf (unicode) % +'→' '' 0002 2 %% generated from vect10.tfm, 2024-07-31-11:51 % +'→' '' 0003 3 %% Copyright 2024 TeX Users Group, Arkady Benediktov % +'→' '' 0004 4 %% % +'→' '' 0005 5 %% This work may be distributed and/or modified under the % +'→' '' 0006 6 %% conditions of the LaTeX Project Public License, either % +'→' '' 0007 7 %% version 1.3c of this license or (at your option) any % +'→' '' 0008 8 %% later version. The latest version of this license is in % +'	' '' 0009 9 %% http://www.latex-project.org/lppl.txt % +'
' '' 000A 10 %% and version 1.3c or later is part of all distributions % +'' '' 000B 11 %% of LaTeX version 2005/12/01 or later. % +'' '' 000C 12 %% % +'
' '' 000D 13 %% This work has the LPPL maintenance status "maintained". % +'' '' 000E 14 %% % +'' '' 000F 15 %% The Current Maintainer of this work % +'→' '' 0010 16 %% is the TeX4ht Project <http://tug.org/tex4ht>. % +'→' '' 0011 17 %% % +'→' '' 0012 18 %% If you modify this program, changing the % +'→' '' 0013 19 % % version identification would be appreciated. % +'→' '' 0014 20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +'→' '' 0015 21 +'→' '' 0016 22 +'→' '' 0017 23 +'→' '' 0018 24 +'' '' 0019 25 +'' '' 001A 26 +'' '' 001B 27 +'' '' 001C 28 +'' '' 001D 29 +'' '' 001E 30 +'' '' 001F 31 +'⎯' '' 0020 32 +'⎯' '' 0021 33 +'⎯' '' 0022 34 +'⎯' '' 0023 35 +'⎯' '' 0024 36 +'⎯' '' 0025 37 +'⎯' '' 0026 38 +'⎯' '' 0027 39 +'⎯' '' 0028 40 +'⎯' '' 0029 41 +'⎯' '' 002A 42 +'⎯' '' 002B 43 +'⎯' '' 002C 44 +'⎯' '' 002D 45 +'⎯' '' 002E 46 +'⎯' '' 002F 47 +vect10 0 47 + + +>>> +\AddFont{vect10}{unicode/TeXvect10/vect10}{} + +\<vect\><<< +.vect10 +htfcss: vect10 font-family: 'TeXvect10', serif; +htfcss: vect5 font-family: 'TeXvect10', serif; +>>> + +\AddFont{vect}{unicode/TeXvect10/vect}{} + + + +\Section{BBM} + +\<bbm\><<< +bbm 8 90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +'⦅' '' 8 %% bbm.htf (unicode) % +'⦆' '' 9 %% generated from bbm.tfm, 2024-09-03 % +'' '1' 10 %% Copyright 2024 TeX Users Group, Arkady Benediktov % +'' '1' 11 %% % +'' '1' 12 %% This work may be distributed and/or modified under the % +'' '1' 13 %% conditions of the LaTeX Project Public License, either % +'' '1' 14 %% version 1.3c of this license or (at your option) any % +'' '1' 15 %% later version. The latest version of this license is in % +'' '1' 16 %% http://www.latex-project.org/lppl.txt % +'𝟙' '' 17 %% and version 1.3c or later is part of all distributions % +'𝟚' '' 18 %% of LaTeX version 2005/12/01 or later. % +'' '1' 19 %% % +'' '1' 20 %% This work has the LPPL maintenance status "maintained". % +'' '1' 21 %% % +'' '1' 22 %% The Current Maintainer of this work % +'' '1' 23 %% is the TeX4ht Project <http://tug.org/tex4ht>. % +'' '1' 24 %% % +'' '1' 25 %% If you modify this program, changing the % +'' '1' 26 % % version identification would be appreciated. % +'' '1' 27 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +'' '1' 28 +'' '1' 29 +'' '1' 30 +'' '1' 31 +'' '1' 32 +'𝔸' '' 33 +'𝔹' '' 34 +'ℂ' '' 35 +'𝔻' '' 36 +'𝔼' '' 37 +'𝔽' '' 38 +'𝔾' '' 39 +'ℍ' '' 40 +'𝕀' '' 41 +'𝕁' '' 42 +'𝕂' '' 43 +'𝕃' '' 44 +'𝕄' '' 45 +'ℕ' '' 46 +'𝕆' '' 47 +'ℙ' '' 48 +'ℚ' '' 49 +'ℝ' '' 50 +'𝕊' '' 51 +'𝕋' '' 52 +'𝕌' '' 53 +'𝕍' '' 54 +'𝕎' '' 55 +'𝕏' '' 56 +'𝕐' '' 57 +'ℤ' '' 58 +'⟦' '' 59 +'' '1' 60 +'⟧' '' 61 +'' '1' 62 +'' '1' 63 +'' '1' 64 +'𝕒' '' 65 +'𝕓' '' 66 +'𝕔' '' 67 +'𝕕' '' 68 +'𝕖' '' 69 +'𝕗' '' 70 +'𝕘' '' 71 +'𝕙' '' 72 +'𝕚' '' 73 +'𝕛' '' 74 +'𝕜' '' 75 +'𝕝' '' 76 +'𝕞' '' 77 +'𝕟' '' 78 +'𝕠' '' 79 +'𝕡' '' 80 +'𝕢' '' 81 +'𝕣' '' 82 +'𝕤' '' 83 +'𝕥' '' 84 +'𝕦' '' 85 +'𝕧' '' 86 +'𝕨' '' 87 +'𝕩' '' 88 +'𝕪' '' 89 +'𝕫' '' 90 +bbm 8 90 +>>> + +\AddFont{bbm}{unicode/bbm/bbm}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/support/TeX4ht/source/tex4ht-html4.tex b/support/TeX4ht/source/tex4ht-html4.tex index eb45f6f2ac..3dfd40a6c6 100644 --- a/support/TeX4ht/source/tex4ht-html4.tex +++ b/support/TeX4ht/source/tex4ht-html4.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-html4.tex 1533 2024-06-21 13:38:57Z michal_h21 $ +% $Id: tex4ht-html4.tex 1547 2024-08-19 14:07:03Z michal_h21 $ % Compile 4 times: latex tex4ht-html4 % Copy html4.4ht into the work directory before all but the last compilation. % @@ -2950,6 +2950,22 @@ such a case, we don't have proper nestings of environments. \EndP\HCode{</li></ul>}\ShowPar} {\end:itm \global\def\end:itm{\EndP\Tg</li>}\DeleteMark} {\HCode{<li class="\getClass{li}itemize">}\afterGetClass{li}|<list par|>} + +\:CheckOption{itemize+}\if:Option +\ConfigureList{itemize}% + {\EndP\HCode{<ul \a:LRdir + class="\getClass{itemize}itemize\expandafter\the + \csname @itemdepth\endcsname">}% + \afterGetClass{itemize}% + |<save end:itm|>\global\let\end:itm=\empty} + {|<recall end:itm|>\ifvmode \IgnorePar\fi + \EndP\HCode{</li></ul>}\ShowPar} + {\end:itm \global\def\end:itm{\EndP\Tg</li>}\HCode{<li class="\getClass{li}itemize"><span class="itemizeHead" aria-hidden="true">}\afterGetClass{li}} + {\HCode{</span>}|<list par|>} +\Css{.itemizeHead{float: left; margin-left: -1em; width: 1em;}} +\Css{li.itemize{list-style: none;}} +\fi + \NewConfigure{itemizeClass}{2} \Configure{itemizeClass}{}{} \NewConfigure{liClass}{2} @@ -17790,6 +17806,45 @@ Blue = 1-minimum(1,Yellow *(1-Black)+Black) >>> %%%%%%%%%%%%%%%%%% +\section{moderncv} +%%%%%%%%%%%%%%%%%% + +\<configure html4 moderncv\><<< +\Configure{cvhead}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvhead">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}} +\Configure{cvphoto}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvphoto">}}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}} + +\Configure{section}{\ifvmode\IgnorePar\fi\EndP\HCode{<h2>}}{\HCode{</h2>}} +\Configure{subsection}{\ifvmode\IgnorePar\fi\EndP\HCode{<h3>}}{\HCode{</h3>}} +\Configure{cvitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvitem"><span class="cvitemhead">}}{\HCode{</span><span class="cvitembody">}}{\HCode{</span></div>}} +\Configure{cvdoubleitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvdoubleitem">}}{\HCode{</div>}} +\Configure{cvlistitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvlistitem">}}{\HCode{</div>}} +\Configure{cvlistdoubleitem}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvlistdoubleitem">}}{\HCode{</div>}} + +\Configure{cvskillhead}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvskillhead">}}{\HCode{</div>}} +\Configure{cvskillentry}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="cvskillentry">}}{\HCode{</div>}} + +\Configure{cvskill}{\Picture*[skill level: \:cvskillamount]{}}{\EndPicture} + +\Css{.cvskillentry .tabular, .cvskillhead .tabular {margin:0pt;}} +\Css{.cvskillentry .tabular td:nth-child(1), .cvskillhead .tabular td:nth-child(1){width: 8ch}} +\Css{.cvskillentry .tabular td:nth-child(2), .cvskillhead .tabular td:nth-child(2){width: 12ch}} +\Css{.cvskillentry .tabular td:nth-child(3), .cvskillhead .tabular td:nth-child(3){width: 6ch}} +\Css{.cvskillentry .tabular td:nth-child(4), .cvskillhead .tabular td:nth-child(4){width: 54ch}} + +\Css{.cvitemhead{margin-right: 1em;}} + +\Css{ +@media (min-width:94ch) { +.cvitemhead{ + margin-left: -14ch; + width: 12ch; + float: left; + text-align: right; + } +}} +>>> + +%%%%%%%%%%%%%%%%%% \section{CSS} %%%%%%%%%%%%%%%%%% diff --git a/support/TeX4ht/source/tex4ht-jats.tex b/support/TeX4ht/source/tex4ht-jats.tex index e54de5ad20..16182ba8f5 100644 --- a/support/TeX4ht/source/tex4ht-jats.tex +++ b/support/TeX4ht/source/tex4ht-jats.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-jats.tex 1473 2024-02-23 12:26:51Z michal_h21 $ +% $Id: tex4ht-jats.tex 1545 2024-08-13 19:02:54Z michal_h21 $ % compile 3 times: latex tex4ht-jats % or xhlatex tex4ht-jats "html,3,sections+" % @@ -201,6 +201,7 @@ Configurations that are shared only for article and report |<latex footnotes|> |<latex quotes|> |<latex lists|> +|<latex bibliography|> >>> \<shared article,report\><<< @@ -841,6 +842,29 @@ them separatelly. {\EndNoFonts\HCode{</term><def>}\HtmlParOn|<list par|>} >>> + +We cannot create a structured bibliographic record for plain LaTeX references, so we +at least mark individual entries. + +Entry id is set on the label element. The id comes from a child xref element that is removed +by make4ht. Ideally, it should be set on ref, but we need to use label here, to catch +potential entry number. + + +\<latex bibliography\><<< +\ConfigureList{thebibliography}% + {\ifvmode\IgnorePar\fi \EndP \HCode{<ref-list>}\let\en:bib=\empty} + {\en:bib \ifvmode\IgnorePar\fi \EndP \HCode{</ref-list>}} + {\en:bib\def\en:bib{\HCode{</mixed-citation></ref>}}% + \HCode{<ref><label>}% + \Configure{HtmlPar}% + {\EndP}% + {\EndP}% + {} {}% + } + {\HCode{</label><mixed-citation>}} +>>> + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Packages} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/support/TeX4ht/source/tex4ht-mathjax.tex b/support/TeX4ht/source/tex4ht-mathjax.tex index 23ca24a586..25f324ab7f 100644 --- a/support/TeX4ht/source/tex4ht-mathjax.tex +++ b/support/TeX4ht/source/tex4ht-mathjax.tex @@ -1,4 +1,4 @@ -% $Id: tex4ht-mathjax.tex 1474 2024-02-25 16:27:19Z karl $ +% $Id: tex4ht-mathjax.tex 1540 2024-07-28 17:10:17Z michal_h21 $ % compile: latex tex4ht-mathjax % % Copyright 2018-2024 TeX Users Group @@ -37,12 +37,14 @@ in LaTeX kernel now. \<required packages\><<< >>> -The \verb|\alteqtoks| command saves the used command in HTML. It uses detokenize command -to insert arguments verbatim. The side effect of this is that detokeize inserts space +The \verb|\alteqtoks| command prints the used LaTeX math code to the output document in +verbatim. + +In the past, we used \verb|\detokenize|. The side effect of this is that detokeize inserts space after each control sequence. This is completely valid TeX code, but earlier versions of MathJax didn't like that, rendering resulted in error. -Fortunatelly, MathJax 3 supports these spaces, so we can remove regular expressions for space handling. +Fortunatelly, MathJax 3 supports these spaces, so we could remove regular expressions for space handling. The original code was this: % % convert \ { to \:{ @@ -52,14 +54,24 @@ The original code was this: % % replace \\:{ back to \\ { -- this can be introduced by the previous regex % \regex_replace_all:nnN { \x{5C} \x{5C} \x{3A} \x{7B} } { \x{5C} \x{5C} \x{20} \x{7B} } \l_tmpa_tl +Now (July 2024), when I researched another issue, I've found that it is actually possible to avoid these +extra spaces using LaTeX 3 commands. The inspiration comes from +\Link[https://tex.stackexchange.com/a/44444/2891]this Bruno Le Foch\EndLink. +One ongoing issue is that newlines are not presented. But they weren't preserved with \verb|\detokenize| +either, so it shouldn't be a problem. + -We still use regula expressions to escape invalid XML characters to entities, so it works only with LaTeX. +We still use regular expressions to escape invalid XML characters to entities, so it works only with LaTeX. \<defined commands\><<< \ExplSyntaxOn \cs_new_protected:Npn \alteqtoks #1 { - \tl_set:Ne \l_tmpa_tl {\detokenize{#1}} + % save tokens, but preserve spaces + % https://tex.stackexchange.com/a/44444/2891 + \tl_set:Nn \l_tmpa_tl {#1} + \regex_replace_all:nnN { . } { \c{string} \0 } \l_tmpa_tl + \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl } % % replace < > and & with xml entities \regex_replace_all:nnN { \x{26} } { & } \l_tmpa_tl \regex_replace_all:nnN { \x{3C} } { < } \l_tmpa_tl diff --git a/support/TeX4ht/source/tex4ht-mathml.tex b/support/TeX4ht/source/tex4ht-mathml.tex index e7f496d6bf..8c294f48b7 100644 --- a/support/TeX4ht/source/tex4ht-mathml.tex +++ b/support/TeX4ht/source/tex4ht-mathml.tex @@ -1,8 +1,8 @@ -% $Id: tex4ht-mathml.tex 1495 2024-03-21 16:39:31Z michal_h21 $$ +% $Id: tex4ht-mathml.tex 1551 2024-09-03 22:26:09Z karl $$ % compile 3 times: latex tex4ht-mathltx % or xhlatex tex4ht-mathltx "html,3,sections+" % -% Copyright 2009-2023 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright 1999-2009 Eitan M. Gurari % Released under LPPL 1.3c+. % See tex4ht-cpright.tex for license text. @@ -584,7 +584,7 @@ in italic and without space that would separate it from the following element. \<html-mml\><<< % html-mml.4ht (|version), generated from |jobname.tex -% Copyright 2009-2022 TeX Users Group +% Copyright 2009-2024 TeX Users Group % Copyright |CopyYear.1999. Eitan M. Gurari |<TeX4ht copywrite|> >>> @@ -1939,6 +1939,189 @@ primes. \fi >>> + +We may want to include LaTeX source as an annotation in MathML. In particular LaTeX PDF tagging code can use +this feature. We will not use it by default, but only with texsource option, as it can potentially +break some functionality. + +The code is based on the LaTeX MathJax code, but heavily modified. + +\<configure html-mml latex\><<< +\:CheckOption{texsource}\if:Option + +\newtoks\mmleqtoks +\ExplSyntaxOn +\cs_new_protected:Npn \mmlalteqtoks #1 +{ + % save tokens, but preserve spaces + % https://tex.stackexchange.com/a/44444/2891 + \tl_set:Nn \l_tmpa_tl {#1} + \regex_replace_all:nnN { . } { \c{string} \0 } \l_tmpa_tl + \tl_set:Nx \l_tmpa_tl { \l_tmpa_tl } + % % replace < > and & with xml entities + \regex_replace_all:nnN { \x{26} } { & } \l_tmpa_tl + \regex_replace_all:nnN { \x{3C} } { < } \l_tmpa_tl + \regex_replace_all:nnN { \x{3E} } { > } \l_tmpa_tl + % \regex_replace_all:nnN { \n } {\HCode{ \Hnewline }} \l_tmpa_tl + % replace \par command with blank lines + \regex_replace_all:nnN { \x{5C}par\b } {\x{A}\x{A}} \l_tmpa_tl + \tl_set:Nx \mmleqtoks{ \l_tmpa_tl } + + %\HCode{\l_tmpb_tl} +} +\ExplSyntaxOff + + +\def\AltMath#1${\mmlalteqtoks{#1}% + #1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$} +\Configure{$}{\Configure{@math}{display="inline"}\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}}{\HCode{</\a:mathml semantics>}\EndDviMath}{\expandafter\AltMath} + +\def\AltMathParen#1\){\mmlalteqtoks{#1}% + #1\HCode{</\a:mathml mrow><a\a:mathml nnotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$} + +\def\AltMathParen#1\){\mmlalteqtoks{#1}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}\)} +%\Configure{()}{\Configure{@math}{display="inline"}\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}\AltMathParen$}{\EndDviMath\HCode{</\a:mathml semantics>}} +\Configure{()} + {\Configure{@math}{%\a:mathml + display="inline" +}\csname a:mathml()\endcsname +\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}$\expandafter\AltMathParen} +{$\HCode{</\a:mathml semantics>}\EndDviMath\csname b:mathml()\endcsname} + + +\long\def\AltDisplay#1\]{\mmlalteqtoks{#1}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation></\a:mathml semantics>}\]} +\Configure{[]}{\Configure{@math}{display="block"}\DviMath$$\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow>}\AltDisplay}{$$\EndDviMath} + + +% \long\def\MMLAltlDisplayDollars#1$${\mmlalteqtoks{\[#1\]}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation>}$$} + +% configuarartion of display math doesn't work yet. need to investigate it. +% \Configure{$$} +% {\Configure{@math}{%\a:mathml +% display="block" +% }\IgnorePar +% \ifvmode\else \HCode{<!--tex4ht:inline-->}\fi +% \EndP\DviMath\HCode{<\a:mathml semantics><\a:mathml mrow>}} +% {\HCode{</\a:mathml semantics>}\EndDviMath\ShowPar\par{\csname HCondtrue\endcsname\noindent}} +% {\DisplayMathtrue\expandafter\MMLAltlDisplayDollars} + + +% \renewcommand\eqannotate[1]{\mmlalteqtoks{#1}\HCode{<\a:mathml semantics><\a:mathml mrow>}#1\HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">\mmleqtoks</\a:mathml annotation></\a:mathml semantics>}} + + +% environment support +\newcommand\MMLVerbMathToks[2]{% + \mmlalteqtoks{\begin{#2} + #1 + \end{#2}}% + \begingroup% + \ifvmode\IgnorePar\fi\EndP\Configure{@math}{display="block"}\DviMath\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow>} + \Configure{$$}{}{}{} + \begin{old#2} + #1 + \end{old#2} + \HCode{</\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">} + \HCode{\mmleqtoks} + \HCode{</\a:mathml annotation></\a:mathml semantics>} + \EndDviMath + \endgroup +} + +% we must handle equations separatelly. +% it is a bit messy +\newcommand\MMLVerbMathToksEquation[2]{% + \mmlalteqtoks{\begin{#2} + #1 + \end{#2}}% + \begingroup% + \def\@tempa{#2}% + \def\@equationname{equation}% + \def\mlabeledtr{mtr} + \ifx\@equationname\@tempa% + \def\mlabeledtr{mlabeledtr} % this element can be used to print the equation number, but it is supported only by MathJax + \fi + \ifvmode\IgnorePar\fi\EndP\Configure{@math}{display="block"}\DviMath\DisplayMathtrue\HCode{<\a:mathml semantics><\a:mathml mrow><\a:mathml mtable><\a:mathml \mlabeledtr><\a:mathml mtd>}% + \ifx\@equationname\@tempa% + \incr@eqnum% + \print@eqnum% + \HCode{</\a:mathml mtd><\a:mathml mtd>}% + \fi + #1% + \HCode{</\a:mathml mtd></\a:mathml \mlabeledtr></\a:mathml mtable></\a:mathml mrow><\a:mathml annotation encoding="application/x-tex">}% + \HCode{\mmleqtoks}% + \HCode{</\a:mathml annotation></\a:mathml semantics>}% + \EndDviMath% + \endgroup% +} + +\ExplSyntaxOn +\newcommand\MMLVerbMath[1]{% + \cs_if_exist:cTF{#1}{ + \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname endold#1\expandafter\endcsname\csname end#1\endcsname + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\MMLVerbMathToks\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% +} + +\newcommand\MMLVerbEquation[1]{% + \cs_if_exist:cTF{#1}{ + \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname endold#1\expandafter\endcsname\csname end#1\endcsname + \RenewDocumentEnvironment{#1}{+!b}{% + \NoFonts\expandafter\MMLVerbMathToksEquation\expandafter{##1}{#1}\EndNoFonts% + }{} + }{}% +} +\ExplSyntaxOff + +% \MMLVerbEquation{equation} +% \MMLVerbEquation{equation*} + +\fi +>>> + +\<configure html-mml amsmath\><<< +\:CheckOption{texsource}\if:Option +\MMLVerbMath{subarray} +\MMLVerbMath{smallmatrix} +\MMLVerbMath{matrix} +\MMLVerbMath{pmatrix} +\MMLVerbMath{bmatrix} +\MMLVerbMath{Bmatrix} +\MMLVerbMath{vmatrix} +\MMLVerbMath{Vmatrix} +\MMLVerbMath{cases} +\MMLVerbMath{subequations} +\MMLVerbMath{aligned} +\MMLVerbMath{alignedat} +\MMLVerbMath{gathered} +\MMLVerbMath{gather} +\MMLVerbMath{gather*} +\MMLVerbMath{alignat} +\MMLVerbMath{alignat*} +\MMLVerbMath{xalignat} +\MMLVerbMath{xalignat*} +\MMLVerbMath{xxalignat} +\MMLVerbMath{align} +\MMLVerbMath{align*} +\MMLVerbMath{flalign} +\MMLVerbMath{flalign*} +\MMLVerbMath{split} +\MMLVerbMath{multline} +\MMLVerbMath{multline*} +% equations fails with errors, even though it worked in a .cfg +% I will need to investigate it more +% \MMLVerbEquation{equation} +% \MMLVerbEquation{equation*} +\MMLVerbMath{math} +\MMLVerbMath{displaymath} +\MMLVerbMath{eqnarray} +\MMLVerbMath{eqnarray*} +\fi +>>> + %%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{plain.sty} %%%%%%%%%%%%%%%%%%%%%%%%%% @@ -3584,14 +3767,19 @@ charactes. Extra brackets are used in order to support subscripts and superscripts. \<configure mathml latex\><<< -\def\:temp#1#2{\def#1{\PauseMathClass{\HCode{<mi mathvariant="normal">}\ht:special{t4ht@+\string&{35}x#2{59}}\a:HChar\HCode{</mi>}}\EndPauseMathClass}} -\:temp\Psi{03A8} +\def\:temp#1#2{\def\:tempa{\PauseMathClass{\HCode{<mi mathvariant="normal">}\ht:special{t4ht@+\string&{35}x#2{59}}\a:HChar\HCode{</mi>}}\EndPauseMathClass}\HLet#1\:tempa} +\:temp\Gamma{0393} \:temp\Delta{0394} +\:temp\Theta{0398} +\:temp\Lambda{039B} \:temp\Xi{039E} \:temp\Pi{03A0} \:temp\Sigma{03A3} \:temp\Upsilon{03A5} +\:temp\Phi{03A6} +\:temp\Psi{03A8} \:temp\Omega{03A9} + >>> @@ -5703,6 +5891,23 @@ elements that are printed to support the munderover element easily. >>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{esvec} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +We need to redefine these commands only for MathML. By default, Esvect produces images, which is OK. + +\<configure mathml esvect\><<< +\def\:tempa#1{% +\bgroup\HCode{<\a:mathml mover><\a:mathml mrow>}#1\HCode{</\a:mathml mrow><\a:mathml mo \a:mathml stretchy="true">} +\PauseMathClass\fldr\EndPauseMathClass% +\HCode{</\a:mathml mo></\a:mathml mover>}\egroup +} + +\HRestore\ESV@vecteur +\HLet\ESV@vecteur\:tempa +>>> + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Notes} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/support/bibtexperllibs/BibTeX-Parser/Changes b/support/bibtexperllibs/BibTeX-Parser/Changes deleted file mode 100644 index da5c2afb8e..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/Changes +++ /dev/null @@ -1,86 +0,0 @@ -Revision history for BibTeX::Parser - -1.04 2023-08-20 New release - -1.03 2022-11-06 - Avoid extra spaces with von part. (Author.pm) - Add ' to re_namechar. (Parser.pm) - -1.02 2018-04-29 03:19:56 +0000 - Corrected the bug when Jr is not accompanied by von. - -1.01 2017-11-19 03:12:34 +0000 - New options for to_string: - - print_pre - whether to print text preceding the entry - - type_capitalization ('Uppercase', 'Lowercase', - 'Titlecase') - - field_capitalization ('Uppercase', 'Lowercase', - 'Titlecase') - -1.00 2017-03-18 21:53:15+00:00 - Typo corrected: editors -> editor - -0.70 2016-11-23 02:28:35+00:00 - Compatibility with perl 5.25 (Alexandr Ciornii) - -0.69 2016-03-24 15:13:50-04:00 - Added option canonize_names to Entry::to_string - -0.68 2016-03-10 13:45:31-05:00 - Now we preserve the order of entries - -0.67 2015-12-28 22:36:42+00:00 - Corrected test t/13_output.t - -0.66 2015-12-23 19:52:55-05:00 - Corrected bug 67419. - Added $entry->to_string function - No Do not remove braces from the authors' names - -0.65 2013-09-03 21:04:43 - Add links in documentation. - -0.64 2012-03-10 22:23:50 - Remove a warning about undefined value. - -0.63 2011-03-15 23:08:18 - Parse files with errors (no keys, spaces in wrong positions). Bug #66325 - -0.62 2010-10-15 08:52:53 - Declare Test::More minimum version with done_testing - -0.61 2010-07-19 16:37:49 - Add methods $entry->cleaned_author / cleaned_editor - -0.6 2010-07-19 14:43:15 - Add method $entry->cleaned_field( 'name' ) - Add prerequisite LaTeX::ToUnicode >= 0.02 - -0.5 2010-07-06 13:17:45 Europe/Berlin - Do not attempt to clean up returned values - Author names with braces are split correctly - -0.4 2010-02-09 - Parsing of quoted author names (e.g. "{Foo and Bar, Inc.}") - -0.3.2 2009-07-26 - Removed dependency on Text::Balanced - -0.3.1 2009-07-19 - No changes, removed huge test file from dist - -0.3 2009-07-18 - Better parsing of author names, - new Method B::P::Entry->raw_bibtex - Removed Module::Install from package - -0.21 2009-01-23 - Fixed errors in synopsis. - -0.2 2008-12-30 - First public release. - -0.1 2008-03-14 - First version, internal - - diff --git a/support/bibtexperllibs/BibTeX-Parser/LICENSE b/support/bibtexperllibs/BibTeX-Parser/LICENSE deleted file mode 100644 index 1a50e57d4d..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/LICENSE +++ /dev/null @@ -1,379 +0,0 @@ -This software is copyright (c) 2013-2022 by Gerhard Gossen and Boris Veytsman and Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -Terms of the Perl programming language system itself - -a) the GNU General Public License as published by the Free - Software Foundation; either version 1, or (at your option) any - later version, or -b) the "Artistic License" - ---- The GNU General Public License, Version 1, February 1989 --- - -This software is copyright (c) 2013-2016 by Gerhard Gossen and Boris Veytsman - -This is free software, licensed under: - - The GNU General Public License, Version 1, February 1989 - - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 - - Copyright (C) 1989 Free Software Foundation, Inc. - 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The license agreements of most software companies try to keep users -at the mercy of those companies. By contrast, our General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. The -General Public License applies to the Free Software Foundation's -software and to any other program whose authors commit to using it. -You can use it for your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Specifically, the General Public License is designed to make -sure that you have the freedom to give away or sell copies of free -software, that you receive source code or can get it if you want it, -that you can change the software or use pieces of it in new free -programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of a such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any program or other work which -contains a notice placed by the copyright holder saying it may be -distributed under the terms of this General Public License. The -"Program", below, refers to any such program or work, and a "work based -on the Program" means either the Program or any work containing the -Program or a portion of it, either verbatim or with modifications. Each -licensee is addressed as "you". - - 1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this -General Public License and to the absence of any warranty; and give any -other recipients of the Program a copy of this General Public License -along with the Program. You may charge a fee for the physical act of -transferring a copy. - - 2. You may modify your copy or copies of the Program or any portion of -it, and copy and distribute such modifications under the terms of Paragraph -1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating that - you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, that - in whole or in part contains the Program or any part thereof, either - with or without modifications, to be licensed at no charge to all - third parties under the terms of this General Public License (except - that you may choose to grant warranty protection to some or all - third parties, at your option). - - c) If the modified program normally reads commands interactively when - run, you must cause it, when started running for such interactive use - in the simplest and most usual way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this General - Public License. - - d) You may charge a fee for the physical act of transferring a - copy, and you may at your option offer warranty protection in - exchange for a fee. - -Mere aggregation of another independent work with the Program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other work under the scope of these terms. - - 3. You may copy and distribute the Program (or a portion or derivative of -it, under Paragraph 2) in object code or executable form under the terms of -Paragraphs 1 and 2 above provided that you also do one of the following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal charge - for the cost of distribution) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -Source code for a work means the preferred form of the work for making -modifications to it. For an executable file, complete source code means -all the source code for all modules it contains; but, as a special -exception, it need not include source code for modules which are standard -libraries that accompany the operating system on which the executable -file runs, or for standard header files or definitions files that -accompany that operating system. - - 4. You may not copy, modify, sublicense, distribute or transfer the -Program except as expressly provided under this General Public License. -Any attempt otherwise to copy, modify, sublicense, distribute or transfer -the Program is void, and will automatically terminate your rights to use -the Program under this License. However, parties who have received -copies, or rights to use copies, from you under this General Public -License will not have their licenses terminated so long as such parties -remain in full compliance. - - 5. By copying, distributing or modifying the Program (or any work based -on the Program) you indicate your acceptance of this license to do so, -and all its terms and conditions. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the original -licensor to copy, distribute or modify the Program subject to these -terms and conditions. You may not impose any further restrictions on the -recipients' exercise of the rights granted herein. - - 7. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of the license which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -the license, you may choose any version ever published by the Free Software -Foundation. - - 8. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to humanity, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - - To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19xx name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (a program to direct compilers to make passes - at assemblers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -That's all there is to it! - - ---- The Artistic License 1.0 --- - -This software is Copyright (c) 2013 by Gerhard Gossen. - -This is free software, licensed under: - - The Artistic License 1.0 - -The Artistic License - -Preamble - -The intent of this document is to state the conditions under which a Package -may be copied, such that the Copyright Holder maintains some semblance of -artistic control over the development of the package, while giving the users of -the package the right to use and distribute the Package in a more-or-less -customary fashion, plus the right to make reasonable modifications. - -Definitions: - - - "Package" refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. - - "Standard Version" refers to such a Package if it has not been modified, - or has been modified in accordance with the wishes of the Copyright - Holder. - - "Copyright Holder" is whoever is named in the copyright or copyrights for - the package. - - "You" is you, if you're thinking about copying or distributing this Package. - - "Reasonable copying fee" is whatever you can justify on the basis of media - cost, duplication charges, time of people involved, and so on. (You will - not be required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) - - "Freely Available" means that no fee is charged for the item itself, though - there may be fees involved in handling the item. It also means that - recipients of the item may redistribute it under the same conditions they - received it. - -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that you -duplicate all of the original copyright notices and associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications derived -from the Public Domain or from the Copyright Holder. A Package modified in such -a way shall still be considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, provided that -you insert a prominent notice in each changed file stating how and when you -changed that file, and provided that you do at least ONE of the following: - - a) place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet or an - equivalent medium, or placing the modifications on a major archive site - such as ftp.uu.net, or by allowing the Copyright Holder to include your - modifications in the Standard Version of the Package. - - b) use the modified Package only within your corporation or organization. - - c) rename any non-standard executables so the names do not conflict with - standard executables, which must also be provided, and provide a separate - manual page for each non-standard executable that clearly documents how it - differs from the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -4. You may distribute the programs of this Package in object code or executable -form, provided that you do at least ONE of the following: - - a) distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on where to - get the Standard Version. - - b) accompany the distribution with the machine-readable source of the Package - with your modifications. - - c) accompany any non-standard executables with their corresponding Standard - Version executables, giving the non-standard executables non-standard - names, and clearly documenting the differences in manual pages (or - equivalent), together with instructions on where to get the Standard - Version. - - d) make other distribution arrangements with the Copyright Holder. - -5. You may charge a reasonable copying fee for any distribution of this -Package. You may charge any fee you choose for support of this Package. You -may not charge a fee for this Package itself. However, you may distribute this -Package in aggregate with other (possibly commercial) programs as part of a -larger (possibly commercial) software distribution provided that you do not -advertise this Package as a product of your own. - -6. The scripts and library files supplied as input to or produced as output -from the programs of this Package do not automatically fall under the copyright -of this Package, but belong to whomever generated them, and may be sold -commercially, and may be aggregated with this Package. - -7. C or perl subroutines supplied by you and linked into this Package shall not -be considered part of this Package. - -8. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -The End - diff --git a/support/bibtexperllibs/BibTeX-Parser/MANIFEST b/support/bibtexperllibs/BibTeX-Parser/MANIFEST deleted file mode 100644 index 032eea6a15..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/MANIFEST +++ /dev/null @@ -1,44 +0,0 @@ -LICENSE -Changes -MANIFEST -t/pod.t -t/cleaned_field.t -t/release-pod-coverage.t -t/bug67419.t -t/09-complex.t -t/bug66325.t -t/07-parse_englishbib.t -t/13_output.t -t/01-parse.t -t/14-extratext.t -t/05-author.t -t/08-parse_large.t -t/release-pod-syntax.t -t/12-von_token.t -t/00-load.t -t/11-split_braced.t -t/02-parse_string.t -t/04-entry.t -t/03-parse_entry.t -t/bibs/mathscinet.txt -t/bibs/10-funnyname.bib -t/bibs/english.bib -t/bibs/braces.bib -t/bibs/endnote.txt -t/bibs/14-extratext.bib -t/bibs/01.bib -t/bibs/engineering_village.txt -t/bibs/09-complex.bib -t/bibs/06.bib -t/pod-coverage.t -t/10-funnyname.t -t/15-capitalization.t -t/06-parse_complex.t -README -notes -lib/BibTeX/Parser/Author.pm -lib/BibTeX/Parser/Entry.pm -lib/BibTeX/Parser.pm -Makefile.PL -Makefile.TDS -dist.ini diff --git a/support/bibtexperllibs/BibTeX-Parser/Makefile.PL b/support/bibtexperllibs/BibTeX-Parser/Makefile.PL deleted file mode 100644 index e095f253b0..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/Makefile.PL +++ /dev/null @@ -1,71 +0,0 @@ - -use strict; -use warnings; - - - -use ExtUtils::MakeMaker 6.30; - - - -my %WriteMakefileArgs = ( - "ABSTRACT" => "A pure perl BibTeX parser", - "AUTHOR" => 'Gerhard Gossen <gerhard.gossen@googlemail.com> and Boris Veytsman <boris@varphi.com> and Karl Berry <karl@freefriends.org', - "BUILD_REQUIRES" => {}, - "CONFIGURE_REQUIRES" => { - "ExtUtils::MakeMaker" => "6.31" - }, - "DISTNAME" => "BibTeX-Parser", - "EXE_FILES" => [], - "LICENSE" => "perl", - "NAME" => "BibTeX::Parser", - "PREREQ_PM" => { - "File::Spec" => 0, - "IO::File" => 0, - "IO::String" => 0, - "LaTeX::ToUnicode" => "0.52", - "Test::More" => "0.88" - }, - "TEST_REQUIRES" => { - "Test::More" => "0.88" - }, - 'VERSION_FROM' => 'lib/BibTeX/Parser.pm', - "test" => { - "TESTS" => "t/*.t" - } -); - - -unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { - my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; - my $br = $WriteMakefileArgs{BUILD_REQUIRES}; - for my $mod ( keys %$tr ) { - if ( exists $br->{$mod} ) { - $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; - } - else { - $br->{$mod} = $tr->{$mod}; - } - } -} - -unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { - my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; - my $pp = $WriteMakefileArgs{PREREQ_PM}; - for my $mod ( keys %$br ) { - if ( exists $pp->{$mod} ) { - $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; - } - else { - $pp->{$mod} = $br->{$mod}; - } - } -} - -delete $WriteMakefileArgs{CONFIGURE_REQUIRES} - unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; - -WriteMakefile(%WriteMakefileArgs); - - - diff --git a/support/bibtexperllibs/BibTeX-Parser/Makefile.TDS b/support/bibtexperllibs/BibTeX-Parser/Makefile.TDS deleted file mode 100644 index 780ebc0af1..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/Makefile.TDS +++ /dev/null @@ -1,35 +0,0 @@ -# This is Makefile for TDS-compliant TeX distributions -# Written by Boris Veytsman, boris@varphi.com -# -# This file is in public domain -# -PREFIX = /usr/local - -LIBDIR = $(PREFIX)/scripts/bibtexperllibs - -DOCDIR = $(PREFIX)/doc/bibtex/bibtexperllibs - -all: - -docs: - -install: - mkdir -p $(LIBDIR) - cp -r lib/* $(LIBDIR) - mkdir -p $(DOCDIR) - cp -r man/man3/* $(DOCDIR) - -check test: Makefile -# need bash pipefail so exit status is from the make, not the tr. -# the -f Makefile is because of possible GNUmakefile -> Makefile.TDS symlink. - bash -c "set -o pipefail; \ - env PERL5LIB=../LaTeX-ToUnicode/lib \ - make -f Makefile test | tr '\r' '\n'" - -Makefile MYMETA.json MYMeta.yml: Makefile.PL force - perl Makefile.PL || rm -f $@ - -clean distclean: - $(RM) Makefile MYMETA.* blib pm_to_blib *.tar.gz - -force: diff --git a/support/bibtexperllibs/BibTeX-Parser/README b/support/bibtexperllibs/BibTeX-Parser/README deleted file mode 100644 index cb6f19b576..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/README +++ /dev/null @@ -1,9 +0,0 @@ -This is the BibTeX::Parser Perl package: - - A pure Perl BibTeX parser - -Copyright 2013--2023 Gerhard Gossen, Boris Veytsman, Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - diff --git a/support/bibtexperllibs/BibTeX-Parser/dist.ini b/support/bibtexperllibs/BibTeX-Parser/dist.ini deleted file mode 100644 index bc60ca9352..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/dist.ini +++ /dev/null @@ -1,28 +0,0 @@ -name = BibTeX-Parser -version = 1.04 -author = Gerhard Gossen <gerhard.gossen@googlemail.com> and Boris Veytsman <boris@varphi.com> and Karl Berry <karl@freefriends.org> -license = Perl_5 -copyright_holder = Gerhard Gossen and Boris Veytsman and Karl Berry - -[@Classic] - -[NextRelease] -format = %-7v %{yyyy-MM-dd HH:mm:ss}d - -[PodWeaver] - -[Prereqs] -Test::More = 0 -IO::String = 0 -IO::File = 0 -File::Spec = 0 -LaTeX::ToUnicode = 0.11 - -[Prereqs / TestRequires] -Test::More = 0.88 ; for done_testing - -[PruneFiles] -filenames = t/bibs/java.bib - -[Repository] -[@Git] diff --git a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser.pm b/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser.pm deleted file mode 100644 index 2897d8495d..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser.pm +++ /dev/null @@ -1,366 +0,0 @@ -package BibTeX::Parser; -{ - $BibTeX::Parser::VERSION = '1.04'; -} -# ABSTRACT: A pure perl BibTeX parser -use warnings; -use strict; - -use BibTeX::Parser::Entry; - - -my $re_namechar = qr/[a-zA-Z0-9\!\$\&\*\+\-\.\/\:\;\<\>\?\[\]\^\_\`\|\']/o; -my $re_name = qr/$re_namechar+/o; - - -sub new { - my ( $class, $fh ) = @_; - - return bless { - fh => $fh, - strings => { - jan => "January", - feb => "February", - mar => "March", - apr => "April", - may => "May", - jun => "June", - jul => "July", - aug => "August", - sep => "September", - oct => "October", - nov => "November", - dec => "December", - - }, - line => -1, - buffer => "", - }, $class; -} - -sub _slurp_close_bracket; - -sub _parse_next { - my $self = shift; - - while (1) { # loop until regular entry is finished - return 0 if $self->{fh}->eof; - local $_ = $self->{buffer}; - - until (/@/m) { - my $line = $self->{fh}->getline; - return 0 unless defined $line; - $line =~ s/^%.*$//; - $_ .= $line; - } - - my $current_entry = new BibTeX::Parser::Entry; - if (/@($re_name)/cgo) { - my $type = uc $1; - $current_entry->type( $type ); - my $start_pos = pos($_) - length($type) - 1; - - # read rest of entry (matches braces) - my $bracelevel = 0; - $bracelevel += tr/\{/\{/; #count braces - $bracelevel -= tr/\}/\}/; - while ( $bracelevel != 0 ) { - my $position = pos($_); - my $line = $self->{fh}->getline; - last unless defined $line; - $bracelevel = - $bracelevel + ( $line =~ tr/\{/\{/ ) - ( $line =~ tr/\}/\}/ ); - $_ .= $line; - pos($_) = $position; - } - - # Remember text before the entry - my $pre = substr($_, 0, $start_pos-1); - if ($start_pos == 0) { - $pre = ''; - } - $current_entry->pre($pre); - - - # Remember raw bibtex code - my $raw = substr($_, $start_pos); - $raw =~ s/^\s+//; - $raw =~ s/\s+$//; - $current_entry->raw_bibtex($raw); - - my $pos = pos $_; - tr/\n/ /; - pos($_) = $pos; - - if ( $type eq "STRING" ) { - if (/\G\{\s*($re_name)\s*=\s*/cgo) { - my $key = $1; - my $value = _parse_string( $self->{strings} ); - if ( defined $self->{strings}->{$key} ) { - warn("Redefining string $key!"); - } - $self->{strings}->{$key} = $value; - /\G[\s\n]*\}/cg; - } else { - $current_entry->error("Malformed string!"); - return $current_entry; - } - } elsif ( $type eq "COMMENT" or $type eq "PREAMBLE" ) { - /\G\{./cgo; - _slurp_close_bracket; - } else { # normal entry - $current_entry->parse_ok(1); - - # parse key - if (/\G\s*\{(?:\s*($re_name)\s*,[\s\n]*|\s+\r?\s*)/cgo) { - $current_entry->key($1); - - # fields - while (/\G[\s\n]*($re_name)[\s\n]*=[\s\n]*/cgo) { - $current_entry->field( - $1 => _parse_string( $self->{strings} ) ); - my $idx = index( $_, ',', pos($_) ); - pos($_) = $idx + 1 if $idx > 0; - } - - return $current_entry; - - } else { - - $current_entry->error("Malformed entry (key contains illegal characters) at " . substr($_, pos($_) || 0, 20) . ", ignoring"); - _slurp_close_bracket; - return $current_entry; - } - } - - $self->{buffer} = substr $_, pos($_); - - } else { - $current_entry->error("Did not find type at " . substr($_, pos($_) || 0, 20)); - return $current_entry; - } - - } -} - - -sub next { - my $self = shift; - - return $self->_parse_next; -} - -# slurp everything till the next closing brace. Handles -# nested brackets -sub _slurp_close_bracket { - my $bracelevel = 0; - BRACE: { - /\G[^\}]*\{/cg && do { $bracelevel++; redo BRACE }; - /\G[^\{]*\}/cg - && do { - if ( $bracelevel > 0 ) { - $bracelevel--; - redo BRACE; - } else { - return; - } - } - } -} - -# parse bibtex string in $_ and return. A BibTeX string is either enclosed -# in double quotes '"' or matching braces '{}'. The braced form may contain -# nested braces. -sub _parse_string { - my $strings_ref = shift; - - my $value = ""; - - PART: { - if (/\G(\d+)/cg) { - $value .= $1; - } elsif (/\G($re_name)/cgo) { - warn("Using undefined string $1") unless defined $strings_ref->{$1}; - $value .= $strings_ref->{$1} || ""; - } elsif (/\G"(([^"\\]*(\\.)*[^\\"]*)*)"/cgs) - { # quoted string with embeded escapes - $value .= $1; - } else { - my $part = _extract_bracketed( $_ ); - $value .= substr $part, 1, length($part) - 2; # strip quotes - } - - if (/\G\s*#\s*/cg) { # string concatenation by # - redo PART; - } - } - $value =~ s/[\s\n]+/ /g; - return $value; -} - -sub _extract_bracketed -{ - for($_[0]) # alias to $_ - { - /\G\s+/cg; - my $start = pos($_); - my $depth = 0; - while(1) - { - /\G\\./cg && next; - /\G\{/cg && (++$depth, next); - /\G\}/cg && (--$depth > 0 ? next : last); - /\G([^\\\{\}]+)/cg && next; - last; # end of string - } - return substr($_, $start, pos($_)-$start); - } -} - -# Split the $string using $pattern as a delimiter with -# each part having balanced braces (so "{$pattern}" -# does NOT split). -# Return empty list if unmatched braces - -sub _split_braced_string { - my $string = shift; - my $pattern = shift; - my @tokens; - return () if $string eq ''; - my $buffer; - while (!defined pos $string || pos $string < length $string) { - if ( $string =~ /\G(.*?)(\{|$pattern)/cgi ) { - my $match = $1; - if ( $2 =~ /$pattern/i ) { - $buffer .= $match; - push @tokens, $buffer; - $buffer = ""; - } elsif ( $2 =~ /\{/ ) { - $buffer .= $match . "{"; - my $numbraces=1; - while ($numbraces !=0 && pos $string < length $string) { - my $symbol = substr($string, pos $string, 1); - $buffer .= $symbol; - if ($symbol eq '{') { - $numbraces ++; - } elsif ($symbol eq '}') { - $numbraces --; - } - pos($string) ++; - } - if ($numbraces != 0) { - return (); - } - } else { - $buffer .= $match; - } - } else { - $buffer .= substr $string, (pos $string || 0); - last; - } - } - push @tokens, $buffer if $buffer; - return @tokens; -} - - -1; # End of BibTeX::Parser - - -__END__ -=pod - -=head1 NAME - -BibTeX::Parser - A pure perl BibTeX parser - - -=head1 SYNOPSIS - -Parses BibTeX files. - - use BibTeX::Parser; - use IO::File; - - my $fh = IO::File->new("filename"); - - # Create parser object ... - my $parser = BibTeX::Parser->new($fh); - - # ... and iterate over entries - while (my $entry = $parser->next ) { - if ($entry->parse_ok) { - my $type = $entry->type; - my $title = $entry->field("title"); - - my @authors = $entry->author; - # or: - my @editors = $entry->editor; - - foreach my $author (@authors) { - print $author->first . " " - . $author->von . " " - . $author->last . ", " - . $author->jr; - } - } else { - warn "Error parsing file: " . $entry->error; - } - } - - - -=head1 FUNCTIONS - -=head2 new - -Creates new parser object. - -Parameters: - - * fh: A filehandle - -=head2 next - -Returns the next parsed entry or undef. - -=head1 NOTES - -The fields C<author> and C<editor> are canonized, see -L<BibTeX::Parser::Author> - - -=head1 SEE ALSO - -=over 4 - -=item - -L<BibTeX::Parser::Entry> - -=item - -L<BibTeX::Parser::Author> - -=back - -=head1 VERSION - -version 1.04 - - -=head1 AUTHOR - -Gerhard Gossen <gerhard.gossen@googlemail.com> and -Boris Veytsman <boris@varphi.com> and -Karl Berry <karl@freefriends.org> - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2013-2023 by Gerhard Gossen and Boris Veytsman and Karl Berry. - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -=cut - diff --git a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Author.pm b/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Author.pm deleted file mode 100644 index a35e2073a6..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Author.pm +++ /dev/null @@ -1,429 +0,0 @@ -package BibTeX::Parser::Author; -{ - $BibTeX::Parser::Author::VERSION = '1.04'; -} - -use warnings; -use strict; - -use BibTeX::Parser; - - -use overload - '""' => \&to_string; - - - -sub new { - my $class = shift; - - if (@_) { - my $self = [ $class->split(@_) ]; - return bless $self, $class; - } else { - return bless [], $class; - } -} - -sub _get_or_set_field { - my ($self, $field, $value) = @_; - if (defined $value) { - $self->[$field] = $value; - } else { - return $self->[$field]; - } -} - - -sub first { - shift->_get_or_set_field(0, @_); -} - - -sub von { - shift->_get_or_set_field(1, @_); -} - - -sub last { - shift->_get_or_set_field(2, @_); -} - - -sub jr { - shift->_get_or_set_field(3, @_); -} - - -# Take a string and create an array [first, von, last, jr] -sub split { - my ($self_or_class, $name) = @_; - - # remove whitespace at start and end of string - $name =~ s/^\s*(.*)\s*$/$1/s; - - - - if (!length($name)) { - return (undef, undef, undef, undef); - } - - my @comma_separated = - BibTeX::Parser::_split_braced_string($name, - '\s*,\s*'); - if (scalar(@comma_separated) == 0) { - # Error? - return (undef, undef, undef, undef); - } - - my $first=undef; - my $von=undef; - my $last=undef; - my $jr=undef; - - if (scalar(@comma_separated) == 1) { - # First von Last form - my @tokens = - BibTeX::Parser::_split_braced_string($name, '\s+'); - if (!scalar (@tokens)) { - return (undef, undef, undef, undef); - } - my ($start_von, $start_last) = _getStartVonLast (@tokens); - if ($start_von >0) { - $first = join(' ', splice(@tokens,0,$start_von)); - } - if (($start_last-$start_von) >0) { - $von = join(' ', splice(@tokens,0,$start_last-$start_von)); - } - $last = join(' ',@tokens); - return ($first, $von, $last, $jr); - } - # Now we work with von Last, [Jr,] First form - if (scalar @comma_separated == 2) { # no jr - my @tokens= - BibTeX::Parser::_split_braced_string($comma_separated[1], '\s+'); - $first = join(' ', @tokens); - } else { # jr is present - my @tokens= - BibTeX::Parser::_split_braced_string($comma_separated[1], '\s+'); - $jr = join(' ', @tokens); - @tokens= - BibTeX::Parser::_split_braced_string($comma_separated[2], '\s+'); - $first = join(' ', @tokens); - } - my @tokens = - BibTeX::Parser::_split_braced_string($comma_separated[0], '\s+'); - my $start_last = _getStartLast(@tokens); - if ($start_last > 0) { - $von=join(' ', splice(@tokens,0,$start_last)); - } - $last = join(' ',@tokens); - return ($first, $von, $last, $jr); - -} - -# Return the index of the first von element and the first lastname -# element. If no von element, von=last - -sub _getStartVonLast { - my $length=scalar(@_); - if ($length==1) { - return (0,0); - } - my $start_von=-1; - my $start_last=$length-1; - for (my $i=0; $i<$length; $i++) { - if (_is_von_token($_[$i])) { - $start_von=$i; - last; - } - } - if ($start_von== -1) { # no von part - return($length-1, $length-1); - } - if ($start_von== $length-1) { # all parts but last are upper case? - return($length-1, $length-1); - } - for (my $i=$start_von+1; $i<$length; $i++) { - if (!_is_von_token($_[$i])) { - $start_last=$i; - last; - } - } - return($start_von, $start_last); -} - - -# Return the index of the first lastname -# element provided no first name elements are present - -sub _getStartLast { - my $length=scalar(@_); - if ($length==1) { - return 0; - } - my $start_last=$length-1; - for (my $i=0; $i<$length; $i++) { - if (!_is_von_token($_[$i])) { - $start_last=$i; - last; - } - } - return $start_last; -} - - -sub _split_name_parts { - my $name = shift; - - if ( $name !~ /\{/ ) { - return split /\s+/, $name; - } else { - my @parts; - my $cur_token = ''; - while ( scalar( $name =~ /\G ( [^\s\{]* ) ( \s+ | \{ | \s* $ ) /xgc ) ) { - $cur_token .= $1; - if ( $2 =~ /\{/ ) { - if ( scalar( $name =~ /\G([^\}]*)\}/gc ) ) { - $cur_token .= "{$1}"; - } else { - die "Unmatched brace in name '$name'"; - } - } else { - if ( $cur_token =~ /^{(.*)}$/ ) { - $cur_token = $1; - } - push @parts, $cur_token; - $cur_token = ''; - } - } - return @parts; - } - -} - - -sub _get_single_author_from_tokens { - my (@tokens) = @_; - if (@tokens == 0) { - return (undef, undef, undef, undef); - } elsif (@tokens == 1) { # name without comma - if ( $tokens[0] =~ /(^|\s)[[:lower:]]/) { # name has von part or has only lowercase names - my @name_parts = _split_name_parts $tokens[0]; - - my $first; - while (@name_parts && ucfirst($name_parts[0]) eq $name_parts[0] ) { - $first .= $first ? ' ' . shift @name_parts : shift @name_parts; - } - - my $von; - # von part are lowercase words - while ( @name_parts && lc($name_parts[0]) eq $name_parts[0] ) { - $von .= $von ? ' ' . shift @name_parts : shift @name_parts; - } - - if (@name_parts) { - return ($first, $von, join(" ", @name_parts), undef); - } else { - return (undef, undef, $tokens[0], undef); - } - } else { - if ( $tokens[0] !~ /\{/ && $tokens[0] =~ /^((.*)\s+)?\b(\S+)$/) { - return ($2, undef, $3, undef); - } else { - my @name_parts = _split_name_parts $tokens[0]; - return ($name_parts[0], undef, $name_parts[1], undef); - } - } - - } elsif (@tokens == 2) { - my @von_last_parts = _split_name_parts $tokens[0]; - my $von; - # von part are lowercase words - while ( @von_last_parts && lc($von_last_parts[0]) eq $von_last_parts[0] ) { - $von .= $von ? ' ' . shift @von_last_parts : shift @von_last_parts; - } - return ($tokens[1], $von, join(" ", @von_last_parts), undef); - } else { - my @von_last_parts = _split_name_parts $tokens[0]; - my $von; - # von part are lowercase words - while ( @von_last_parts && lc($von_last_parts[0]) eq $von_last_parts[0] ) { - $von .= $von ? ' ' . shift @von_last_parts : shift @von_last_parts; - } - return ($tokens[2], $von, join(" ", @von_last_parts), $tokens[1]); - } - -} - - - -# The goal is to return a name in form -# von Last, Jr, First -# where any of the parts except Last may be empty. -# -sub to_string { - my $self = shift; - - my $last = $self->last; # assume always present - my $first = $self->first ? (", " . $self->first) : ''; # ", first" - my $von = $self->von ? ($self->von . " ") : ''; # "von " - my $jr = $self->jr ? (", " . $self->jr ) : ''; # ", jr" - # - my $ret = "${von}${last}${jr}${first}"; - #warn "returning name: $ret\n"; - return $ret; - -# original code, which introduced a spurious space with a von part. -# https://github.com/borisveytsman/crossrefware/issues/11 -# -# if ($self->jr) { -# return () . " " . $self->last . ", " . $self->jr . ", " . $self->first; -# } else { -# return ($self->von ? $self->von . " " : '') . $self->last . ($self->first ? ", " . $self->first : ''); -# } -# -} - - -# Return 1 if the first letter on brace level 0 is lowercase -sub _is_von_token { - my $string = shift; - while ($string =~ - s/^(\\[[:alpha:]]+\{|\{|\\[[:^alpha:]]?|[[:^alpha:]])//) { - if ($1 eq '{' ) { - my $numbraces=1; - while ($numbraces !=0 && length($string)) { - my $symbol = substr($string, 0, 1); - if ($symbol eq '{') { - $numbraces ++; - } elsif ($symbol eq '}') { - $numbraces --; - } - $string = substr($string,1); - } - } - } - - if (length $string ) { - my $symbol = substr($string, 0, 1); - if (lc($symbol) eq $symbol) { - return 1; - } else { - return 0; - } - } else { - return 1; - } - -} - -1; # End of BibTeX::Entry - -__END__ -=pod - -=head1 NAME - -BibTeX::Author - Contains a single author for a BibTeX document. - -=head1 SYNOPSIS - -This class ist a wrapper for a single BibTeX author. It is usually created -by a BibTeX::Parser. - - use BibTeX::Parser::Author; - - my $entry = BibTeX::Parser::Author->new($full_name); - - my $firstname = $author->first; - my $von = $author->von; - my $last = $author->last; - my $jr = $author->jr; - - # or ... - - my ($first, $von, $last, $jr) = BibTeX::Author->split($fullname); - - - -=head1 FUNCTIONS - -=head2 new - -Create new author object. Expects full name as parameter. - -=head2 first - -Set or get first name(s). - -=head2 von - -Set or get 'von' part of name. - -=head2 last - -Set or get last name(s). - -=head2 jr - -Set or get 'jr' part of name. - -=head2 split - -Split name into (firstname, von part, last name, jr part). Returns array -with four strings, some of them possibly empty. - -=head2 to_string - -Return string representation of the name. - -=head1 NOTES - -BibTeX allows three representations of a person's name: - -=over 4 - -=item 1. - -First von Last - -=item 2. - -von Last, First - -=item 3. - -von Last, Jr, First - -=back - -The module always converts the first form to the second of third one -to allow simple string comparisons. - -The algorithm to determine the von part is the following: von part -consists of tokens where the first letter at brace level 0 is in lower case. -Anything in a "special characters" is on brace level 0. Thus the following -tokens are considered von parts: C<von>, C<\NOOP{von}Von>, and -the following token is not: C<{von}> - -=head1 VERSION - -version 1.04 - - -=head1 AUTHOR - -Gerhard Gossen <gerhard.gossen@googlemail.com> and -Boris Veytsman <boris@varphi.com> and -Karl Berry <karl@freefriends.org> - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2013--2023 by Gerhard Gossen and Boris Veytsman and Karl Berry. - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -=cut - diff --git a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Entry.pm b/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Entry.pm deleted file mode 100644 index d0bc9cc80b..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/lib/BibTeX/Parser/Entry.pm +++ /dev/null @@ -1,435 +0,0 @@ -package BibTeX::Parser::Entry; -{ - $BibTeX::Parser::Entry::VERSION = '1.04'; -} - -use warnings; -use strict; - -use BibTeX::Parser; -use BibTeX::Parser::Author; - - - -sub new { - my ($class, $type, $key, $parse_ok, $fieldsref) = @_; - - my %fields = defined $fieldsref ? %$fieldsref : (); - my $i=0; - foreach my $field (keys %fields) { - if ($field !~ /^_/) { - $fields{_fieldnums}->{$field}=$i; - $i++; - } - } - if (defined $type) { - $fields{_type} = uc($type); - } - $fields{_key} = $key; - $fields{_parse_ok} = $parse_ok; - $fields{_raw} = ''; - return bless \%fields, $class; -} - - - -sub parse_ok { - my $self = shift; - if (@_) { - $self->{_parse_ok} = shift; - } - $self->{_parse_ok}; -} - - -sub error { - my $self = shift; - if (@_) { - $self->{_error} = shift; - $self->parse_ok(0); - } - return $self->parse_ok ? undef : $self->{_error}; -} - - -sub type { - if (scalar @_ == 1) { - # get - my $self = shift; - return $self->{_type}; - } else { - # set - my ($self, $newval) = @_; - $self->{_type} = uc($newval); - } -} - - -sub key { - if (scalar @_ == 1) { - # get - my $self = shift; - return $self->{_key}; - } else { - # set - my ($self, $newval) = @_; - $self->{_key} = $newval; - } - -} - - -sub field { - if (scalar @_ == 2) { - # get - my ($self, $field) = @_; - return $self->{ lc( $field ) }; - } else { - my ($self, $key, $value) = @_; - my $field = lc ($key); - $self->{$field} = $value; #_sanitize_field($value); - if (!exists($self->{_fieldnums}->{$field})) { - my $num = scalar keys %{$self->{_fieldnums}}; - $self->{_fieldnums}->{$field} = $num; - } - } - -} - -use LaTeX::ToUnicode qw( convert ); - - -sub cleaned_field { - my ( $self, $field, @options ) = @_; - if ( $field =~ /author|editor/i ) { - return $self->field( $field ); - } else { - return convert( $self->field( lc $field ), @options ); - } -} - - -sub cleaned_author { - my $self = shift; - $self->_handle_cleaned_author_editor( [ $self->author ], @_ ); -} - - -sub cleaned_editor { - my $self = shift; - $self->_handle_cleaned_author_editor( [ $self->editor ], @_ ); -} - -sub _handle_cleaned_author_editor { - my ( $self, $authors, @options ) = @_; - map { - my $author = $_; - my $new_author = BibTeX::Parser::Author->new; - map { - $new_author->$_( convert( $author->$_, @options ) ) - } grep { defined $author->$_ } qw( first von last jr ); - $new_author; - } @$authors; -} - -no LaTeX::ToUnicode; - -sub _handle_author_editor { - my $type = shift; - my $self = shift; - if (@_) { - if (@_ == 1) { #single string - # my @names = split /\s+and\s+/i, $_[0]; - $_[0] =~ s/^\s*//; - $_[0] =~ s/\s*$//; - my @names = BibTeX::Parser::_split_braced_string($_[0], - '\s+and\s+'); - if (!scalar @names) { - $self->error('Bad names in author/editor field'); - return; - } - $self->{"_$type"} = [map {new BibTeX::Parser::Author $_} @names]; - $self->field($type, join " and ", @{$self->{"_$type"}}); - } else { - $self->{"_$type"} = []; - foreach my $param (@_) { - if (ref $param eq "BibTeX::Author") { - push @{$self->{"_$type"}}, $param; - } else { - push @{$self->{"_$type"}}, new BibTeX::Parser::Author $param; - } - - $self->field($type, join " and ", @{$self->{"_$type"}}); - } - } - } else { - unless ( defined $self->{"_$type"}) { - my @names = BibTeX::Parser::_split_braced_string($self->{$type} || "", '\s+and\s+' ); - $self->{"_$type"} = [map {new BibTeX::Parser::Author $_} @names]; - } - return @{$self->{"_$type"}}; - } -} - - - -sub author { - _handle_author_editor('author', @_); -} - - -sub editor { - _handle_author_editor('editor', @_); -} - - -sub fieldlist { - my $self = shift; - - return grep {!/^_/} keys %$self; -} - - -sub has { - my ($self, $field) = @_; - - return defined $self->{$field}; -} - -sub _sanitize_field { - my $value = shift; - for ($value) { - tr/\{\}//d; - s/\\(?!=[ \\])//g; - s/\\\\/\\/g; - } - return $value; -} - - - -sub raw_bibtex { - my $self = shift; - if (@_) { - $self->{_raw} = shift; - } - return $self->{_raw}; -} - -sub pre { - my $self = shift; - if (@_) { - $self->{_pre} = shift; - } - return $self->{_pre}; -} - - -sub to_string { - my $self = shift; - my %options=@_; - if (!exists($options{canonize_names})) { - $options{canonize_names}=1; - } - my @fields = grep {!/^_/} keys %$self; - @fields = sort { - $self->{_fieldnums}->{$a} <=> - $self->{_fieldnums}->{$b}} @fields; - my $result = ''; - if ($options{print_pre}) { - $result .= $self->pre()."\n"; - } - my $type = $self->type; - if (exists($options{type_capitalization})) { - if ($options{type_capitalization} eq 'Lowercase') { - $type = lc $type; - } - if ($options{type_capitalization} eq 'Titlecase') { - $type = ucfirst lc $type; - } - } - print STDERR $self->key, "\n"; - $result .= '@'.$type."{".$self->key.",\n"; - foreach my $field (@fields) { - my $value = $self->field($field); - if ($field eq 'author' && $options{canonize_names}) { - my @names = ($self->author); - $value = join(' and ', @names); - } - if ($field eq 'editor' && $options{canonize_names}) { - my @names = ($self->editor); - $value = join(' and ', @names); - } - if (exists($options{field_capitalization})) { - if ($options{field_capitalization} eq 'Uppercase') { - $field = uc $field; - } - if ($options{field_capitalization} eq 'Titlecase') { - $field = ucfirst $field; - } - } - $result .= " $field = {"."$value"."},\n"; - } - $result .= "}"; - return $result; -} - -1; # End of BibTeX::Entry - -__END__ -=pod - -=head1 NAME - -BibTeX::Parser::Entry - Contains a single entry of a BibTeX document. - -=head1 SYNOPSIS - -This class ist a wrapper for a single BibTeX entry. It is usually created -by a BibTeX::Parser. - - use BibTeX::Parser::Entry; - - my $entry = BibTeX::Parser::Entry->new($type, $key, $parse_ok, \%fields); - - if ($entry->parse_ok) { - my $type = $entry->type; - my $key = $enty->key; - print $entry->field("title"); - my @authors = $entry->author; - my @editors = $entry->editor; - - ... - - print $entry->to_string; - } - - - - - -=head1 FUNCTIONS - -=head2 new - -Create new entry. - -=head2 parse_ok - -If the entry was correctly parsed, this method returns a true value, false otherwise. - -=head2 error - -Return the error message, if the entry could not be parsed or undef otherwise. - -=head2 type - -Get or set the type of the entry, eg. 'ARTICLE' or 'BOOK'. Return value is -always uppercase. - -=head2 key - -Get or set the reference key of the entry. - -=head2 field($name [, $value]) - -Get or set the contents of a field. The first parameter is the name of the -field, the second (optional) value is the new value. - -=head2 cleaned_field($name) - -Retrieve the contents of a field in a format that is cleaned of TeX markup. - -=head2 cleaned_author - -Get an array of L<BibTeX::Parser::Author> objects for the authors of this -entry. Each name has been cleaned of accents and braces. - -=head2 cleaned_editor - -Get an array of L<BibTeX::Parser::Author> objects for the editors of this -entry. Each name has been cleaned of accents and braces. - -=head2 author([@authors]) - -Get or set the authors. Returns an array of L<BibTeX::Author|BibTeX::Author> -objects. The parameters can either be L<BibTeX::Author|BibTeX::Author> objects -or strings. - -Note: You can also change the authors with $entry->field('author', $authors_string) - -=head2 editor([@editors]) - -Get or set the editors. Returns an array of L<BibTeX::Author|BibTeX::Author> -objects. The parameters can either be L<BibTeX::Author|BibTeX::Author> objects -or strings. - -Note: You can also change the authors with $entry->field('editor', $editors_string) - -=head2 fieldlist () - -Returns a list of all the fields used in this entry. - -=head2 has($fieldname) - -Returns a true value if this entry has a value for $fieldname. - -=head2 pre () - -Return the text in BibTeX file before the entry - -=head2 raw_bibtex () - -Return raw BibTeX entry (if available). - -=head2 to_string ([options]) - -Returns a text of the BibTeX entry in BibTeX format. Options are -a hash. - -=over 4 - -=item C<canonize_names> - -If true (the default), authors' and editors' -names are translated into canonical bibtex form. The command -C<$entry-E<gt>to_string(canonize_names=E<gt>0)> overrides this behavior. - -=item C<field_capitalization> - -Capitalization of the field names. -Can take values 'Uppercase', 'Lowercase' (the default) or 'Titlecase' - -=item C<print_pre> - -False by default. If true, the text in the Bib file before the -entry is printed. Note that at present we assume the text -before the entry NEVER has the @ symbol inside - -=item C<type_capitalization> - -Capitalization of the type names. -Can take values 'Uppercase' (the default), 'Lowercase' or 'Titlecase' - - -=back - -=head1 VERSION - -version 1.04 - -=head1 AUTHOR - -Gerhard Gossen <gerhard.gossen@googlemail.com> and -Boris Veytsman <boris@varphi.com> and -Karl Berry <karl@freefriends.org> - -=head1 COPYRIGHT AND LICENSE - -This software is copyright (c) 2013-2023 by Gerhard Gossen and Boris Veytsman and Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -=cut - diff --git a/support/bibtexperllibs/BibTeX-Parser/notes b/support/bibtexperllibs/BibTeX-Parser/notes deleted file mode 100644 index 5e41df4090..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/notes +++ /dev/null @@ -1,26 +0,0 @@ -from Biblio::Catalog::BibTeX : - -sub tex2html { - my $latex = shift; - return "" unless defined($latex); - - for ($latex) { - s/\\textit\{([^{]+)\}/<i>$1<\/i>/g; - s/\\textbf\{([^{]+)\}/<b>$1<\/b>/g; - s/\\texttt\{([^{]+)\}/<tt>$1<\/tt>/g; - s/\\emph{([^{]+)}/<i>$1<\/i>/g; - s/\\item\b/<li>/g; - s/\\_/_/g; - s/\\mbox{([^}]+)}/$1/g; - s/{\\it\s([^}]+)}/<i>$1<\/i>/g; - s/\\LaTeX/LaTeX/g; - s/\\begin{itemize}/<ul>/g; - s/\\begin{quote}/<blockquote><i>/g; - s/\\end{quote}/<\/i><\/blockquote>/g; - s/\\end{itemize}/<\/ul>/g; - s/[}{]//g; - } - - return $latex; -} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/00-load.t b/support/bibtexperllibs/BibTeX-Parser/t/00-load.t deleted file mode 100644 index 9862dc7986..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/00-load.t +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 3; - -BEGIN { - use_ok( 'BibTeX::Parser' ); - use_ok( 'BibTeX::Parser::Author' ); - use_ok( 'BibTeX::Parser::Entry' ); -} - -diag( "Testing BibTeX::Parser $BibTeX::Parser::VERSION, Perl $], $^X" ); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t b/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t deleted file mode 100644 index 70e298d4be..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/01-parse.t +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 11; - -use BibTeX::Parser; -use IO::File; - -use constant ENTRIES => 1; - -my $fh = new IO::File "t/bibs/01.bib", "r" ; - -if (defined $fh) { - my $parser = new BibTeX::Parser $fh; - - isa_ok($parser, "BibTeX::Parser"); - - my $count = 0; - - while (my $entry = $parser->next) { - $count++; - isa_ok($entry, "BibTeX::Parser::Entry"); - is($entry->key, "key01", "key"); - is($entry->type, "ARTICLE", "type"); - ok($entry->parse_ok, "parse_ok"); - is($entry->field("year"), 1950, "field"); - is($entry->field("month"), "January~1", "field"); - - my @authors = $entry->author; - is(scalar @authors, 2, "#authors"); - isa_ok($authors[0], "BibTeX::Parser::Author"); - is("$authors[0]", "Duck, Donald", "correct author"); - } - - is($count, ENTRIES, "number of entries"); -} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t b/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t deleted file mode 100644 index 90b87eba14..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/02-parse_string.t +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 7; - -use BibTeX::Parser; - -my %strings = (); - -$_ = 1234; -parse_ok("parse digit string"); - -$_ = '"simple double quoted string"'; -parse_is("simple double quoted string", "- double quoted string"); - -$_ = '"double quotes { with embeded } brackets"'; -parse_is("double quotes { with embeded } brackets", "- with embeded brackets"); - -$_ = '"string 1 " # "string 2"'; -parse_is("string 1 string 2", "- concatenation"); - -$strings{test} = "string"; -$strings{other} = "text"; - -$_ = "test"; -parse_is("string", "- string variable"); - -$_ = "test # other"; -parse_is("stringtext", "- concatenation of string variables"); - -$_ = '"M{\"{u}}nchen"'; -parse_is('M{\"{u}}nchen', "- escaped quote"); - -sub parse_ok { - is(BibTeX::Parser::_parse_string(\%strings), $_, shift); -} - -sub parse_is { - is(BibTeX::Parser::_parse_string(\%strings), shift, shift); -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t b/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t deleted file mode 100644 index 6b4e4632bc..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/03-parse_entry.t +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 3; - -use IO::String; -use BibTeX::Parser; - -{ - my $string = q|@article{lin1973, - author = "Shen Lin and Brian W. Kernighan", - title = "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", - journal = "Operations Research", - volume = 21, - year = 1973, - pages = "498--516" - }|; - my $fh = IO::String->new($string); - - my $parser = BibTeX::Parser->new( $fh ); - -#my @result = BibTeX::Parser->_parse($fh); - - my $entry = $parser->next; - - is_deeply($entry, {_type => 'ARTICLE', _key => 'lin1973', author => "Shen Lin and Brian W. Kernighan", - title => "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", - journal => "Operations Research", - volume => 21, - year => 1973, - pages => "498--516", _parse_ok => 1, - _fieldnums => {'author' => 0, 'title' => 1, - 'journal' => 2, 'volume' => 3, - 'year' => 4, 'pages' => 5}, - _pre => '', - _raw => $string}, "parse \@ARTICLE"); - -} -{ - my $string1 = q|@article{lin1973, - author = "Shen Lin and Brian W. Kernighan", - title = "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", - journal = "Operations Research", - volume = 21, - year = 1973, - pages = "498--516" - }|; - my $string = "some -text -$string1"; - my $fh = IO::String->new($string); - - my $parser = BibTeX::Parser->new( $fh ); - -#my @result = BibTeX::Parser->_parse($fh); - - my $entry = $parser->next; - - is_deeply($entry, {_type => 'ARTICLE', _key => 'lin1973', author => "Shen Lin and Brian W. Kernighan", - title => "An Effective Heuristic Algorithm for the Travelling-Salesman Problem", - journal => "Operations Research", - volume => 21, - year => 1973, - pages => "498--516", _parse_ok => 1, - _fieldnums => {'author' => 0, 'title' => 1, - 'journal' => 2, 'volume' => 3, - 'year' => 4, 'pages' => 5}, - _pre => "some\ntext", - _raw => $string1}, "parse \@ARTICLE"); - -} -{ - my $string = q|@InProceedings{Herper:2001:MVS, - author = {Henry Herper}, - title = {{M}odellierung von {S}ystemen: ein
- {A}pplikationsgebiet im {I}nformatikunterricht}, - booktitle = {Informatikunterricht und Medienbildung, INFOS 2001
- (9. Fachtagung Informatik und Schule, Paderborn
- 17.-20- September 2001) -- Tagungsband}, - editor = {Reinhard Keil-Slavik and Johannes Magenheim}, - year = {2001}, -}|; - my $fh = IO::String->new($string); - - my $parser = BibTeX::Parser->new( $fh ); - - my $entry = $parser->next; - - is_deeply($entry, { - _type => 'INPROCEEDINGS', - _key => 'Herper:2001:MVS', - _fieldnums => {'author' => 0, 'title' => 1, - 'booktitle' => 2, 'editor' => 3, - 'year' => 4}, - author => "Henry Herper", - title => "{M}odellierung von {S}ystemen: ein {A}pplikationsgebiet im {I}nformatikunterricht", - booktitle => "Informatikunterricht und Medienbildung, INFOS 2001 (9. Fachtagung Informatik und Schule, Paderborn 17.-20- September 2001) -- Tagungsband", - editor => "Reinhard Keil-Slavik and Johannes Magenheim", - year => 2001, - _parse_ok => 1, - _pre => '', - _raw => $string}, "parse \@ARTICLE"); -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t b/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t deleted file mode 100644 index 3ca9797011..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/04-entry.t +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 13; - -use BibTeX::Parser::Entry; - - -my $entry = new BibTeX::Parser::Entry("type", "key", 1, {title => "title"}); - -isa_ok($entry, "BibTeX::Parser::Entry"); - -is($entry->type, "TYPE", "Entry::type get"); - -$entry->type("newtype"); - -is($entry->type, "NEWTYPE", "Entry::type set"); - -is($entry->key, "key", "Entry::key get"); - -$entry->key("newkey"); - -is($entry->key, "newkey", "Entry::key set"); - -is($entry->field("title"), "title", "Entry::field with new"); - -$entry->field("title" => "newtitle"); - -is($entry->field("title"), "newtitle", "Entry::field overwrite"); - -$entry->field("year" => 2008); - -is($entry->field("year"), 2008, "Entry::field set"); - -is($entry->field("pages"), undef, "Entry::field undef on unknown value"); - -is($entry->fieldlist, 2, "size of fieldlist"); - -ok($entry->has("title"), "Entry::has true on known value"); - -ok($entry->has("year"), "Entry::has true on known value"); - -ok( ! $entry->has("pages"), "Entry::has false on unknown value"); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/05-author.t b/support/bibtexperllibs/BibTeX-Parser/t/05-author.t deleted file mode 100644 index 45bc5413df..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/05-author.t +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/perl - -use Test::More; - -use BibTeX::Parser::Author; - -# Names from Mittelbach, Goossens: The LaTeX Companion, Second Edition. -my %names = ( - "Donald E. Knuth" => ["Donald E.", undef, "Knuth", undef], - "John Chris Smith" => ["John Chris", undef, "Smith", undef], - "Smith, John Chris" => ["John Chris", undef, "Smith", undef], - "Thomas von Neumann" => ["Thomas", "von", "Neumann", undef], - "von Neumann, Thomas" => ["Thomas", "von", "Neumann", undef], - "Lopez Fernandez, Miguel" => ["Miguel", undef, "Lopez Fernandez", undef], - "Pierre de la Porte" => ["Pierre", "de la", "Porte", undef], - "Smith, Jr., Robert" => ["Robert", undef, "Smith", "Jr."], - "von Smith, Jr., Robert" => ["Robert", "von", "Smith", "Jr."], - "Johannes Martinus Albertus van de Groene Heide" => ["Johannes Martinus Albertus", "van de", "Groene Heide", undef], - "Maria-Victoria Delgrande" => ["Maria-Victoria", undef, "Delgrande", undef], - "Anonymous" => [undef, undef, "Anonymous", undef], - "von Neumann" => [undef, "von", "Neumann", undef], - "N. Tetteh-Lartey" => ["N.", undef, "Tetteh-Lartey", undef], - "von Tetteh-Lartey, N." => ["N.", "von", "Tetteh-Lartey", undef], - "von Tetteh-Lartey, Jr., N." => ["N.", "von", "Tetteh-Lartey", "Jr."], - "" => [undef, undef, undef, undef], - " " => [undef, undef, undef, undef], - "\n" => [undef, undef, undef, undef], - "al." => [undef, undef, "al.", undef], - "et.~al." => [undef, undef, "et.~al.", undef], - "O'Malley, A." => ["A.", undef, "O'Malley", undef], - "A. O'Malley" => ["A.", undef, "O'Malley", undef], - "Arthur O'Malley" => ["Arthur", undef, "O'Malley", undef], - "O'Malley, Arthur" => ["Arthur", undef, "O'Malley", undef], - 'L.M. M\"uller' => ["L.M.", undef, 'M\"uller', undef], - 'M\"uller, L.M.' => ["L.M.", undef, 'M\"uller', undef], - 'L.M. M"uller' => ["L.M.", undef, 'M"uller', undef], - 'M"uller, L.M.' => ["L.M.", undef, 'M"uller', undef], - 'van Beethoven, Ludwig' => ["Ludwig", "van", "Beethoven", undef ], - '{Barnes and Noble, Inc.}' => [undef, undef, '{Barnes and Noble, Inc.}', undef], - "Ludwigg {van Beethoven}" => ["Ludwigg", undef, "{van Beethoven}", undef], - '{van Beethoven}, Ludwig' => ["Ludwig", undef, "{van Beethoven}", undef ], -); - -plan tests => (keys(%names) * 6 + 5); - -my $author = new BibTeX::Parser::Author; - -isa_ok($author, "BibTeX::Parser::Author", "Correct type"); - -is($author->first, undef, "Initial state 'first'"); -is($author->von, undef, "Initial state 'von'"); -is($author->last, undef, "Initial state 'last'"); -is($author->jr, undef, "Initial state 'jr'"); - - -foreach my $name (keys %names) { - - is_deeply([BibTeX::Parser::Author->split($name)], $names{$name}, $name =~ /\w/ ? $name : "whitespace name: '$name'" ); - - $author = new BibTeX::Parser::Author $name; - - isa_ok($author, "BibTeX::Parser::Author"); - - is($author->first, $names{$name}->[0] ); - is($author->von, $names{$name}->[1]); - is($author->last, $names{$name}->[2]); - is($author->jr, $names{$name}->[3]); -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t b/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t deleted file mode 100644 index 95a5848a71..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/06-parse_complex.t +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/perl - -use Test::More tests => 19; - -use strict; -use IO::File; -use BibTeX::Parser; - -my $fh = IO::File->new("t/bibs/06.bib"); - -my $parser = new BibTeX::Parser $fh; - - -my $entry = $parser->next; - -isa_ok($entry, 'BibTeX::Parser::Entry', "Correct type"); -ok($entry->parse_ok, "Entry parsed correctly"); -is($entry->type, "ARTICLE", "BibTeX type is correct"); -is($entry->field("title"), "Paper title", "Title attribute"); -is($entry->field("year"), 2008); -is($entry->field("month"), "August", "Month expansion"); -is($entry->key, 'key1', "key"); - -my @authors = $entry->author; -is(scalar @authors, 2, "number of authors correct"); -my $author = shift @authors; -is_deeply( - [$author->first, $author->von, $author->last, $author->jr], - ['Gerhard', undef, 'Gossen', undef], "author correct"); - -$author = shift @authors; -is_deeply( - [$author->first, $author->von, $author->last, $author->jr], - ['Ludwig', 'van', 'Beethoven', undef], "author correct"); - -$entry = $parser->next; -isa_ok($entry, 'BibTeX::Parser::Entry', "Correct type"); -ok($entry->parse_ok, "Entry parsed correctly"); -is($entry->type, "BOOK", "BibTeX type is correct"); -is($entry->field("title"), "Book title", "Title attribute"); -is($entry->field("year"), 2008); -is($entry->field("month"), "August", "Month expansion"); -is($entry->key, 'key2', "key"); -@authors = $entry->author; -is(scalar @authors, 1, "number of authors"); -is(scalar $entry->editor, 0, "number of editors"); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t b/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t deleted file mode 100644 index 3348a55248..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/07-parse_englishbib.t +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl - -use Test::More tests => 8; - -use strict; -use IO::File; -use BibTeX::Parser; - - -my $fh = IO::File->new("t/bibs/english.bib"); - -my $parser = new BibTeX::Parser $fh; - -my $count = 0; - -my $entry = $parser->next; - -is($entry->parse_ok, 0, "Ignore spurious @ before parenthesis"); - -$entry = $parser->next; - -is($entry->parse_ok, 0, "Ignore spurious @ in email address"); - -$entry = $parser->next; - -is(scalar $entry->author, 1, "# authors"); -#@BOOK{Carey, -# AUTHOR="G. V. Carey", -is($entry->field("title"), "Mind the Stop: A Brief Guide to Punctuation", "title"); -is($entry->field("publisher"), "Penguin", "publisher"); -is($entry->field("year"), 1958, "year"); -$count++; - -while ($entry = $parser->next) { - $count++; - if ($count == 8) { - is( scalar $entry->author, 4, 'Last entry has 4 authors'); - } -} - - -is($count, 8, "number of entries"); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t b/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t deleted file mode 100644 index 5375d9a062..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/08-parse_large.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More skip_all => "Performance test", tests => 1; - -use IO::File; -use BibTeX::Parser; - -my $starttime = time; - -my $fh = IO::File->new('t/bibs/java.bib'); #cl-nlp8x.bib'); - -my $parser = new BibTeX::Parser $fh; -my $entries = 0; - -#my @result = BibTeX::Parser->_parse($fh); - -while(my $entry = $parser->next) { - $entries++; -} - -my $parsetime = time - $starttime; - -warn "Parsed $entries entries in $parsetime seconds"; -ok(1, "Parsed $entries entries in $parsetime seconds"); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t b/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t deleted file mode 100644 index 56ce75cceb..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/09-complex.t +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 1; - -use IO::File; -use BibTeX::Parser; - - -my $fh = IO::File->new('t/bibs/09-complex.bib'); - -my $parser = new BibTeX::Parser $fh; - -#my @result = BibTeX::Parser->_parse($fh); - -my $entry = $parser->next; - -is_deeply($entry, {_type => 'ARTICLE', _key => 'Ahrenberg88', - author => "L. Ahrenberg and A. Jonsson", - title => "An interactive system for tagging dialogues", - journal => 'Literary \& Linguistic Computing', - volume => 3, - number => "2", - pages => "66--70", - year => "1988", - keywords => "conver", - _fieldnums => {'author' => 0, 'title' => 1, - 'journal' => 2, 'volume' => 3, - 'number' => 4, 'pages'=> 5, - 'year' => 6, 'keywords' => 7}, - _parse_ok => 1, - _raw => '@Article{Ahrenberg88, - author = "L. Ahrenberg and A. Jonsson", - title = "An interactive system for tagging dialogues", - journal = "Literary \& Linguistic Computing", - volume = "3", - number = "2", - pages = "66--70", - year = "1988", - keywords = "conver", -}', - _pre => '' - }, "parse \@ARTICLE"); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t b/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t deleted file mode 100644 index 8ab48396e9..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/10-funnyname.t +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 11; - -use IO::File; -use BibTeX::Parser; - -my $fh = IO::File->new('t/bibs/10-funnyname.bib'); - -my $parser = BibTeX::Parser->new($fh); - -#my @result = BibTeX::Parser->_parse($fh); - -my $entry = $parser->next; - -is_deeply( - $entry, - { - _type => 'ARTICLE', - _key => 'testkey', - author => 'A. Bar and L.M. M\"uller', - title => 'foo', - journal => 'journal', - volume => 1, - number => 1, - pages => 1, - year => 2008, - _parse_ok => 1, - _fieldnums => {'year' => 0, 'title' => 1, - 'author' => 2, 'journal' => 3, - 'volume' => 4, 'number'=> 5, - 'pages' => 6}, - _raw => '@article{testkey, - year = {2008}, - title = "foo", - author = {A. Bar and L.M. M\"uller}, - journal = {journal}, - volume = {1}, - number = {1}, - pages = {1}, -}', - _pre => '' - }, - "parse \@ARTICLE" -); - -my @authors = $entry->author; - -pass("->author didn't loop forever"); -ok(@authors == 2, "Two authors"); - -is($authors[0]->first, 'A.', "A1 first name"); -is($authors[0]->last, 'Bar', "A1 last name"); -ok(!$authors[0]->von, "A1 no 'von'"); -ok(!$authors[0]->jr, "A1 no 'jr'"); - -is($authors[1]->first, 'L.M.', "A2 first name"); -is($authors[1]->last, 'M\"uller', "A2 last name"); -ok(!$authors[1]->von, "A2 no 'von'"); -ok(!$authors[1]->jr, "A2 no 'jr'"); - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/11-split_braced.t b/support/bibtexperllibs/BibTeX-Parser/t/11-split_braced.t deleted file mode 100644 index 85a29be86f..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/11-split_braced.t +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 12; - -use BibTeX::Parser; -use IO::File; - -my @tokens = BibTeX::Parser::_split_braced_string("a and b", '\s+and\s+'); -is(scalar @tokens,2); -is($tokens[0],'a'); -is($tokens[1],'b'); - -@tokens = BibTeX::Parser::_split_braced_string("a {and} b", '\s+and\s+'); -is(scalar @tokens,1); -is($tokens[0],'a {and} b'); - -@tokens = BibTeX::Parser::_split_braced_string("a {and b", '\s+and\s+'); -is(scalar @tokens,0); - -@tokens = BibTeX::Parser::_split_braced_string("} a {", '\s+'); -is(scalar @tokens,0); - -@tokens = BibTeX::Parser::_split_braced_string("{a b} c {d}e u", '\s+'); -is(scalar @tokens,4); -is($tokens[0],'{a b}'); -is($tokens[1],'c'); -is($tokens[2],'{d}e'); -is($tokens[3],'u'); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/12-von_token.t b/support/bibtexperllibs/BibTeX-Parser/t/12-von_token.t deleted file mode 100644 index 6daceafa96..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/12-von_token.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests => 5; - -use BibTeX::Parser::Author; -use IO::File; - -is(BibTeX::Parser::Author::_is_von_token('von'),1); -is(BibTeX::Parser::Author::_is_von_token('Von'),0); -is(BibTeX::Parser::Author::_is_von_token('\noop{von}Von'),1); -is(BibTeX::Parser::Author::_is_von_token('\noop{Von}von'),0); -is(BibTeX::Parser::Author::_is_von_token('\noop{AE}{\AE}schylus'),0); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/13_output.t b/support/bibtexperllibs/BibTeX-Parser/t/13_output.t deleted file mode 100644 index 02fb1cd26f..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/13_output.t +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More; - -use BibTeX::Parser; -use IO::File; - - -my $fh = new IO::File "t/bibs/01.bib", "r" ; - -my $parser = new BibTeX::Parser $fh; - - - - -while (my $entry = $parser->next) { - if($entry->key eq 'key01') { - my $result1='@ARTICLE{key01, - year = {1950}, - author = {Duck, Donald and Else, Someone}, - editor = {Itor, E. D. and Other, A. N.}, - title = {Title text}, - month = {January~1}, -}'; - my $result2='@ARTICLE{key01, - year = {1950}, - author = {Donald Duck and Someone Else}, - editor = {E. D. Itor and A. N. Other}, - title = {Title text}, - month = {January~1}, -}'; - is($entry->to_string,$result1); - is($entry->to_string(canonize_names=>0),$result2); - } - -} - -done_testing(); - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t b/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t deleted file mode 100644 index 0a663b043a..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/14-extratext.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl -w - - -use Test::More tests => 6; - -use BibTeX::Parser; -use IO::File; - - -my $fh = new IO::File "t/bibs/14-extratext.bib", "r" ; - -my $parser = new BibTeX::Parser $fh; - - - - -while (my $entry = $parser->next) { - - if($entry->key eq 'Partridge') { - my $result1= '@BOOK{Partridge, - author = {Partridge, Eric}, - title = {Use and Abuse: a Guide to Good {E}nglish}, - publisher = {Hamish Hamilton}, - edition = {4}, - year = {1970}, -}'; - my $result2 = "First published in 1947\n$result1"; - is($entry->to_string,$result1); - is($entry->to_string(print_pre=>1),$result2); - } - - if ($entry->key eq 'Cooper') { - my $result1 = '@BOOK{Cooper, - author = {Cooper, Bruce M.}, - title = {Writing Technical Reports}, - publisher = {Penguin}, - year = {1964}, -}'; - my $result2 = "\n\n$result1"; - is($entry->to_string,$result1); - is($entry->to_string(print_pre=>1),$result2); - } - - - if ($entry->key eq 'Fowler-ModernEnglish') { - - my $result1 = '@BOOK{Fowler-ModernEnglish, - author = {Fowler, H. W.}, - title = {[A Dictionary of] Modern {E}nglish Usage}, - publisher = {Oxford University Press}, - edition = {2}, - year = {1965}, -}'; - my $result2 = ' - - -First published in 1926 -'. $result1; - is($entry->to_string,$result1); - is($entry->to_string(print_pre=>1),$result2); - } -} - -done_testing(); - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t b/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t deleted file mode 100644 index 4254f5c12f..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/15-capitalization.t +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More tests=>7; - -use BibTeX::Parser; -use IO::File; - - -my $fh = new IO::File "t/bibs/01.bib", "r" ; - -my $parser = new BibTeX::Parser $fh; - - - - -while (my $entry = $parser->next) { - if($entry->key eq 'key01') { - my $result1='@ARTICLE{key01, - year = {1950}, - author = {Duck, Donald and Else, Someone}, - editor = {Itor, E. D. and Other, A. N.}, - title = {Title text}, - month = {January~1}, -}'; - my $result2='@ARTICLE{key01, - YEAR = {1950}, - AUTHOR = {Duck, Donald and Else, Someone}, - EDITOR = {Itor, E. D. and Other, A. N.}, - TITLE = {Title text}, - MONTH = {January~1}, -}'; - my $result3='@ARTICLE{key01, - Year = {1950}, - Author = {Duck, Donald and Else, Someone}, - Editor = {Itor, E. D. and Other, A. N.}, - Title = {Title text}, - Month = {January~1}, -}'; - my $result4='@article{key01, - year = {1950}, - author = {Duck, Donald and Else, Someone}, - editor = {Itor, E. D. and Other, A. N.}, - title = {Title text}, - month = {January~1}, -}'; - my $result5='@Article{key01, - year = {1950}, - author = {Duck, Donald and Else, Someone}, - editor = {Itor, E. D. and Other, A. N.}, - title = {Title text}, - month = {January~1}, -}'; - is($entry->to_string,$result1); - is($entry->to_string(field_capitalization=>'Lowercase'), - $result1); - is($entry->to_string(field_capitalization=>'Uppercase'), - $result2); - is($entry->to_string(field_capitalization=>'Titlecase'), - $result3); - - is($entry->to_string(type_capitalization=>'Lowercase'), - $result4); - is($entry->to_string(type_capitalization=>'Uppercase'), - $result1); - is($entry->to_string(type_capitalization=>'Titlecase'), - $result5); - } - -} - -done_testing(); - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib deleted file mode 100644 index 7f6233d177..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/01.bib +++ /dev/null @@ -1,7 +0,0 @@ -@ARTICLE{key01, - year = 1950, - author = {Donald Duck and Someone Else}, - editor = {E. D. Itor and A. N. Other}, - title = {Title text}, - month = jan # "~1" -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib deleted file mode 100644 index 242ae662cc..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/06.bib +++ /dev/null @@ -1,27 +0,0 @@ -this is text, which is ignored by bibtex. - -@PREAMBLE{ - This is only used for BibTeX files used in LaTeX documents -} - -@Comment{ - Comments are ignored too. -} - -@ARTICLE{key1, - author = {Gerhard Gossen and Ludwig van Beethoven}, - title = "Paper title", - year = 2008, - month = aug, -} - -@STRING{ gerhard = "Gerhard" } - -@STRING{ gossen = "Gossen" } - -@BOOK{ key2, - author = gerhard # " " # gossen, - title = "Book title", - year = "2008", - month = aug, -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib deleted file mode 100644 index cacf322723..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/09-complex.bib +++ /dev/null @@ -1,11 +0,0 @@ -@Article{Ahrenberg88, - author = "L. Ahrenberg and A. Jonsson", - title = "An interactive system for tagging dialogues", - journal = "Literary \& Linguistic Computing", - volume = "3", - number = "2", - pages = "66--70", - year = "1988", - keywords = "conver", -} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib deleted file mode 100644 index 050fbc0534..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/10-funnyname.bib +++ /dev/null @@ -1,10 +0,0 @@ -@article{testkey, - year = {2008}, - title = "foo", - author = {A. Bar and L.M. M\"uller}, - journal = {journal}, - volume = {1}, - number = {1}, - pages = {1}, -} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib deleted file mode 100644 index 56f96aa01b..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/14-extratext.bib +++ /dev/null @@ -1,22 +0,0 @@ -First published in 1947 -@BOOK{Partridge, - AUTHOR="Eric Partridge", - TITLE="Use and Abuse: a Guide to Good {E}nglish", - PUBLISHER="Hamish Hamilton", - EDITION="4", YEAR="1970"} - - -@BOOK{Cooper, - AUTHOR="Bruce M. Cooper", - TITLE="Writing Technical Reports", - PUBLISHER="Penguin", YEAR="1964"} - - - -First published in 1926 -@BOOK{Fowler-ModernEnglish, - AUTHOR="H. W. Fowler", - TITLE="[A Dictionary of] Modern {E}nglish Usage", - PUBLISHER="Oxford University Press", - EDITION="2", YEAR="1965"} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/braces.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/braces.bib deleted file mode 100644 index 3791fb5760..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/braces.bib +++ /dev/null @@ -1,21 +0,0 @@ -@Article{scholkopf98kpca, - author = {Bernhard {Sch\"olkopf} and Alex Smola and K.R. Muller}, - title = {Nonlinear component analysis as a kernel eigenvalue -problem}, - journal = {Neural Computation}, - year = {1998}, - volume = {10}, - pages = {1299--1319} -} - -@article{brownetal93, - author = {Peter F. Brown and Stephen A. {Della Pietra} and - Vincent J. {Della Pietra} and Robert~L. Mercer}, - title = {The Mathematics of Statistical Machine Translation: - Parameter Estimation}, - journal = {Computational Linguistics}, - year = 1993, - volume = 19, - number = 2, - pages = {263-311} -} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt b/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt deleted file mode 100644 index e75f1d2050..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/endnote.txt +++ /dev/null @@ -1,6 +0,0 @@ -@article{ - volume = {59}, - number = {6}, - year = {1999} -} - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt b/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt deleted file mode 100644 index 256f5a853d..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/engineering_village.txt +++ /dev/null @@ -1,24 +0,0 @@ -@inproceedings{1997493856789 , -language = {English}, -year = {1997}, -} - - -@inproceedings{1998043944915 , -language = {English}, -year = {1997}, -} - - -@article{2003137419501 , -language = {English}, -year = {2002}, -} - - -@inproceedings{2002367072517 , -language = {English}, -year = {2002}, -} - - diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib b/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib deleted file mode 100644 index f0f097409f..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/english.bib +++ /dev/null @@ -1,55 +0,0 @@ -$Id: @(#) english.bib 1.0 23-OCT-1989 17:10:00 Aston archive$ - -Please notify Adrian F Clark <alien@uk.ac.essex.ese> of any additions -or corrections to this list. - -@BOOK{Carey, - AUTHOR="G. V. Carey", - TITLE="Mind the Stop: A Brief Guide to Punctuation", - PUBLISHER="Penguin", YEAR="1958"} - -@BOOK{Cooper, - AUTHOR="Bruce M. Cooper", - TITLE="Writing Technical Reports", - PUBLISHER="Penguin", YEAR="1964"} - -@BOOK{Fowler-ModernEnglish, - AUTHOR="H. W. Fowler", - TITLE="[A Dictionary of] Modern {E}nglish Usage", - PUBLISHER="Oxford University Press", - EDITION="2", YEAR="1965"} - (but first published in 1926) - -@BOOK{Fowler-KingsEnglish, - AUTHOR="H. W. Fowler and F. G. Fowler", - TITLE="The {K}ing's {E}nglish", - PUBLISHER="Oxford University Press", - EDITION="3", YEAR="1931"} - (but first published in 1906) - -@BOOK{Gowers, - AUTHOR="Sir Ernest Gowers", - TITLE="The Complete Plain Words", - PUBLISHER="Penguin", YEAR="1954"} - (but first published by HMSO) - -@BOOK{Hart, - AUTHOR="Horace Hart", - TITLE="[Hart's] Rules for Compositors and Readers - [at the Oxford University Press]", - PUBLISHER="Oxford University Press", - EDITION="39", YEAR="1983"} - (but first published in 1893) - -@BOOK{Partridge, - AUTHOR="Eric Partridge", - TITLE="Use and Abuse: a Guide to Good {E}nglish", - PUBLISHER="Hamish Hamilton", - EDITION="4", YEAR="1970"} - (but first published in 1947) - -@BOOK{Quirk-CompGram, - AUTHOR="Randolph Quirk and Sydney Greenbaum and Geoffrey Leach and - Jan Svartnik", - TITLE="A Comprehensive Grammar of the {E}nglish Language", - PUBLISHER="Longman", YEAR="1985"} diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt b/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt deleted file mode 100644 index eea5a05a70..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bibs/mathscinet.txt +++ /dev/null @@ -1,40 +0,0 @@ -MathSciNet </mathscinet/index.html> - - * - Clipboard </mathscinet/clipboard.html> - * Home </mathscinet/index.html> - * Preferences </mathscinet/preferences.html> - * Help </mathscinet/help/headline_review_help_full.html> - * Support Mail </mathscinet/support_mail.html> - * Terms of Use </mathscinet/help/mathscinet_terms_of_use.html> - * University of Southampton - -@article {MR2254280, - VOLUME = {23}, - YEAR = {2006}, -} - - -@article {MR2254274, - VOLUME = {23}, - YEAR = {2006}, -} - - -@article {MR2248052, - VOLUME = {23}, - YEAR = {2006}, -} - - -*Matches:* 3 -Mirror Sites - - -© Copyright 2011, American Mathematical Society -<http://www.ams.org/ams/copyright.html> -Privacy Statement <http://www.ams.org/ams/privacy.html> -American Mathematical Society <http://www.ams.org> -American Mathematical Society -201 Charles Street -Providence, RI 02904-2294 diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t b/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t deleted file mode 100644 index ac83b43aa9..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bug66325.t +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More; - -use BibTeX::Parser; -use IO::File; - -{ - my $fh = new IO::File "t/bibs/endnote.txt", "r" ; - - if (defined $fh) { - my $parser = new BibTeX::Parser $fh; - - while (my $entry = $parser->next) { - isa_ok($entry, "BibTeX::Parser::Entry"); - ok($entry->parse_ok, "parse_ok"); - is($entry->key, undef, "key"); - is($entry->type, "ARTICLE", "type"); - is($entry->field("year"), 1999, "field"); - is($entry->field("volume"), 59, "first field"); - } - } -} - -{ - my $fh = new IO::File "t/bibs/mathscinet.txt", "r" ; - my @keys = qw(MR2254280 MR2254274 MR2248052); - - if (defined $fh) { - my $parser = new BibTeX::Parser $fh; - my $count = 0; - - while (my $entry = $parser->next) { - isa_ok($entry, "BibTeX::Parser::Entry"); - ok($entry->parse_ok, "parse_ok"); - is($entry->key, $keys[$count], "key"); - is($entry->type, "ARTICLE", "type"); - is($entry->field("volume"), 23, "first field"); - is($entry->field("year"), 2006, "field"); - $count++; - } - - is($count, 3, "number of entries"); - } -} - -{ - my $fh = new IO::File "t/bibs/engineering_village.txt", "r" ; - - my @types = qw( inproceedings inproceedings article inproceedings ); - my @keys = qw( 1997493856789 1998043944915 2003137419501 2002367072517 ); - my @years = qw( 1997 1997 2002 2002 ); - - if (defined $fh) { - my $parser = new BibTeX::Parser $fh; - my $count = 0; - - while (my $entry = $parser->next) { - isa_ok($entry, "BibTeX::Parser::Entry"); - ok($entry->parse_ok, "parse_ok"); - is($entry->key, $keys[$count], "key"); - is($entry->type, uc $types[$count], "type"); - is($entry->field("language"), "English", "first field"); - is($entry->field("year"), $years[$count], "field"); - $count++; - } - - is($count, 4, "number of entries"); - } -} -done_testing; diff --git a/support/bibtexperllibs/BibTeX-Parser/t/bug67419.t b/support/bibtexperllibs/BibTeX-Parser/t/bug67419.t deleted file mode 100644 index 0f944f373a..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/bug67419.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -w - -use Test::More; - -use BibTeX::Parser; -use IO::File; - -my $fh = new IO::File "t/bibs/braces.bib", "r" ; -my $parser = new BibTeX::Parser $fh; -while (my $entry=$parser->next) { - is($entry->parse_ok,1); - if ($entry->key eq 'scholkopf98kpca') { - @authors=$entry->author; - is(scalar @authors,3); - is("$authors[0]", '{Sch\"olkopf}, Bernhard'); - is("$authors[1]", 'Smola, Alex'); - is("$authors[2]", 'Muller, K.R.'); - } - if ($entry->key eq 'brownetal93') { - @authors=$entry->author; - is(scalar @authors,4); - is("$authors[0]", 'Brown, Peter F.'); - is("$authors[1]", '{Della Pietra}, Stephen A.'); - is("$authors[2]", '{Della Pietra}, Vincent J.'); - is("$authors[3]", 'Mercer, Robert~L.'); - } -} - -done_testing(); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t b/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t deleted file mode 100644 index 980fb1d60d..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/cleaned_field.t +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use utf8; - -use Test::More; -use BibTeX::Parser::Entry; - -sub new_entry { - BibTeX::Parser::Entry->new( 'ARTICLE', 'Foo2010', 1, { @_ } ); -} -{ - my @german_tests = ( - [ '"a' => 'ä' ], - ['"`' => '„' ], - ["\"'" => '“' ], - ); - - foreach my $test ( @german_tests ) { - my $entry = new_entry( foo => $test->[0] ); - is( $entry->cleaned_field( 'foo', german => 1 ), $test->[1], "Convert $test->[0], german => 1" ); - } -} - -{ - binmode( DATA, ':utf8' ); - while (<DATA>) { - chomp; - my ( $tex, $result ) = split /\t/; - is( new_entry( foo => $tex )->cleaned_field( 'foo' ), $result, "Convert $tex" ); - } - close DATA; -} - -{ - my $entry_with_authors = new_entry( author => 'F{\"o}o Bar and B"ar, F.' ); - my @authors = $entry_with_authors->author; - is( scalar @authors, 2, "Number of authors is correct"); - is( $authors[0]->first, 'F{\"o}o', "non-cleaned version of first" ); - is( $authors[0]->last, 'Bar', "non-cleaned version of last" ); - - is( $authors[1]->first, 'F.', "non-cleaned version of first" ); - is( $authors[1]->last, 'B"ar', "non-cleaned version of last" ); - - my @clean_authors = $entry_with_authors->cleaned_author; - is( $clean_authors[0]->first, 'Föo', "cleaned version of first" ); - is( $clean_authors[0]->last, 'Bar', "cleaned version of last" ); - - is( $clean_authors[1]->first, 'F.', "cleaned version of first" ); - is( $clean_authors[1]->last, 'B"ar', "cleaned version of last" ); -} -done_testing; - -__DATA__ -\# # -\& & -{\`a} à -{\^a} â -{\~a} ã -{\'a} á -{\'{a}} á -{\"a} ä -{\`A} À -{\'A} Á -{\"A} Ä -{\aa} å -{\AA} Å -{\ae} æ -{\bf 12} 12 -{\'c} ć -{\cal P} P -{\c{c}} ç -{\c{C}} Ç -{\c{e}} ȩ -{\c{s}} ş -{\c{S}} Ş -{\c{t}} ţ -{\-d} d -{\`e} è -{\^e} ê -{\'e} é -{\"e} ë -{\'E} É -{\em bits} bits -{\H{o}} ő -{\`i} ì -{\^i} î -{\i} ı -{\`i} ì -{\'i} í -{\"i} ï -{\`\i} ì -{\'\i} í -{\"\i} ï -{\`{\i}} ì -{\'{\i}} í -{\"{\i}} ï -{\it Note} Note -{\k{e}} ę -{\l} ł -{\-l} l -{\log} log -{\~n} ñ -{\'n} ń -{\^o} ô -{\o} ø -{\'o} ó -{\"o} ö -{\"{o}} ö -{\'O} Ó -{\"O} Ö -{\"{O}} Ö -{\rm always} always -{\-s} s -{\'s} ś -{\sc JoiN} JoiN -{\sl bit\/ \bf 7} bit 7 -{\sl L'Informatique Nouvelle} L’Informatique Nouvelle -{\small and} and -{\ss} ß -{\TeX} TeX -{\TM} ™ -{\tt awk} awk -{\^u} û -{\'u} ú -{\"u} ü -{\"{u}} ü -{\'U} Ú -{\"U} Ü -{\u{a}} ă -{\u{g}} ğ -{\v{c}} č -{\v{C}} Č -{\v{e}} ě -{\v{n}} ň -{\v{r}} ř -{\v{s}} š -{\v{S}} Š -{\v{z}} ž -{\v{Z}} Ž -{\'y} ý -{\.{z}} ż diff --git a/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t b/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t deleted file mode 100644 index fc40a57c2a..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/pod-coverage.t +++ /dev/null @@ -1,18 +0,0 @@ -use strict; -use warnings; -use Test::More; - -# Ensure a recent version of Test::Pod::Coverage -my $min_tpc = 1.08; -eval "use Test::Pod::Coverage $min_tpc"; -plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" - if $@; - -# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, -# but older versions don't recognize some common documentation styles -my $min_pc = 0.18; -eval "use Pod::Coverage $min_pc"; -plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" - if $@; - -all_pod_coverage_ok(); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/pod.t b/support/bibtexperllibs/BibTeX-Parser/t/pod.t deleted file mode 100644 index e22a39b524..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/pod.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use warnings; -use Test::More; - -# Ensure a recent version of Test::Pod -my $min_tp = 1.22; -eval "use Test::Pod $min_tp"; -plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; - -all_pod_files_ok(); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t b/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t deleted file mode 100644 index 3a818499f0..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/release-pod-coverage.t +++ /dev/null @@ -1,21 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -use Test::More; - -eval "use Test::Pod::Coverage 1.08"; -plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" - if $@; - -eval "use Pod::Coverage::TrustPod"; -plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" - if $@; - -all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff --git a/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t b/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t deleted file mode 100644 index d46a955694..0000000000 --- a/support/bibtexperllibs/BibTeX-Parser/t/release-pod-syntax.t +++ /dev/null @@ -1,15 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - -use Test::More; - -eval "use Test::Pod 1.41"; -plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; - -all_pod_files_ok(); diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/Changes b/support/bibtexperllibs/LaTeX-ToUnicode/Changes deleted file mode 100644 index 3db5c19724..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/Changes +++ /dev/null @@ -1,27 +0,0 @@ -Changes for LaTeX::ToUnicode - -0.54 2023-11-17 Better handling of \{ \}. New release - -0.53 2023-08-20 Tests fixed, new release - -0.52 2022-11-07 Support many more control sequences, \kern removal, - \<newline>, etc. Add ltxunitxt script to access functionality - from command line. - -0.11 2020-12-12 Updates and cleaing - -0.05 2016-11-23 02:28:35+00:00 - Compatibility with perl 5.25 (Alexandr Ciornii) - -0.04 2015-12-25 19:16:41+00:00 - Macrons are handled properly - -0.03 2010-10-18 18:04:14 - Specify minimal perl version (5.8.0) for UTF-8 support - -0.02 2010/07/09 - Handle accents with \i - Add script used to generate accents table - -0.01 2010/07/09 - First release. diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/LICENSE b/support/bibtexperllibs/LaTeX-ToUnicode/LICENSE deleted file mode 100644 index c3402b3869..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/LICENSE +++ /dev/null @@ -1,375 +0,0 @@ -Copyright 2010-2023 Gerhard Gossen, Boris Veytsman, Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. - -Terms of the Perl programming language system itself - -a) the GNU General Public License as published by the Free - Software Foundation; either version 1, or (at your option) any - later version, or -b) the "Artistic License" - ---- The GNU General Public License, Version 1, February 1989 --- - -This is free software, licensed under: - - The GNU General Public License, Version 1, February 1989 - - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 - - Copyright (C) 1989 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The license agreements of most software companies try to keep users -at the mercy of those companies. By contrast, our General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. The -General Public License applies to the Free Software Foundation's -software and to any other program whose authors commit to using it. -You can use it for your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Specifically, the General Public License is designed to make -sure that you have the freedom to give away or sell copies of free -software, that you receive source code or can get it if you want it, -that you can change the software or use pieces of it in new free -programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of a such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any program or other work which -contains a notice placed by the copyright holder saying it may be -distributed under the terms of this General Public License. The -"Program", below, refers to any such program or work, and a "work based -on the Program" means either the Program or any work containing the -Program or a portion of it, either verbatim or with modifications. Each -licensee is addressed as "you". - - 1. You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this -General Public License and to the absence of any warranty; and give any -other recipients of the Program a copy of this General Public License -along with the Program. You may charge a fee for the physical act of -transferring a copy. - - 2. You may modify your copy or copies of the Program or any portion of -it, and copy and distribute such modifications under the terms of Paragraph -1 above, provided that you also do the following: - - a) cause the modified files to carry prominent notices stating that - you changed the files and the date of any change; and - - b) cause the whole of any work that you distribute or publish, that - in whole or in part contains the Program or any part thereof, either - with or without modifications, to be licensed at no charge to all - third parties under the terms of this General Public License (except - that you may choose to grant warranty protection to some or all - third parties, at your option). - - c) If the modified program normally reads commands interactively when - run, you must cause it, when started running for such interactive use - in the simplest and most usual way, to print or display an - announcement including an appropriate copyright notice and a notice - that there is no warranty (or else, saying that you provide a - warranty) and that users may redistribute the program under these - conditions, and telling the user how to view a copy of this General - Public License. - - d) You may charge a fee for the physical act of transferring a - copy, and you may at your option offer warranty protection in - exchange for a fee. - -Mere aggregation of another independent work with the Program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other work under the scope of these terms. - - 3. You may copy and distribute the Program (or a portion or derivative of -it, under Paragraph 2) in object code or executable form under the terms of -Paragraphs 1 and 2 above provided that you also do one of the following: - - a) accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of - Paragraphs 1 and 2 above; or, - - b) accompany it with a written offer, valid for at least three - years, to give any third party free (except for a nominal charge - for the cost of distribution) a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of - Paragraphs 1 and 2 above; or, - - c) accompany it with the information you received as to where the - corresponding source code may be obtained. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form alone.) - -Source code for a work means the preferred form of the work for making -modifications to it. For an executable file, complete source code means -all the source code for all modules it contains; but, as a special -exception, it need not include source code for modules which are standard -libraries that accompany the operating system on which the executable -file runs, or for standard header files or definitions files that -accompany that operating system. - - 4. You may not copy, modify, sublicense, distribute or transfer the -Program except as expressly provided under this General Public License. -Any attempt otherwise to copy, modify, sublicense, distribute or transfer -the Program is void, and will automatically terminate your rights to use -the Program under this License. However, parties who have received -copies, or rights to use copies, from you under this General Public -License will not have their licenses terminated so long as such parties -remain in full compliance. - - 5. By copying, distributing or modifying the Program (or any work based -on the Program) you indicate your acceptance of this license to do so, -and all its terms and conditions. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the original -licensor to copy, distribute or modify the Program subject to these -terms and conditions. You may not impose any further restrictions on the -recipients' exercise of the rights granted herein. - - 7. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of the license which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -the license, you may choose any version ever published by the Free Software -Foundation. - - 8. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to humanity, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - - To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19xx name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items--whatever suits your -program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - program `Gnomovision' (a program to direct compilers to make passes - at assemblers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -That's all there is to it! - - ---- The Artistic License 1.0 --- - -This software is Copyright (c) 2010 by Gerhard Gossen. - -This is free software, licensed under: - - The Artistic License 1.0 - -The Artistic License - -Preamble - -The intent of this document is to state the conditions under which a Package -may be copied, such that the Copyright Holder maintains some semblance of -artistic control over the development of the package, while giving the users of -the package the right to use and distribute the Package in a more-or-less -customary fashion, plus the right to make reasonable modifications. - -Definitions: - - - "Package" refers to the collection of files distributed by the Copyright - Holder, and derivatives of that collection of files created through - textual modification. - - "Standard Version" refers to such a Package if it has not been modified, - or has been modified in accordance with the wishes of the Copyright - Holder. - - "Copyright Holder" is whoever is named in the copyright or copyrights for - the package. - - "You" is you, if you're thinking about copying or distributing this Package. - - "Reasonable copying fee" is whatever you can justify on the basis of media - cost, duplication charges, time of people involved, and so on. (You will - not be required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) - - "Freely Available" means that no fee is charged for the item itself, though - there may be fees involved in handling the item. It also means that - recipients of the item may redistribute it under the same conditions they - received it. - -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that you -duplicate all of the original copyright notices and associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications derived -from the Public Domain or from the Copyright Holder. A Package modified in such -a way shall still be considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, provided that -you insert a prominent notice in each changed file stating how and when you -changed that file, and provided that you do at least ONE of the following: - - a) place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet or an - equivalent medium, or placing the modifications on a major archive site - such as ftp.uu.net, or by allowing the Copyright Holder to include your - modifications in the Standard Version of the Package. - - b) use the modified Package only within your corporation or organization. - - c) rename any non-standard executables so the names do not conflict with - standard executables, which must also be provided, and provide a separate - manual page for each non-standard executable that clearly documents how it - differs from the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -4. You may distribute the programs of this Package in object code or executable -form, provided that you do at least ONE of the following: - - a) distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on where to - get the Standard Version. - - b) accompany the distribution with the machine-readable source of the Package - with your modifications. - - c) accompany any non-standard executables with their corresponding Standard - Version executables, giving the non-standard executables non-standard - names, and clearly documenting the differences in manual pages (or - equivalent), together with instructions on where to get the Standard - Version. - - d) make other distribution arrangements with the Copyright Holder. - -5. You may charge a reasonable copying fee for any distribution of this -Package. You may charge any fee you choose for support of this Package. You -may not charge a fee for this Package itself. However, you may distribute this -Package in aggregate with other (possibly commercial) programs as part of a -larger (possibly commercial) software distribution provided that you do not -advertise this Package as a product of your own. - -6. The scripts and library files supplied as input to or produced as output -from the programs of this Package do not automatically fall under the copyright -of this Package, but belong to whomever generated them, and may be sold -commercially, and may be aggregated with this Package. - -7. C or perl subroutines supplied by you and linked into this Package shall not -be considered part of this Package. - -8. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -The End - diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/MANIFEST b/support/bibtexperllibs/LaTeX-ToUnicode/MANIFEST deleted file mode 100644 index 2aa0688c10..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/MANIFEST +++ /dev/null @@ -1,17 +0,0 @@ -LICENSE -Changes -MANIFEST -t/release-pod-coverage.t -t/release-pod-syntax.t -t/convert.t -t/release-synopsis.t -README -script/ltx2unitxt -script/convert.pl -lib/LaTeX/ToUnicode/Tables.pm -lib/LaTeX/ToUnicode.pm -Makefile.PL -head.ltx -Makefile.TDS -weaver.ini -dist.ini diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.PL b/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.PL deleted file mode 100644 index 7aa2b21234..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.PL +++ /dev/null @@ -1,51 +0,0 @@ - -use strict; -use warnings; - -BEGIN { require 5.8.0; } - -use ExtUtils::MakeMaker 6.31; - - - -my %WriteMakefileArgs = ( - 'ABSTRACT' => 'Convert LaTeX commands to Unicode', - 'AUTHOR' => 'Gerhard Gossen <gerhard.gossen@googlemail.com> and Boris Veytsman <boris@varphi.com> and Karl Berry <karl@freefriends.com>', - 'BUILD_REQUIRES' => { - 'Pod-LaTeX' => '0.61' - }, - 'CONFIGURE_REQUIRES' => { - 'ExtUtils::MakeMaker' => '6.31' - }, - 'DISTNAME' => 'LaTeX-ToUnicode', - 'EXE_FILES' => ['script/ltx2unitxt'], - 'LICENSE' => 'perl', - 'NAME' => 'LaTeX::ToUnicode', - 'PREREQ_PM' => {}, - 'VERSION_FROM' => 'lib/LaTeX/ToUnicode.pm', - 'test' => { - 'TESTS' => 't/*.t' - } -); - - -unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { - my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; - my $pp = $WriteMakefileArgs{PREREQ_PM}; - for my $mod ( keys %$br ) { - if ( exists $pp->{$mod} ) { - $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; - } - else { - $pp->{$mod} = $br->{$mod}; - } - } -} - -delete $WriteMakefileArgs{CONFIGURE_REQUIRES} - unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; - -WriteMakefile(%WriteMakefileArgs); - - - diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.TDS b/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.TDS deleted file mode 100644 index 4255cfa6b6..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/Makefile.TDS +++ /dev/null @@ -1,53 +0,0 @@ -# -# This is Makefile for TDS-compliant TeX distributions -# Written by Boris Veytsman, boris@varphi.com -# -# This file is in public domain -# -PREFIX = /usr/local - -LIBDIR = $(PREFIX)/scripts/bibtexperllibs - -DOCDIR = $(PREFIX)/doc/bibtex/bibtexperllibs - -DOCS = latex-tounicode.pdf ltx2unitxt.pdf ltx2unitxt.1 - -all: - -docs: $(DOCS) - -latex-tounicode.pdf: latex-tounicode.tex ltx2unitxt.pdf - texfot pdflatex $< || { rm -f $@; exit 1; } - -ToUnicode = lib/LaTeX/ToUnicode - -latex-tounicode.tex: $(ToUnicode).pm $(ToUnicode)/Tables.pm - pod2latex -modify -full -prefile head.ltx -out $@ $^ - -latex-tounicode.tex: head.ltx -# unfortunately pod2latex doesn't recognize =encoding, so there -# are two warnings of "Command encoding not recognised ...". Oh well. - -ltx2unitxt.1: script/ltx2unitxt -# don't run --version since the --help message includes --version output. - help2man --no-info --version-string=" " \ ---name="convert LaTeX source fragment to plain (Unicode) text or simple html" \ - $< >$@ \ - || { rm -f $@; exit 1; } -ltx2unitxt.pdf: ltx2unitxt.1 - sed 's/^Releases:/\nReleases:/' $< | groff -man -t -rS11 - | ps2pdf - $@ - -force: - -install: all docs - mkdir -p $(LIBDIR) - cp -r lib/* $(LIBDIR) - mkdir -p $(DOCDIR) - cp -r man/man3/* $(DOCDIR) - cp -r latex-tounicode.pdf ltx2unitxt.pdf ltx2unitxt.1 $(DOCDIR) - -clean: - $(RM) *.log *.aux *.out *.toc latex-tounicode.tex *.tar.gz - -distclean: clean - $(RM) $(DOCS)
\ No newline at end of file diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/README b/support/bibtexperllibs/LaTeX-ToUnicode/README deleted file mode 100644 index 1f241e3979..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/README +++ /dev/null @@ -1,13 +0,0 @@ -This is the LaTeX::ToUnicode Perl package: - - Convert LaTeX source fragments to Unicode plain text or simple html - -Dev sources, bug tracker: https://github.com/borisveytsman/bibtexperllibs -Releases: https://ctan.org/pkg/bibtexperllibs - -Copyright 2010-2022 Gerhard Gossen, Boris Veytsman, Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl5 programming language system itself. - - diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/dist.ini b/support/bibtexperllibs/LaTeX-ToUnicode/dist.ini deleted file mode 100644 index 5c038d1985..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/dist.ini +++ /dev/null @@ -1,16 +0,0 @@ -name = LaTeX-ToUnicode -author = Gerhard Gossen <gerhard.gossen@googlemail.com> and Boris Veytsman <boris@varphi.com> and Karl Berry <karl@freefriends.org> -license = Perl_5 -copyright_holder = Gerhard Gossen and Boris Veytsman -copyright_year = 2010-2023 -version = 0.53 - -[@Classic] -[Prereqs] -perl = 5.8.0 -[NextRelease] -format = %-7v %{yyyy-MM-dd HH:mm:ss}d -[PodWeaver] -[Repository] -[@Git] -[SynopsisTests] diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/head.ltx b/support/bibtexperllibs/LaTeX-ToUnicode/head.ltx deleted file mode 100644 index 3f946fcba0..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/head.ltx +++ /dev/null @@ -1,28 +0,0 @@ -% documentation for LaTeX::ToUnicode. -% head.ltx file public domain. -% -\documentclass[11pt]{article} -\usepackage{fullpage,pdfpages} -\usepackage[hidelinks]{hyperref} -\let\printindex=\empty % index is not useful -\sloppy \hbadness=3000 % not aiming for good typesetting - -% Silence useless font warning about braces in cmsy instead of cmtt: -\makeatletter\def\@font@warning#1{}\makeatother - -% https://tex.stackexchange.com/questions/68272 -\newcommand\invisiblesection[1]{% - \refstepcounter{section}% - \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}% - \sectionmark{#1}% -} - -\begin{document} -\title{\texttt{LaTeX::ToUnicode} documentation} -\author{Boris Veytsman\thanks{borisv@lk.net}} -\maketitle -\tableofcontents - -\invisiblesection{ltx2unitxt---convert \LaTeX\ source fragments} - -\includepdf[pages=-]{ltx2unitxt} diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/latex-tounicode.pdf b/support/bibtexperllibs/LaTeX-ToUnicode/latex-tounicode.pdf Binary files differdeleted file mode 100644 index b319b6ebcb..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/latex-tounicode.pdf +++ /dev/null diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode.pm b/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode.pm deleted file mode 100644 index 1759a6acd6..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode.pm +++ /dev/null @@ -1,778 +0,0 @@ -use strict; -use warnings; -package LaTeX::ToUnicode; -BEGIN { - $LaTeX::ToUnicode::VERSION = '0.54'; -} -#ABSTRACT: Convert LaTeX commands to Unicode (simplistically) - -require Exporter; -our @ISA = qw(Exporter); -our @EXPORT_OK = qw( convert debuglevel $endcw ); - -use utf8; -use Encode; -use LaTeX::ToUnicode::Tables; - -# Terminating a control word (not symbol) the way TeX does: at the -# boundary between a letter (lookbehind) and a nonletter (lookahead), -# and then ignore any following whitespace. -our $endcw = qr/(?<=[a-zA-Z])(?=[^a-zA-Z]|$)\s*/; - -# all we need for is debugging being on and off. And it's pretty random -# what gets output. -my $debug = 0; - -sub debuglevel { $debug = shift; } -sub _debug { - return unless $debug; - # The backtrace info is split between caller(0) and caller(1), sigh. - # We don't need the package name, it's included in $subr in practice. - my (undef,$filename,$line,undef) = caller(0); - my (undef,undef,undef,$subr) = caller(1); - warn @_, " at $filename:$line ($subr)\n"; -} - -# The main conversion function. -# -sub convert { - my ($string, %options) = @_; - #warn debug_hash_as_string("starting with: $string", %options); - - # First, remove leading and trailing horizontal whitespace - # on each line of the possibly-multiline string we're given. - $string =~ s/^[ \t]*//m; - $string =~ s/[ \t]*$//m; - - # For HTML output, must convert special characters that were in the - # TeX text (&<>) to their entities to avoid misparsing. We want to - # do this first, because conversion of the markup commands might - # output HTML tags like <tt>, and we don't want to convert those <>. - # Although <tt> works, better to keep the output HTML as - # human-readable as we can. - # - if ($options{html}) { - $string =~ s/([^\\]|^)&/$1&/g; - $string =~ s/</</g; - $string =~ s/>/>/g; - } - - my $user_hook = $options{hook}; - if ($user_hook) { - $string = &$user_hook($string, \%options); - _debug("after user hook: $string"); - } - - # Convert general commands that take arguments, since (1) they might - # insert TeX commands that need to be converted, and (2) because - # their arguments could well contain constructs that will map to a - # Perl string \x{nnnn} for Unicode character nnnn; those Perl braces - # for the \x will confuse further parsing of the TeX. - # - $string = _convert_commands_with_arg($string); - _debug("after commands with arg: $string"); - - # Convert markups (\texttt, etc.); they have the same brace-parsing issue. - $string = _convert_markups($string, \%options); - _debug("after markups: $string"); - - # And urls, a special case of commands with arguments. - $string = _convert_urls($string, \%options); - _debug("after urls: $string"); - - $string = _convert_control_words($string); - _debug("after control words: $string"); - - $string = _convert_control_symbols($string); - _debug("after control symbols: $string"); - - $string = _convert_accents($string); - $string = _convert_german($string) if $options{german}; - $string = _convert_symbols($string); - $string = _convert_ligatures($string); - - # Let's handle ties here, after all the other conversions, since - # they don't fit well with any of the tables. - # - # /~, or ~ at the beginning of a line, is probably part of a url or - # path, not a tie. Otherwise, consider it a space, since a no-break - # spot in TeX is most likely fine to break in text or HTML. - # - $string =~ s,([^/])~,$1 ,g; - - # Remove kerns. Clearly needs generalizing/sharpening to recognize - # dimens better, and plenty of other commands could use it. - #_debug("before kern: $string"); - my $dimen_re = qr/[-+]?[0-9., ]+[a-z][a-z]\s*/; - $string =~ s!\\kern${endcw}${dimen_re}!!g; - - # What the heck, let's do \hfuzz and \vfuzz too. They come up pretty - # often and practically the same thing (plus ignore optional =).. - $string =~ s!\\[hv]fuzz${endcw}=?\s*${dimen_re}!!g; - - # After all the conversions, $string contains \x{....} constructs - # (Perl Unicode characters) where translations have happened. Change - # those to the desired output format. Thus we assume that the - # Unicode \x{....}'s are not themselves involved in further - # translations, which is, so far, true. - # - if (! $options{entities}) { - # Convert our \x strings from Tables.pm to the binary characters. - - # As an extra-special case, we want to preserve the translation of - # \{ and \} as 007[bd] entities even if the --entities option is - # not give; otherwise they'd get eliminated like all other braces. - # Use a temporary cs \xx to keep them marked, and don't use braces - # to delimit the argument since they'll get deleted. - $string =~ s/\\x\{(007[bd])\}/\\xx($1)/g; - - # Convert all other characters to characters. - # Assume exactly four hex digits, since we wrote Tables.pm that way. - $string =~ s/\\x\{(....)\}/ pack('U*', hex($1))/eg; - - } elsif ($options{entities}) { - # Convert the XML special characters that appeared in the input, - # e.g., from a TeX \&. Unless we're generating HTML output, in - # which case they have already been converted. - if (! $options{html}) { - $string =~ s/&/&/g; - $string =~ s/</</g; - $string =~ s/>/>/g; - } - - # Our values in Tables.pm are simple ASCII strings \x{....}, - # so we can replace them with hex entities with no trouble. - # Fortunately TeX does not have a standard \x control sequence. - $string =~ s/\\x\{(....)\}/&#x$1;/g; - - # The rest of the job is about binary Unicode characters in the - # input. We want to transform them into entities also. As always - # in Perl, there's more than one way to do it, and several are - # described here, just for the fun of it. - my $ret = ""; - # - # decode_utf8 is described in https://perldoc.perl.org/Encode. - # Without the decode_utf8, all of these methods output each byte - # separately; apparently $string is a byte string at this point, - # not a Unicode string. I don't know why that is. - $ret = decode_utf8($string); - # - # Transform everything that's not printable ASCII or newline into - # entities. - $ret =~ s/([^ -~\n])/ sprintf("&#x%04x;", ord($1)) /eg; - # - # This method leaves control characters as literal; doesn't matter - # for XML output, since control characters aren't allowed, but - # let's use the regexp method anyway. - #$ret = encode("ascii", decode_utf8($string), Encode::FB_XMLCREF); - # - # The nice_string function from perluniintro also works. - # - # This fails, just outputs numbers (that is, ord values): - # foreach my $c (unpack("U*", $ret)) { - # - # Without the decode_utf8, outputs each byte separately. - # With the decode_utf8, works, but the above seems cleaner. - #foreach my $c (split(//, $ret)) { - # if (ord($c) <= 31 || ord($c) >= 128) { - # $ret .= sprintf("&#x%04x;", ord($c)); - # } else { - # $ret .= $c; - # } - #} - # - $string = $ret; # assigned from above. - } - - if ($string =~ /\\x\{/) { - warn "LaTeX::ToUnicode::convert: untranslated \\x remains: $string\n"; - warn "LaTeX::ToUnicode::convert: please report as bug.\n"; - } - - # Drop all remaining braces. - $string =~ s/[{}]//g; - - if (! $options{entities}) { - # With all the other braces gone, now we can convert the preserved - # brace entities from \{ and \} to actual braces. - $string =~ s/\\xx\((007[bd])\)/ pack('U*', hex($1))/eg; - } - - # Backslashes might remain. Don't remove them, as it makes for a - # useful way to find unhandled commands. - - # leave newlines alone, but trim spaces and tabs. - $string =~ s/^[ \t]+//s; # remove leading whitespace - $string =~ s/[ \t]+$//s; # remove trailing whitespace - $string =~ s/[ \t]+/ /gs; # collapse all remaining whitespace to one space - - $string; -} - -# Convert commands that take a single braced argument. The table -# defines text we're supposed to insert before and after the argument. -# We let future processing handle conversion of both the inserted text -# and the argument. -# -sub _convert_commands_with_arg { - my $string = shift; - - foreach my $cmd ( keys %LaTeX::ToUnicode::Tables::ARGUMENT_COMMANDS ) { - my $repl = $LaTeX::ToUnicode::Tables::ARGUMENT_COMMANDS{$cmd}; - my $lft = $repl->[0]; # ref to two-element list - my $rht = $repl->[1]; - # \cmd{foo} -> LFT foo RHT - $string =~ s/\\$cmd${endcw}\{(.*?)\}/$lft$1$rht/g; - #warn "replaced arg $cmd, yielding $string\n"; - } - - $string; -} - -# Convert url commands in STRING. This is a special case of commands -# with arguments: \url{u} and \href{u}{desc text}. The HTML output -# (generated if $OPTIONS{html} is set) is just too special to be handled -# in a table; further, \href is the only two-argument command we are -# currently handling. -# -sub _convert_urls { - my ($string,$options) = @_; - - if ($options->{html}) { - # HTML output. - # \url{URL} -> <a href="URL">URL</a> - $string =~ s,\\url$endcw\{([^}]*)\} - ,<a href="$1">$1</a>,gx; - # - # \href{URL}{TEXT} -> <a href="URL">TEXT</a> - $string =~ s,\\href$endcw\{([^}]*)\}\s*\{([^}]*)\} - ,<a href="$1">$2</a>,gx; - - } else { - # plain text output. - # \url{URL} -> URL - $string =~ s/\\url$endcw\{([^}]*)\}/$1/g; - # - # \href{URL}{TEXT} -> TEXT (URL) - # but, as a special case, if URL ends with TEXT, just output URL, - # as in: - # \href{https://doi.org/10/fjzzc8}{10/fjzzc8} - # -> - # https://doi.org/10/fjzzc8 - # - # Yet more specialness: the TEXT might have extra braces, as in - # \href{https://doi.org/10/fjzzc8}{{10/fjzzc8}} - # left over from previous markup commands (\path) which got - # removed. We want to accept and ignore such extra braces, - # hence the \{+ ... \}+ in recognizing TEXT. - # -#warn "txt url: starting with $string\n"; - if ($string =~ m/\\href$endcw\{([^}]*)\}\s*\{+([^}]*)\}+/) { - my $url = $1; - my $text = $2; -#warn " url: $url\n"; -#warn " text: $text\n"; - my $repl = ($url =~ m!$text$!) ? $url : "$text ($url)"; -#warn " repl: $repl\n"; - $string =~ s/\\href$endcw\{([^}]*)\}\s*\{+([^}]*)\}+/$repl/; -#warn " str: $string\n"; - } - } - - $string; -} - -# Convert control words (not symbols), that is, a backslash and an -# alphabetic sequence of characters terminated by a non-alphabetic -# character. Following whitespace is ignored. -# -sub _convert_control_words { - my $string = shift; - - foreach my $command ( keys %LaTeX::ToUnicode::Tables::CONTROL_WORDS ) { - my $repl = $LaTeX::ToUnicode::Tables::CONTROL_WORDS{$command}; - # replace {\CMD}, whitespace ignored after \CMD. - $string =~ s/\{\\$command$endcw\}/$repl/g; - - # replace \CMD, preceded by not-consumed non-backslash. - $string =~ s/(?<=[^\\])\\$command$endcw/$repl/g; - - # replace \CMD at beginning of whole string, which otherwise - # wouldn't be matched. Two separate regexps to avoid - # variable-length lookbehind. - $string =~ s/^\\$command$endcw/$repl/g; - } - - $string; -} - -# Convert control symbols, other than accents. Much simpler than -# control words, since are self-delimiting, don't take arguments, and -# don't consume any following text. -# -sub _convert_control_symbols { - my $string = shift; - - foreach my $symbol ( keys %LaTeX::ToUnicode::Tables::CONTROL_SYMBOLS ) { - my $repl = $LaTeX::ToUnicode::Tables::CONTROL_SYMBOLS{$symbol}; - - # because these are not alphabetic, we can quotemeta them, - # and we need to because "\" is one of the symbols. - my $rx = quotemeta($symbol); - - # the preceding character must not be a backslash, else "\\ " - # could have the "\ " seen first as a control space, leaving - # a spurious \ behind. Don't consume the preceding. - # Or it could be at the beginning of a line. - # - $string =~ s/(^|(?<=[^\\]))\\$rx/$repl/g; - #warn "after sym $symbol (\\$rx -> $repl), have: $string\n"; - } - - $string; -} - -# Convert accents. -# -sub _convert_accents { - my $string = shift; - - # first the non-alphabetic accent commands, like \". - my %tbl = %LaTeX::ToUnicode::Tables::ACCENT_SYMBOLS; - $string =~ s/(\{\\(.)\s*\{(\\?\w{1,2})\}\})/$tbl{$2}{$3} || $1/eg; #{\"{a}} - $string =~ s/(\{\\(.)\s*(\\?\w{1,2})\})/ $tbl{$2}{$3} || $1/eg; # {\"a} - $string =~ s/(\\(.)\s*(\\?\w{1,1}))/ $tbl{$2}{$3} || $1/eg; # \"a - $string =~ s/(\\(.)\s*\{(\\?\w{1,2})\})/ $tbl{$2}{$3} || $1/eg; # \"{a} - - # second the alphabetic commands, like \c. They have to be handled - # differently because \cc is not \c{c}! The only difference in the - # regular expressions is using $endcw instead of just \s*. - # - %tbl = %LaTeX::ToUnicode::Tables::ACCENT_LETTERS; - $string =~ s/(\{\\(.)$endcw\{(\\?\w{1,2})\}\})/$tbl{$2}{$3} || $1/eg; #{\"{a}} - $string =~ s/(\{\\(.)$endcw(\\?\w{1,2})\})/ $tbl{$2}{$3} || $1/eg; # {\"a} - $string =~ s/(\\(.)$endcw(\\?\w{1,1}))/ $tbl{$2}{$3} || $1/eg; # \"a - $string =~ s/(\\(.)$endcw\{(\\?\w{1,2})\})/ $tbl{$2}{$3} || $1/eg; # \"{a} - - - # The argument is just one \w character for the \"a case, not two, - # because otherwise we might consume a following character that is - # not part of the accent, e.g., a backslash (\"a\'e). - # - # Others can be two because of the \t tie-after accent. Even {\t oo} is ok. - # - # Allow whitespace after the \CMD in all cases, e.g., "\c c". Even - # for the control symbols, it turns out spaces are ignored there - # (as in \" o), unlike the usual syntax. - # - # Some non-word constituents would work, but in practice we hope - # everyone just uses letters. - - $string; -} - -# For the [n]german package. -sub _convert_german { - my $string = shift; - - foreach my $symbol ( keys %LaTeX::ToUnicode::Tables::GERMAN ) { - $string =~ s/\Q$symbol\E/$LaTeX::ToUnicode::Tables::GERMAN{$symbol}/g; - } - $string; -} - -# Control words that produce printed symbols (and letters in languages -# other than English), that is. -# -sub _convert_symbols { - my $string = shift; - - foreach my $symbol ( keys %LaTeX::ToUnicode::Tables::SYMBOLS ) { - my $repl = $LaTeX::ToUnicode::Tables::SYMBOLS{$symbol}; - # preceded by a (non-consumed) non-backslash, - # usual termination for a control word. - # These commands don't take arguments. - $string =~ s/(?<=[^\\])\\$symbol$endcw/$repl/g; - - # or the beginning of the whole string: - $string =~ s/^\\$symbol$endcw/$repl/g; - } - $string; -} - -# Special character sequences, not \commands. They aren't all -# technically ligatures, but no matter. -# -sub _convert_ligatures { - my $string = shift; - - # have to convert these in order specified. - my @ligs = @LaTeX::ToUnicode::Tables::LIGATURES; - for (my $i = 0; $i < @ligs; $i+=2) { - my $in = $ligs[$i]; - my $out = $ligs[$i+1]; - $string =~ s/\Q$in\E/$out/g; - } - $string; -} - -# -# Convert LaTeX markup commands in STRING like \textbf{...} and -# {\bfshape ...} and {\bf ...}. -# -# If we're aiming for plain text output, they are just cleared away (the -# braces are not removed). -# -# If we're generating HTML output ("html" key is set in $OPTIONS hash -# ref), we use the value in the hash, so that \textbf{foo} becomes -# <b>foo</b>. Nested markup doesn't work. -# -sub _convert_markups { - my ($string, $options) = @_; - - # HTML is different. - return _convert_markups_html($string) if $options->{html}; - - # Not HTML, so here we'll "convert" to plain text by removing the - # markup commands. - - # we can do all the markup commands at once. - my $markups = join('|', keys %LaTeX::ToUnicode::Tables::MARKUPS); - - # Remove \textMARKUP{...}, leaving just the {...} - $string =~ s/\\text($markups)$endcw//g; - - # Similarly remove \MARKUPshape, plus remove \upshape. - $string =~ s/\\($markups|up)shape$endcw//g; - - # Remove braces and \command in: {... \MARKUP ...} - $string =~ s/(\{[^{}]+)\\(?:$markups)$endcw([^{}]+\})/$1$2/g; - - # Remove braces and \command in: {\MARKUP ...} - $string =~ s/\{\\(?:$markups)$endcw([^{}]*)\}/$1/g; - - # Remove: {\MARKUP - # Although this will leave unmatched } chars behind, there's no - # alternative without full parsing, since the bib entry will often - # look like: {\em {The TeX{}book}}. Also might, in principle, be - # at the end of a line. - $string =~ s/\{\\(?:$markups)$endcw//g; - - # Ultimately we remove all braces in ltx2crossrefxml SanitizeText fns, - # so the unmatched braces don't matter ... that code should be moved. - - $string; -} - -# Convert \markup in STRING to html. We can't always figure out where to -# put the end tag, but we always put it somewhere. We don't even attempt -# to handle nested markup. -# -sub _convert_markups_html { - my ($string) = @_; - - my %MARKUPS = %LaTeX::ToUnicode::Tables::MARKUPS; - # have to consider each markup \command separately. - for my $markup (keys %MARKUPS) { - my $hcmd = $MARKUPS{$markup}; # some TeX commands don't translate - my $tag = $hcmd ? "<$hcmd>" : ""; - my $end_tag = $hcmd ? "</$hcmd>" : ""; - - # The easy one: \textMARKUP{...} - $string =~ s/\\text$markup$endcw\{(.*?)\}/$tag$1$end_tag/g; - - # {x\MARKUP(shape) y} -> x<mk>y</mk> (leave out braces) - $string =~ s/\{([^{}]+)\\$markup(shape)?$endcw([^{}]+)\} - /$1$tag$3$end_tag/gx; - - # {\MARKUP(shape) y} -> <mk>y</mk>. Same as previous but without - # the x part. Could do it in one regex but this seems clearer. - $string =~ s/\{\\$markup(shape)?$endcw([^{}]+)\} - /$tag$2$end_tag/gx; - - # for {\MARKUP(shape) ... with no matching brace, we don't know - # where to put the end tag, so seems best to do nothing. - } - - $string; -} - - -############################################################## -# debug_hash_as_string($LABEL, HASH) -# -# Return LABEL followed by HASH elements, followed by a newline, as a -# single string. If HASH is a reference, it is followed (but no recursive -# derefencing). -############################################################### -sub debug_hash_as_string { - my ($label) = shift; - my (%hash) = (ref $_[0] && $_[0] =~ /.*HASH.*/) ? %{$_[0]} : @_; - - my $str = "$label: {"; - my @items = (); - for my $key (sort keys %hash) { - my $val = $hash{$key}; - $val = ".undef" if ! defined $val; - $key =~ s/\n/\\n/g; - $val =~ s/\n/\\n/g; - push (@items, "$key:$val"); - } - $str .= join (",", @items); - $str .= "}"; - - return "$str\n"; -} - -1; - -__END__ -=pod - -=encoding UTF-8 - -=head1 NAME - -LaTeX::ToUnicode - Convert LaTeX commands to Unicode - -=head1 VERSION - -version 0.54 - -=head1 SYNOPSIS - - use LaTeX::ToUnicode qw( convert debuglevel $endcw ); - - # simple examples: - convert( '{\"a}' ) eq 'ä'; # true - convert( '{\"a}', entities=>1 ) eq '�EF;'; # true - convert( '"a', german=>1 ) eq 'ä'; # true, `german' package syntax - convert( '"a', ) eq '"a'; # false, not enabled by default - - # more generally: - my $latexstr; - my $unistr = convert($latexstr); # get literal (binary) Unicode characters - - my $entstr = convert($latexstr, entities=>1); # get &#xUUUU; - - my $htmstr = convert($latexstr, entities=>1, html=>1); # also html markup - - my $unistr = convert($latexstr, hook=>\&my_hook); # user-defined hook - - # if nonzero, dumps various info; perhaps other levels in the future. - LaTeX::ToUnicode::debuglevel($verbose); - - # regexp for terminating TeX control words, e.g., in hooks. - my $endcw = $LaTeX::ToUnicode::endcw; - $string =~ s/\\newline$endcw/ /g; # translate \newline to space - -=head1 DESCRIPTION - -This module provides a method to convert LaTeX markups for accents etc. -into their Unicode equivalents. It translates some commands for special -characters or accents into their Unicode (or HTML) equivalents and -removes formatting commands. It is not at all bulletproof or complete. - -This module is intended to convert fragments of LaTeX source, such as -bibliography entries and abstracts, into plain text (or, optionally, -simplistic HTML). It is not a document conversion system. Math, tables, -figures, sectioning, etc., are not handled in any way, and mostly left -in their TeX form in the output. The translations assume standard LaTeX -meanings for characters and control sequences; macros in the input are -not considered. - -The aim for all the output is utter simplicity and minimalism, not -faithful translation. For example, although Unicode has a code point for -a thin space, the LaTeX C<\thinspace> (etc.) command is translated to -the empty string; such spacing refinements desirable in the TeX output -are, in our experience, generally not desired in the HTML output from -this tool. - -As another example, TeX C<%> comments are not removed, even on lines by -themselves, because they may be inside verbatim blocks, and we don't -attempt to keep any such context. In practice, TeX comments are rare in -the text fragments intended to be handled, so removing them in advance -has not been a great burden. - -As another example, LaTeX ties, C<~> characters, are replaced with -normal spaces (exception: unless they follow a C</> character or at the -beginning of a line, when they're assumed to be part of a url or a -pathname), rather than a no-break space character, because in our -experience most ties intended for the TeX output would just cause -trouble in plain text or HTML. - -Regarding normal whitespace: all leading and trailing horizontal -whitespace (that is, SPC and TAB) is removed. All internal horizontal -whitespace sequences are collapsed to a single space. - -After the conversions, all brace characters (C<{}>) are simply removed -from the returned string. This turns out to be a significant convenience -in practice, since many LaTeX commands which take arguments don't need -to do anything for our purposes except output the argument. - -On the other hand, backslashes are not removed. This is so the caller -can check for C<\\> and thus discover untranslated commands. Of course -there are many other constructs that might not be translated, or -translated wrongly. There is no escaping the need to carefully look at -the output. - -Suggestions and bug reports are welcome for practical needs; we know -full well that there are hundreds of commands not handled that could be. -Virtually all the behavior mentioned here would be easily made -customizable, if there is a need to do so. - -=head1 FUNCTIONS - -=head2 convert( $latex_string, %options ) - -Convert the text in C<$latex_string> into a plain(er) Unicode string. -Escape sequences for accented and special characters (e.g., C<\i>, -C<\"a>, ...) are converted. A few basic formatting commands (e.g., -C<{\it ...}>) are removed. See the L<LaTeX::ToUnicode::Tables> submodule -for the full conversion tables. - -These keys are recognized in C<%options>: - -=over - -=item C<entities> - -Output C<&#xUUUU;> entities (valid in XML); in this case, also convert -the E<lt>, E<gt>, C<&> metacharacters to entities. Recognized non-ASCII -Unicode characters in the original input are also converted to entities, -not only the translations from TeX commands. - -The default is to output literal (binary) Unicode characters, and -not change any metacharacters. - -=item C<german> - -If this option is set, the commands introduced by the package `german' -(e.g. C<"a> eq C<ä>, note the missing backslash) are also -handled. - -=item C<html> - -If this option is set, the output is simplistic html rather than plain -text. This affects only a few things: S<1) the> output of urls from -C<\url> and C<\href>; S<2) the> output of markup commands like -C<\textbf> (but nested markup commands don't work); S<3) two> other -random commands, C<\enquote> and C<\path>, because they are needed. - -=item C<hook> - -The value must be a function that takes two arguments and returns a -string. The first argument is the incoming string (may be multiple -lines), and the second argument is a hash reference of options, exactly -what was passed to this C<convert> function. Thus the hook can detect -whether html is needed. - -The hook is called (almost) right away, before any of the other -conversions have taken place. That way the hook can make use of the -predefined conversions instead of repeating them. The only changes made -to the input string before the hook is called are trivial: leading and -trailing whitespace (space and tab) on each line are removed, and, for -HTML output, incoming ampersand, less-than, and greater-than characters -are replaced with their entities. - -Any substitutions that result in Unicode code points must use -C<\\x{nnnn}> on the right hand side: that's two backslashes and a -four-digit hex number. - -As an example, here is a skeleton of the hook function for TUGboat: - - sub LaTeX_ToUnicode_convert_hook { - my ($string,$options) = @_; - - my $endcw = $LaTeX::ToUnicode::endcw; - die "no endcw regexp in LaTeX::ToUnicode??" if ! $endcw; - - ... - $string =~ s/\\newline$endcw/ /g; - - # TUB's \acro{} takes an argument, but we do nothing with it. - # The braces will be removed by convert(). - $string =~ s/\\acro$endcw//g; - ... - $string =~ s/\\CTAN$endcw/CTAN/g; - $string =~ s/\\Dash$endcw/\\x{2014}/g; # em dash; replacement is string - ... - - # ignore \begin{abstract} and \end{abstract} commands. - $string =~ s,\\(begin|end)$endcw\{abstract\}\s*,,g; - - # Output for our url abbreviations, and other commands, depends on - # whether we're generating plain text or HTML. - if ($options->{html}) { - # HTML. - # \tbsurl{URLBASE} -> <a href="https://URLBASE">URLBASE</a> - $string =~ s,\\tbsurl$endcw\{([^}]*)\} - ,<a href="https://$1">$1</a>,gx; - ... - # varepsilon, and no line break at hyphen. - $string =~ s,\\eTeX$endcw,\\x{03B5}<nobr>-</nobr>TeX,g; - - } else { - # for plain text, we can just prepend the protocol://. - $string =~ s,\\tbsurl$endcw,https://,g; - ... - $string =~ s,\\eTeX$endcw,\\x{03B5}-TeX,g; - } - ... - return $string; - } - -As shown here for C<\eTeX> (an abbreviation macro defined in the -TUGboat style files), if markup is desired in the output, the -substitutions must be different for HTML and plain text. Otherwise, the -desired HTML markup is transliterated as if it were plain text. Or else -the translations must be extended so that TeX markup can be used on the -rhs to be replaced with the desired HTML (C<<nobr>> in this case). - -For the full definition (and plenty of additional information), -see the file C<ltx2crossrefxml-tugboat.cfg> in the TUGboat source -repository at -<https://github.com/TeXUsersGroup/tugboat/tree/trunk/capsules/crossref>. - -The hook function is specified in the C<convert()> call like this: - - LaTeX::ToUnicode::convert(..., { hook => \&LaTeX_ToUnicode_convert_hook }) - -=back - -=head2 debuglevel( $level ) - -Output debugging information if C<$level> is nonzero. - -=head2 $endcw - -A predefined regexp for terminating TeX control words (not control -symbols!). Can be used in, for example, hook functions: - - my $endcw = $LaTeX::ToUnicode::endcw; - $string =~ s/\\newline$endcw/ /g; # translate \newline to space - -It's defined as follows: - - our $endcw = qr/(?<=[a-zA-Z])(?=[^a-zA-Z]|$)\s*/; - -That is, look behind for an alphabetic character, then look ahead for a -non-alphabetic character (or end of line), then consume whitespace. -Fingers crossed. - -=head1 AUTHOR - -Gerhard Gossen <gerhard.gossen@googlemail.com>, -Boris Veytsman <boris@varphi.com>, -Karl Berry <karl@freefriends.org> - -L<https://github.com/borisveytsman/bibtexperllibs> - -=head1 COPYRIGHT AND LICENSE - -Copyright 2010-2023 Gerhard Gossen, Boris Veytsman, Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl5 programming language system itself. - -=cut diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode/Tables.pm b/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode/Tables.pm deleted file mode 100644 index dd02926e03..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/lib/LaTeX/ToUnicode/Tables.pm +++ /dev/null @@ -1,726 +0,0 @@ -package LaTeX::ToUnicode::Tables; -BEGIN { - $LaTeX::ToUnicode::Tables::VERSION = '0.54'; -} -use strict; -use warnings; -#ABSTRACT: Character tables for LaTeX::ToUnicode - -use utf8; # just for the german support - -# Technically not all of these are ligatures, but close enough. -# Order is important, so has to be a list, not a hash. -# -our @LIGATURES = ( - "---" => '\x{2014}', # em dash - "--" => '\x{2013}', # en dash - "!`" => '\x{00A1}', # inverted exclam - "?`" => '\x{00A1}', # inverted question - "``" => '\x{201c}', # left double - "''" => '\x{201d}', # right double - "`" => '\x{2018}', # left single - "'" => '\x{2019}', # right single -); -# test text: em---dash, en--dash, exc!`am, quest?`ion, ``ld, rd'', `ls, rs'. -# -# Some additional ligatures supported in T1 encoding, but we won't (from -# tex-text.map): -# U+002C U+002C <> U+201E ; ,, -> DOUBLE LOW-9 QUOTATION MARK -# U+003C U+003C <> U+00AB ; << -> LEFT POINTING GUILLEMET -# U+003E U+003E <> U+00BB ; >> -> RIGHT POINTING GUILLEMET - -# for {\MARKUP(shape) ...} and \textMARKUP{...}; although not all -# command names are defined in LaTeX for all markups, we translate them -# anyway. Also, LaTeX has more font axes not included here: md, ulc, sw, -# ssc, etc. See ltfntcmd.dtx and ltfssaxes.dtx if we ever want to try -# for completeness. -# -our %MARKUPS = ( - 'bf' => 'b', - 'cal' => '', - 'em' => 'em', - 'it' => 'i', - 'rm' => '', - 'sc' => '', # qqq should uppercasify - 'sf' => '', - 'sl' => 'i', - 'small' => '', - 'subscript' => 'sub', - 'superscript' => 'sup', - 'tt' => 'tt', -); - -# More commands taking arguments that we want to handle. -# -our %ARGUMENT_COMMANDS = ( - 'emph' => ['\textem{', '}'], # \textem doesn't exist, but we handle it - 'enquote' => ["`", "'"], - 'path' => ['\texttt{', '}'], # ugh, might not be a braced argument -); - -# Non-alphabetic \COMMANDs, other than accents and special cases. -# -our %CONTROL_SYMBOLS = ( - ' ' => ' ', # control space - "\t" => ' ', # control space - "\n" => '\x{0020}', # control space; use entity to avoid being trimmed - '!' => '', # negative thin space - # " umlaut - '#' => '#', # sharp sign - '$' => '$', # dollar sign - '%' => '%', # percent sign - '&' => '\x{0026}', # ampersand, entity to avoid html conflict - # ' acute accent - '(' => '', # start inline math - ')' => '', # end inline math - '*' => '', # discretionary multiplication - '+' => '', # tabbing: tab stop to right - ',' => '', # thin space - '-' => '', # discretionary hyphenation - # . overdot accent - '/' => '', # italic correction - # 0..9 undefined - ':' => '', # medium space - ';' => ' ', # thick space - '<' => '', # tabbing: text to left of margin - # = macron accent - '>' => '', # tabbing: next tab stop - # ? undefined - '@' => '#', # end of sentence - # A..Z control words, not symbols - '[' => '', # start display math - '\\' => ' ', # line break - ']' => '', # end display math - # ^ circumflex accent - '_' => '_', # underscore - # ` grave accent - # a..z control words, not symbols - '{' => '\x{007b}', # lbrace - '|' => '\x{2225}', # parallel - '}' => '\x{007d}', # rbrace - # ~ tilde accent -); - -# Alphabetic \COMMANDs that map to nothing. This is simply -# interpolated into %CONTROL_WORDS (next), not used directly, so we -# redundantly specify the '' on every line. -# -our %CONTROL_WORDS_EMPTY = ( - 'begingroup' => '', - 'bgroup' => '', - 'checkcomma' => '', - #'cite' => '', # keep \cite undefined since it needs manual work - 'clearpage' => '', - 'doi' => '', - 'egroup' => '', - 'endgroup' => '', - 'ensuremath' => '', - 'hbox' => '', - 'ignorespaces' => '', - 'mbox' => '', - 'medspace' => '', - 'negmedspace' => '', - 'negthickspace' => '', - 'negthinspace' => '', - 'newblock' => '', - 'newpage' => '', - 'noindent' => '', - 'nolinkurl' => '', - 'oldstylenums' => '', - 'pagebreak' => '', - 'protect' => '', - 'raggedright' => '', - 'relax' => '', - 'thinspace' => '', - 'unskip' => '', - 'urlprefix' => '', -); - -# Alphabetic commands, that expand to nothing (above) and to -# something (below). -# -our %CONTROL_WORDS = ( - %CONTROL_WORDS_EMPTY, - 'BibLaTeX' => 'BibLaTeX', - 'BibTeX' => 'BibTeX', - 'LaTeX' => 'LaTeX', - 'LuaLaTeX' => 'LuaLaTeX', - 'LuaTeX' => 'LuaTeX', - 'MF' => 'Metafont', - 'MP' => 'MetaPost', - 'Omega' => '\x{03A9}', - 'TeX' => 'TeX', - 'XeLaTeX' => 'XeLaTeX', - 'XeTeX' => 'XeTeX', - 'bullet' => '\x{2022}', - 'dag' => '\x{2020}', - 'ddag' => '\x{2021}', - 'dots' => '\x{2026}', - 'epsilon' => '\x{03F5}', - 'hookrightarrow' => '\x{2194}', - 'ldots' => '\x{2026}', - 'log' => 'log', - 'omega' => '\x{03C9}', - 'par' => "\n\n", - 'qquad' => ' ', # 2em space - 'quad' => ' ', # em space - 'textbackslash' => '\x{005C}', # entities so \ in output indicates - # untranslated TeX source - 'textbraceleft' => '\x{007B}', # entities so our bare-brace removal - 'textbraceright' => '\x{007D}', # skips them - 'textgreater' => '\x{003E}', - 'textless' => '\x{003C}', - 'textquotedbl' => '"', - 'thickspace' => ' ', - 'varepsilon' => '\x{03B5}', -); - -# Control words (not symbols) that generate various non-English -# letters and symbols. Lots more could be added. -# -our %SYMBOLS = ( # Table 3.2 in Lamport, plus more - 'AA' => '\x{00C5}', # A with ring - 'aa' => '\x{00E5}', - 'AE' => '\x{00C6}', # AE - 'ae' => '\x{00E6}', - 'DH' => '\x{00D0}', # ETH - 'dh' => '\x{00F0}', - 'DJ' => '\x{0110}', # D with stroke - 'dj' => '\x{0111}', - 'i' => '\x{0131}', # small dotless i - 'L' => '\x{0141}', # L with stroke - 'l' => '\x{0142}', - 'NG' => '\x{014A}', # ENG - 'ng' => '\x{014B}', - 'OE' => '\x{0152}', # OE - 'oe' => '\x{0153}', - 'O' => '\x{00D8}', # O with stroke - 'o' => '\x{00F8}', - 'SS' => 'SS', # lately also U+1E9E, but SS seems good enough - 'ss' => '\x{00DF}', - 'TH' => '\x{00DE}', # THORN - 'textordfeminine' => '\x{00AA}', - 'textordmasculine' => '\x{00BA}', - 'textregistered' => '\x{00AE}', - 'th' => '\x{00FE}', - 'TM' => '\x{2122}', # trade mark sign -); - -# Accent commands that are not alphabetic. -# -our %ACCENT_SYMBOLS = ( - "\"" => { # with diaresis - A => '\x{00C4}', - E => '\x{00CB}', - H => '\x{1E26}', - I => '\x{00CF}', - O => '\x{00D6}', - U => '\x{00DC}', - W => '\x{1E84}', - X => '\x{1E8c}', - Y => '\x{0178}', - "\\I" => '\x{00CF}', - "\\i" => '\x{00EF}', - a => '\x{00E4}', - e => '\x{00EB}', - h => '\x{1E27}', - i => '\x{00EF}', - o => '\x{00F6}', - t => '\x{1E97}', - u => '\x{00FC}', - w => '\x{1E85}', - x => '\x{1E8d}', - y => '\x{00FF}', - }, - "'" => { # with acute - A => '\x{00C1}', - AE => '\x{01FC}', - C => '\x{0106}', - E => '\x{00C9}', - G => '\x{01F4}', - I => '\x{00CD}', - K => '\x{1E30}', - L => '\x{0139}', - M => '\x{1E3E}', - N => '\x{0143}', - O => '\x{00D3}', - P => '\x{1E54}', - R => '\x{0154}', - S => '\x{015A}', - U => '\x{00DA}', - W => '\x{1E82}', - Y => '\x{00DD}', - Z => '\x{0179}', - "\\I" => '\x{00CD}', - "\\i" => '\x{00ED}', - a => '\x{00E1}', - ae => '\x{01FD}', - c => '\x{0107}', - e => '\x{00E9}', - g => '\x{01F5}', - i => '\x{00ED}', - k => '\x{1E31}', - l => '\x{013A}', - m => '\x{1E3f}', - n => '\x{0144}', - o => '\x{00F3}', - p => '\x{1E55}', - r => '\x{0155}', - s => '\x{015B}', - u => '\x{00FA}', - w => '\x{1E83}', - y => '\x{00FD}', - z => '\x{017A}', - }, - "^" => { # with circumflex - A => '\x{00C2}', - C => '\x{0108}', - E => '\x{00CA}', - G => '\x{011C}', - H => '\x{0124}', - I => '\x{00CE}', - J => '\x{0134}', - O => '\x{00D4}', - R => 'R\x{0302}', - S => '\x{015C}', - U => '\x{00DB}', - W => '\x{0174}', - Y => '\x{0176}', - Z => '\x{1E90}', - "\\I" => '\x{00CE}', - "\\J" => '\x{0134}', - "\\i" => '\x{00EE}', - "\\j" => '\x{0135}', - a => '\x{00E2}', - c => '\x{0109}', - e => '\x{00EA}', - g => '\x{011D}', - h => '\x{0125}', - i => '\x{00EE}', - j => '\x{0135}', - o => '\x{00F4}', - s => '\x{015D}', - u => '\x{00FB}', - w => '\x{0175}', - y => '\x{0177}', - z => '\x{1E91}', - }, - "`" => { # with grave - A => '\x{00C0}', - E => '\x{00C8}', - I => '\x{00CC}', - N => '\x{01F8}', - O => '\x{00D2}', - U => '\x{00D9}', - W => '\x{1E80}', - Y => '\x{1Ef2}', - "\\I" => '\x{00CC}', - "\\i" => '\x{00EC}', - a => '\x{00E0}', - e => '\x{00E8}', - i => '\x{00EC}', - n => '\x{01F9}', - o => '\x{00F2}', - u => '\x{00F9}', - w => '\x{1E81}', - y => '\x{1EF3}', - }, - "." => { # with dot above - A => '\x{0226}', - B => '\x{1E02}', - C => '\x{010A}', - D => '\x{1E0A}', - E => '\x{0116}', - F => '\x{1E1E}', - G => '\x{0120}', - H => '\x{1E22}', - I => '\x{0130}', - M => '\x{1E40}', - N => '\x{1E44}', - O => '\x{022E}', - P => '\x{1E56}', - R => '\x{1E58}', - S => '\x{1E60}', - T => '\x{1E6a}', - W => '\x{1E86}', - X => '\x{1E8A}', - Y => '\x{1E8E}', - Z => '\x{017B}', - "\\I" => '\x{0130}', - a => '\x{0227}', - b => '\x{1E03}', - c => '\x{010B}', - d => '\x{1E0B}', - e => '\x{0117}', - f => '\x{1e1f}', - g => '\x{0121}', - h => '\x{1E23}', - m => '\x{1E41}', - n => '\x{1E45}', - o => '\x{022F}', - p => '\x{1E57}', - r => '\x{1E59}', - s => '\x{1E61}', - t => '\x{1E6b}', - w => '\x{1E87}', - x => '\x{1E8b}', - y => '\x{1E8f}', - z => '\x{017C}', - }, - '=' => { # with macron - A => '\x{0100}', - AE => '\x{01E2}', - E => '\x{0112}', - G => '\x{1E20}', - I => '\x{012A}', - O => '\x{014C}', - U => '\x{016A}', - Y => '\x{0232}', - "\\I" => '\x{012A}', - "\\i" => '\x{012B}', - a => '\x{0101}', - ae => '\x{01E3}', - e => '\x{0113}', - g => '\x{1E21}', - i => '\x{012B}', - o => '\x{014D}', - u => '\x{016B}', - y => '\x{0233}', - }, - "~" => { # with tilde - A => '\x{00C3}', - E => '\x{1EBC}', - I => '\x{0128}', - N => '\x{00D1}', - O => '\x{00D5}', - U => '\x{0168}', - V => '\x{1E7C}', - Y => '\x{1EF8}', - "\\I" => '\x{0128}', - "\\i" => '\x{0129}', - a => '\x{00E3}', - e => '\x{1EBD}', - i => '\x{0129}', - n => '\x{00F1}', - o => '\x{00F5}', - u => '\x{0169}', - v => '\x{1E7D}', - y => '\x{1EF9}', - }, -); - -# Accent commands that are alphabetic. -# -our %ACCENT_LETTERS = ( - "H" => { # with double acute - O => '\x{0150}', - U => '\x{0170}', - o => '\x{0151}', - u => '\x{0171}', - }, - "c" => { # with cedilla - C => '\x{00C7}', - D => '\x{1E10}', - E => '\x{0228}', - G => '\x{0122}', - H => '\x{1E28}', - K => '\x{0136}', - L => '\x{013B}', - N => '\x{0145}', - R => '\x{0156}', - S => '\x{015E}', - T => '\x{0162}', - c => '\x{00E7}', - d => '\x{1E11}', - e => '\x{0229}', - g => '\x{0123}', - h => '\x{1E29}', - k => '\x{0137}', - l => '\x{013C}', - n => '\x{0146}', - r => '\x{0157}', - s => '\x{015F}', - t => '\x{0163}', - }, - "d" => { # with dot below - A => '\x{1EA0}', - B => '\x{1E04}', - D => '\x{1E0C}', - E => '\x{1EB8}', - H => '\x{1E24}', - I => '\x{1ECA}', - K => '\x{1E32}', - L => '\x{1E36}', - M => '\x{1E42}', - N => '\x{1E46}', - O => '\x{1ECC}', - R => '\x{1E5A}', - S => '\x{1E62}', - T => '\x{1E6C}', - U => '\x{1EE4}', - V => '\x{1E7E}', - W => '\x{1E88}', - Y => '\x{1Ef4}', - Z => '\x{1E92}', - "\\I" => '\x{1ECA}', - "\\i" => '\x{1ECB}', - a => '\x{1EA1}', - b => '\x{1E05}', - d => '\x{1E0D}', - e => '\x{1EB9}', - h => '\x{1E25}', - i => '\x{1ECB}', - k => '\x{1E33}', - l => '\x{1E37}', - m => '\x{1E43}', - n => '\x{1E47}', - o => '\x{1ECD}', - r => '\x{1E5b}', - s => '\x{1E63}', - t => '\x{1E6D}', - u => '\x{1EE5}', - v => '\x{1E7F}', - w => '\x{1E89}', - y => '\x{1EF5}', - z => '\x{1E93}', - }, - "h" => { # with hook above - A => '\x{1EA2}', - E => '\x{1EBA}', - I => '\x{1EC8}', - O => '\x{1ECe}', - U => '\x{1EE6}', - Y => '\x{1EF6}', - "\\I" => '\x{1EC8}', - "\\i" => '\x{1EC9}', - a => '\x{1EA3}', - e => '\x{1EBB}', - i => '\x{1EC9}', - o => '\x{1ECF}', - u => '\x{1EE7}', - y => '\x{1EF7}', - }, - "k" => { # with ogonek - A => '\x{0104}', - E => '\x{0118}', - I => '\x{012E}', - O => '\x{01EA}', - U => '\x{0172}', - "\\I" => '\x{012E}', - "\\i" => '\x{012F}', - a => '\x{0105}', - e => '\x{0119}', - i => '\x{012F}', - o => '\x{01EB}', - u => '\x{0173}', - }, - "r" => { # with ring above - A => '\x{00C5}', - U => '\x{016E}', - a => '\x{00E5}', - u => '\x{016F}', - w => '\x{1E98}', - y => '\x{1E99}', - }, - "u" => { # with breve - A => '\x{0102}', - E => '\x{0114}', - G => '\x{011E}', - I => '\x{012C}', - O => '\x{014E}', - U => '\x{016C}', - "\\I" => '\x{012C}', - "\\i" => '\x{012D}', - a => '\x{0103}', - e => '\x{0115}', - g => '\x{011F}', - i => '\x{012D}', - o => '\x{014F}', - u => '\x{016D}', - }, - "v" => { # with caron - A => '\x{01CD}', - C => '\x{010C}', - D => '\x{010E}', - DZ => '\x{01C4}', - E => '\x{011A}', - G => '\x{01E6}', - H => '\x{021E}', - I => '\x{01CF}', - K => '\x{01E8}', - L => '\x{013D}', - N => '\x{0147}', - O => '\x{01D1}', - R => '\x{0158}', - S => '\x{0160}', - T => '\x{0164}', - U => '\x{01D3}', - Z => '\x{017D}', - "\\I" => '\x{01CF}', - "\\i" => '\x{01D0}', - "\\j" => '\x{01F0}', - a => '\x{01CE}', - c => '\x{010D}', - d => '\x{010F}', - dz => '\x{01C6}', - e => '\x{011B}', - g => '\x{01E7}', - h => '\x{021F}', - i => '\x{01D0}', - j => '\x{01F0}', - k => '\x{01E9}', - l => '\x{013E}', - n => '\x{0148}', - o => '\x{01D2}', - r => '\x{0159}', - s => '\x{0161}', - t => '\x{0165}', - u => '\x{01D4}', - z => '\x{017E}', - }, -); - -# -our %GERMAN = ( # for package `german'/`ngerman' - '"a' => 'ä', - '"A' => 'Ä', - '"e' => 'ë', - '"E' => 'Ë', - '"i' => 'ï', - '"I' => 'Ï', - '"o' => 'ö', - '"O' => 'Ö', - '"u' => 'ü', - '"U' => 'Ü', - '"s' => 'ß', - '"S' => 'SS', - '"z' => 'ß', - '"Z' => 'SZ', - '"ck' => 'ck', # old spelling: ck -> k-k - '"ff' => 'ff', # old spelling: ff -> ff-f - '"`' => '„', - "\"'" => '“', - '"<' => '«', - '">' => '»', - '"-' => '\x{00AD}', # soft hyphen - '""' => '\x{200B}', # zero width space - '"~' => '\x{2011}', # non-breaking hyphen - '"=' => '-', - '\glq' => '‚', # left german single quote - '\grq' => '‘', # right german single quote - '\flqq' => '«', - '\frqq' => '»', - '\dq' => '"', -); - -1; - -__END__ -=pod - -=encoding UTF-8 - -=head1 NAME - -LaTeX::ToUnicode::Tables - Character tables for LaTeX::ToUnicode - -=head1 VERSION - -version 0.54 - -=head1 CONSTANTS - -=head2 @LIGATURES - -Standard TeX character sequences (not \commands) which need to be -replaced: C<---> with U+2014 (em dash), etc. Includes: em dash, en -dash, inverted exclamation, inverted question, left double quote, right -double quote, left single quote, right single quote. They are replaced -in that order. - -=head2 %MARKUPS - -Hash where keys are the names of formatting commands like C<\tt>, -without the backslash, namely: C<bf cal em it rm sc sf sl small tt>. Values -are the obvious HTML equivalent where one exists, given as the tag name -without the angle brackets: C<b em i tt>. Otherwise the value is the empty -string. - -=head2 %ARGUMENT_COMMANDS - -Hash where keys are the names of TeX commands taking arguments that we -handle, without the backslash, such as C<enquote>. Each value is a -reference to a list of two strings, the first being the text to insert -before the argument, the second being the text to insert after. For -example, for C<enquote> the value is C<["`", "'"]>. The inserted text is -subject to further replacements. - -Only three such commands are currently handled: C<\emph>, C<\enquote>, -and C<\path>. - -=head2 %CONTROL_SYMBOLS - -A hash where the keys are non-alphabetic C<\command>s (without the -backslash), other than accents and special cases. These don't take -arguments. Although some of these have Unicode equivalents, such as the -C<\,> thin space, it seems better to keep the output as simple as -possible; small spacing tweaks in TeX aren't usually desirable in plain -text or HTML. - -The values are single-quoted strings C<'\x{...}'>, not double-quoted -literal characters <"\x{...}">, to ease future parsing of the -TeX/text/HTML. - -This hash is necessary because TeX's parsing rules for control symbols -are different from control words: no space or other token is needed to -terminate control symbols. - -=head2 %CONTROL_WORDS - -Keys are names of argument-less commands, such as C<\LaTeX> (without the -backslash). Values are the replacements, often the empty string. - -=head2 %SYMBOLS - -Keys are the commands for extended characters, such as C<\AA> (without -the backslash.) - -=head2 %ACCENT_SYMBOLS - -Two-level hash of accented characters like C<\'{a}>. The keys of this -hash are the accent symbols (without the backslash), such as C<`> and -C<'>. The corresponding values are hash references where the keys are -the base letters and the values are single-quoted C<'\x{....}'> strings. - -=head2 %ACCENT_LETTERS - -Same as %ACCENT_SYMBOLS, except the keys are accents that are -alphabetic, such as C<\c> (without the backslash as always). - -As with control sequences, it's necessary to distinguish symbols and -alphabetic commands because of the different parsing rules. - -=head2 %GERMAN - -Character sequences (not necessarily commands) as defined by the package -`german'/`ngerman', e.g. C<"a> (a with umlaut), C<"s> (german sharp s) -or C<"`"> (german left quote). Note the missing backslash. - -The keys of this hash are the literal character sequences. - -=head1 AUTHOR - -Gerhard Gossen <gerhard.gossen@googlemail.com>, -Boris Veytsman <boris@varphi.com>, -Karl Berry <karl@freefriends.org> - -L<https://github.com/borisveytsman/bibtexperllibs> - -=head1 COPYRIGHT AND LICENSE - -Copyright 2010-2023 Gerhard Gossen, Boris Veytsman, Karl Berry - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl5 programming language system itself. - -=cut diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.1 b/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.1 deleted file mode 100644 index 8dc8e71426..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.1 +++ /dev/null @@ -1,73 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH LTX2UNITXT "1" "November 2023" "ltx2unitxt " "User Commands" -.SH NAME -ltx2unitxt \- convert LaTeX source fragment to plain (Unicode) text or simple html -.SH SYNOPSIS -.B ltx2unitxt -[\fI\,-c CONFIG\/\fR] [\fI\,-o OUTPUT\/\fR] [\fI\,--html\/\fR] [...] [\fI\,INFILE\/\fR]... -.SH DESCRIPTION -Convert the LaTeX source in INFILE (or standard input) to plain text -using Unicode code points for accents and other special characters; or, -optionally, output HTML with simple translations for font changes and url -commands. -.PP -Common accent sequences, special characters, and simple markup commands -are translated, but there is no attempt at completeness. Math, tables, -figures, sectioning, etc., are not handled in any way, and mostly left -in their TeX form in the output. The translations assume standard LaTeX -meanings for characters and control sequences; macros in the input are -not considered. -.PP -The input can be a fragment of text, not a full document, as the purpose -of this script was to handle bibliography entries and abstracts (for the -ltx2crossrefxml script that is part of the crossrefware package). -Patches to extend this script are welcome. It uses the LaTeX::ToUnicode -Perl library for the conversion; see its documentation for details. -.PP -Conversion is currently done line by line, so TeX constructs that cross -multiple lines are not handled properly. If it turns out to be useful, -conversion could be done by paragraph instead. -.PP -The config file is read as a Perl source file. It can define a function -`LaTeX_ToUnicode_convert_hook()' which will be called early; the value -it returns (which must be a string) will then be subject to the standard -conversion. -.PP -For an example of using this script and associated code, see the TUGboat -processing at -https://github.com/TeXUsersGroup/tugboat/tree/trunk/capsules/crossref. -.SH OPTIONS -.TP -\fB\-c\fR, \fB\-\-config\fR=\fI\,FILE\/\fR -read (Perl) config FILE for a hook, as explained above -.TP -\fB\-e\fR, \fB\-\-entities\fR -output entities &#xNNNN; instead of literal characters -.TP -\fB\-g\fR, \fB\-\-german\fR -handle some features of the german package -.TP -\fB\-h\fR, \fB\-\-html\fR -output simplistic HTML instead of plain text -.TP -\fB\-o\fR, \fB\-\-output\fR=\fI\,FILE\/\fR -output to FILE instead of stdout -.TP -\fB\-v\fR, \fB\-\-verbose\fR -be verbose -.TP -\fB\-V\fR, \fB\-\-version\fR -output version information and exit -.TP -\-?, \fB\-\-help\fR -display this help and exit -.PP -Options can be abbreviated unambiguously, and start with either \- or \fB\-\-\fR. -.PP -Dev sources, bug tracker: https://github.com/borisveytsman/bibtexperllibs -Releases: https://ctan.org/pkg/bibtexperllibs -.PP -ltx2unitxt (bibtexperllibs) 0.51 -Copyright 2023 Karl Berry. -This is free software: you can redistribute it and/or -modify it under the same terms as Perl itself. diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.pdf b/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.pdf Binary files differdeleted file mode 100644 index 7dfae7f396..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/ltx2unitxt.pdf +++ /dev/null diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/script/convert.pl b/support/bibtexperllibs/LaTeX-ToUnicode/script/convert.pl deleted file mode 100644 index 70cc0bda84..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/script/convert.pl +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use utf8; - -use feature 'say'; -use FindBin; - -my $UNICODE_DATA_URL = "http://www.unicode.org/Public/UNIDATA/UnicodeData.txt"; - - -my $stream; -if ( -f "$FindBin::Bin/UnicodeData.txt" ) { - open $stream, "<", "$FindBin::Bin/UnicodeData.txt" or die; -} else { - open $stream, "-|", "curl $UNICODE_DATA_URL" or die; -} -my %data; - -my %chars = ( - 'ACUTE' => "'", - 'ACUTE AND DOT ABOVE' => '', - 'BAR' => '', - 'BELT' => '', - 'BREVE' => 'u', - 'BREVE AND ACUTE' => '', - 'BREVE AND DOT BELOW' => '', - 'BREVE AND GRAVE' => '', - 'BREVE AND HOOK ABOVE' => '', - 'BREVE AND TILDE' => '', - 'BREVE BELOW' => '', - 'CARON' => 'v', - 'CARON AND DOT ABOVE' => '', - 'CEDILLA' => 'c', - 'CEDILLA AND ACUTE' => '', - 'CEDILLA AND BREVE' => '', - 'CIRCUMFLEX' => '^', - 'CIRCUMFLEX AND ACUTE' => '', - 'CIRCUMFLEX AND DOT BELOW' => '', - 'CIRCUMFLEX AND GRAVE' => '', - 'CIRCUMFLEX AND HOOK ABOVE' => '', - 'CIRCUMFLEX AND TILDE' => '', - 'CIRCUMFLEX BELOW' => '', - 'COMMA' => '', - 'COMMA BELOW' => '', - 'CROSSED-TAIL' => '', - 'CURL' => '', - 'DESCENDER' => '', - 'DIAERESIS' => '"', - 'DIAERESIS AND ACUTE' => '', - 'DIAERESIS AND CARON' => '', - 'DIAERESIS AND GRAVE' => '', - 'DIAERESIS AND MACRON' => '', - 'DIAERESIS BELOW' => '', - 'DIAGONAL STROKE' => '', - 'DOT ABOVE' => '.', - 'DOT ABOVE AND MACRON' => '', - 'DOT BELOW' => 'd', - 'DOT BELOW AND DOT ABOVE' => '', - 'DOT BELOW AND MACRON' => '', - 'DOUBLE ACUTE' => 'H', - 'DOUBLE BAR' => '', - 'DOUBLE GRAVE' => '', - 'FISHHOOK' => '', - 'FISHHOOK AND MIDDLE TILDE' => '', - 'FLOURISH' => '', - 'GRAVE' => '`', - 'HIGH STROKE' => '', - 'HOOK' => '', - 'HOOK ABOVE' => 'h', - 'HOOK AND TAIL' => '', - 'HOOK TAIL' => '', - 'HORIZONTAL BAR' => '', - 'HORN' => '', - 'HORN AND ACUTE' => '', - 'HORN AND DOT BELOW' => '', - 'HORN AND GRAVE' => '', - 'HORN AND HOOK ABOVE' => '', - 'HORN AND TILDE' => '', - 'INVERTED BREVE' => '', - 'LEFT HOOK' => '', - 'LINE BELOW' => '', - 'LONG LEG' => '', - 'LONG RIGHT LEG' => '', - 'LONG STROKE OVERLAY' => '', - 'LOOP' => '', - 'LOW RING INSIDE' => '', - 'MACRON' => '=', - 'MACRON AND ACUTE' => '', - 'MACRON AND DIAERESIS' => '', - 'MACRON AND GRAVE' => '', - 'MIDDLE DOT' => '', - 'MIDDLE TILDE' => '', - 'NOTCH' => '', - 'OGONEK' => 'k', - 'OGONEK AND MACRON' => '', - 'PALATAL HOOK' => '', - 'RETROFLEX HOOK' => '', - 'RIGHT HALF RING' => '', - 'RIGHT HOOK' => '', - 'RING ABOVE' => 'r', - 'RING ABOVE AND ACUTE' => '', - 'RING BELOW' => '', - 'SMALL LETTER J' => '', - 'SMALL LETTER Z' => '', - 'SMALL LETTER Z WITH CARON' => '', - 'SQUIRREL TAIL' => '', - 'STRIKETHROUGH' => '', - 'STROKE' => '', - 'STROKE AND ACUTE' => '', - 'STROKE AND DIAGONAL STROKE' => '', - 'STROKE THROUGH DESCENDER' => '', - 'SWASH TAIL' => '', - 'TAIL' => '', - 'TILDE' => '~', - 'TILDE AND ACUTE' => '', - 'TILDE AND DIAERESIS' => '', - 'TILDE AND MACRON' => '', - 'TILDE BELOW' => '', - 'TOPBAR' => '', -); - -my %missing; - -while(<$stream>) { - chomp; - my @F = split /;/; - my $hex = $F[0]; - if ( $F[1] =~ /LATIN (SMALL|CAPITAL) LETTER ((?:\w+ )*\w{1,2}) WITH (.+)$/ ) { - my $case = $1; - my $letter = $2; - my $accent = $3; - - if ( $case eq 'SMALL' ) { - $letter = lc $letter; - } - if ( $chars{$accent} && $letter !~ / / ) { - my $char = chr( eval "0x$hex" ); - $data{ $chars{$accent} }->{ $letter } = $char; - if ( lc( $letter ) eq 'i' ) { - my $additional_letter = "\\$letter"; - $data{ $chars{$accent} }->{ $additional_letter } = $char; - } - } else { - push @{ $missing{$accent} }, $letter; - } - } -} - -use Data::Dumper::Concise; - -binmode(STDOUT, ":utf8"); - -say Dumper( \%data ); -#say Dumper( \%missing ); diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/script/ltx2unitxt b/support/bibtexperllibs/LaTeX-ToUnicode/script/ltx2unitxt deleted file mode 100755 index 661ea40417..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/script/ltx2unitxt +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env perl -# Use the LaTeX::ToUnicode module (also in the bibtexperllibs -# repository/package, like this script) to convert LaTeX to Unicode. -# -# We work on fragments of text, not whole documents, the goal being to -# replace LaTeX commands and syntax with obvious plain text equivalents, -# or remove them. - -use strict; -use warnings; - -use Cwd; -use File::Basename; -use File::Spec; - -BEGIN { - # find files relative to our installed location within TeX Live - chomp(my $TLMaster = `kpsewhich -var-value=SELFAUTOPARENT`); # TL root - if (length($TLMaster)) { - unshift @INC, "$TLMaster/texmf-dist/scripts/bibtexperllibs"; - } - # find development bibtexperllibs in sibling checkout to this script, - # even if $0 is a symlink. Irrelevant when using from an installation. - my $real0 = Cwd::abs_path($0); - my $scriptdir = File::Basename::dirname($real0); - my $dev_btxperllibs = Cwd::abs_path("$scriptdir/../.."); - - # we need the lib/ subdirectories inside ... - unshift (@INC, glob ("$dev_btxperllibs/*/lib")) if -d $dev_btxperllibs; - -} - -use LaTeX::ToUnicode; - -our %opts; -local *OUT; # output filehandle - -exit(main()); - -sub main { - init(); - - # by paragraph? - while (<>) { - print OUT (convert($_)); - } - - return 0; -} - -sub convert { - my ($in) = @_; - - my @args = (); # what we'll pass to the convert() fn. - # - if (defined(&{"LaTeX_ToUnicode_convert_hook"})) { - push (@args, "hook" => \&LaTeX_ToUnicode_convert_hook); } - if ($opts{e}) { push (@args, "entities" => 1); } - if ($opts{g}) { push (@args, "german" => 1); } - if ($opts{h}) { push (@args, "html" => 1); } - - LaTeX::ToUnicode::debuglevel($opts{v}); - my $out = LaTeX::ToUnicode::convert($in, @args); - - #warn "out=$out"; - return $out; -} - - -# Command line options, etc. -# -sub init { - my $USAGE = <<END; -Usage: $0 [-c CONFIG] [-o OUTPUT] [--html] [...] [INFILE]... - -Convert the LaTeX source in INFILE (or standard input) to plain text -using Unicode code points for accents and other special characters; or, -optionally, output HTML with simple translations for font changes and url -commands. - -Common accent sequences, special characters, and simple markup commands -are translated, but there is no attempt at completeness. Math, tables, -figures, sectioning, etc., are not handled in any way, and mostly left -in their TeX form in the output. The translations assume standard LaTeX -meanings for characters and control sequences; macros in the input are -not considered. - -The input can be a fragment of text, not a full document, as the purpose -of this script was to handle bibliography entries and abstracts (for the -ltx2crossrefxml script that is part of the crossrefware package). -Patches to extend this script are welcome. It uses the LaTeX::ToUnicode -Perl library for the conversion; see its documentation for details. - -Conversion is currently done line by line, so TeX constructs that cross -multiple lines are not handled properly. If it turns out to be useful, -conversion could be done by paragraph instead. - -The config file is read as a Perl source file. It can define a function -`LaTeX_ToUnicode_convert_hook()' which will be called early; the value -it returns (which must be a string) will then be subject to the standard -conversion. - -For an example of using this script and associated code, see the TUGboat -processing at -https://github.com/TeXUsersGroup/tugboat/tree/trunk/capsules/crossref. - -Options: - -c, --config=FILE read (Perl) config FILE for a hook, as explained above - -e, --entities output entities &#xNNNN; instead of literal characters - -g, --german handle some features of the german package - -h, --html output simplistic HTML instead of plain text - -o, --output=FILE output to FILE instead of stdout - -v, --verbose be verbose - -V, --version output version information and exit - -?, --help display this help and exit - -Options can be abbreviated unambiguously, and start with either - or --. - -Dev sources, bug tracker: https://github.com/borisveytsman/bibtexperllibs -Releases: https://ctan.org/pkg/bibtexperllibs -END - - my $VERSION = <<END; -ltx2unitxt (bibtexperllibs) 0.51 -Copyright 2023 Karl Berry. -This is free software: you can redistribute it and/or -modify it under the same terms as Perl itself. -END - - use Getopt::Long qw(:config no_ignore_case); # otherwise v|V is the same - - GetOptions( - "config|c=s" => \($opts{c}), - "entities|e" => \($opts{e}), - "german|g" => \($opts{g}), - "html|h" => \($opts{h}), - "output|o=s" => \($opts{o}), - "verbose|v" => \($opts{v}), - "version|V" => \($opts{V}), - "help|?" => \($opts{help})) - || die "Try $0 --help for more information.\n"; - - if ($opts{help}) { print "$USAGE\n$VERSION"; exit 0; } - if ($opts{V}) { print $VERSION; exit 0; } - - binmode(STDOUT, ":utf8"); - *OUT = *STDOUT; - - if (defined($opts{o})) { - open(OUT, ">$opts{o}") || die "open(>$opts{o}) failed: $!\n"; - binmode(OUT, ":utf8") - } - - if ($opts{c}) { - if (-r $opts{c}) { - # if config arg is absolute, fine; if not, prepend "./" as slightly - # less troublesome than putting "." in the @INC path. - my $rel = (File::Spec->file_name_is_absolute($opts{c}) ? "" : "./"); - my $cnffile = "$rel$opts{c}"; - verbose("requiring config file: $cnffile"); - require $cnffile; - } else { - die "open config file ($opts{c}) for reading failed: $!\n"; - } - } -} - - -sub verbose { print @_ if $::opts{v}; } diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/t/convert.t b/support/bibtexperllibs/LaTeX-ToUnicode/t/convert.t deleted file mode 100644 index 9bd7a4f3d4..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/t/convert.t +++ /dev/null @@ -1,136 +0,0 @@ -use strict; -use warnings; - -use Test::More; -use utf8; - -BEGIN{ use_ok( 'LaTeX::ToUnicode', qw( convert ) ); } - -binmode( STDOUT, ':utf8' ); -my @tests = ( - [ '\LaTeX' => 'LaTeX' ], - [ '\$ \% \& \_ \{ \} \#' => '$ % & _ { } #' ], - [ '{\"{a}}' => 'ä' ], - [ '{\"a}' => 'ä' ], - [ '{\`{a}}' => 'à' ], - [ '{\`a}' => 'à' ], - [ '\ae' => 'æ' ], - [ '\L' => 'Ł' ], - [ "{\\'e}" => 'é'], - ['\={a}' => 'ā'], - ['{\=a}' => 'ā'], -); - -foreach my $test ( @tests ) { - is( convert( $test->[0] ), $test->[1], "Convert $test->[0]" ); -} - -my @german_tests = ( - [ '"a' => 'ä' ], - ['"`' => '„' ], - ["\"'" => '“' ], -); - -foreach my $test ( @german_tests ) { - is( convert( $test->[0], german => 1 ), $test->[1], "Convert $test->[0], german => 1" ); -} - -binmode( DATA, ':utf8' ); -while (<DATA>) { - chomp; - my ( $tex, $result ) = split /\t/; - is( convert( $tex ), $result, "Convert $tex" ); -} -close DATA; - -done_testing; - -__DATA__ -\& & -{\`a} à -{\^a} â -{\~a} ã -{\'a} á -{\'{a}} á -{\"a} ä -{\`A} À -{\'A} Á -{\"A} Ä -{\aa} å -{\AA} Å -{\ae} æ -{\bf 12} 12 -{\'c} ć -{\cal P} P -{\c{c}} ç -{\c{C}} Ç -{\c{e}} ȩ -{\c{s}} ş -{\c{S}} Ş -{\c{t}} ţ -{\-d} d -{\`e} è -{\^e} ê -{\'e} é -{\"e} ë -{\'E} É -{\em bits} bits -{\H{o}} ő -{\`i} ì -{\^i} î -{\i} ı -{\`i} ì -{\'i} í -{\"i} ï -{\`\i} ì -{\'\i} í -{\"\i} ï -{\`{\i}} ì -{\'{\i}} í -{\"{\i}} ï -{\it Note} Note -{\k{e}} ę -{\l} ł -{\-l} l -{\log} log -{\~n} ñ -{\'n} ń -{\^o} ô -{\o} ø -{\'o} ó -{\"o} ö -{\"{o}} ö -{\'O} Ó -{\"O} Ö -{\"{O}} Ö -{\rm always} always -{\-s} s -{\'s} ś -{\sc JoiN} JoiN -{\sl bit\/ \bf 7} bit 7 -{\sl L'Informatique Nouvelle} L’Informatique Nouvelle -{\small and} and -{\ss} ß -{\TeX} TeX -{\TM} ™ -{\tt awk} awk -{\^u} û -{\'u} ú -{\"u} ü -{\"{u}} ü -{\'U} Ú -{\"U} Ü -{\u{a}} ă -{\u{g}} ğ -{\v{c}} č -{\v{C}} Č -{\v{e}} ě -{\v{n}} ň -{\v{r}} ř -{\v{s}} š -{\v{S}} Š -{\v{z}} ž -{\v{Z}} Ž -{\'y} ý -{\.{z}} ż -Herv{\`e} Br{\"o}nnimann Hervè Brönnimann diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-coverage.t b/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-coverage.t deleted file mode 100644 index 3a818499f0..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-coverage.t +++ /dev/null @@ -1,21 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -use Test::More; - -eval "use Test::Pod::Coverage 1.08"; -plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" - if $@; - -eval "use Pod::Coverage::TrustPod"; -plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" - if $@; - -all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-syntax.t b/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-syntax.t deleted file mode 100644 index d46a955694..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-pod-syntax.t +++ /dev/null @@ -1,15 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - -use Test::More; - -eval "use Test::Pod 1.41"; -plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; - -all_pod_files_ok(); diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-synopsis.t b/support/bibtexperllibs/LaTeX-ToUnicode/t/release-synopsis.t deleted file mode 100644 index 7a83682539..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/t/release-synopsis.t +++ /dev/null @@ -1,16 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -use Test::More; - -eval "use Test::Synopsis"; -plan skip_all => "Test::Synopsis required for testing synopses" - if $@; -all_synopsis_ok('lib'); diff --git a/support/bibtexperllibs/LaTeX-ToUnicode/weaver.ini b/support/bibtexperllibs/LaTeX-ToUnicode/weaver.ini deleted file mode 100644 index 1cc341ff23..0000000000 --- a/support/bibtexperllibs/LaTeX-ToUnicode/weaver.ini +++ /dev/null @@ -1,24 +0,0 @@ -[-Encoding] -[@CorePrep] - -[Name] -[Version] - -[Region / prelude] - -[Generic / SYNOPSIS] -[Generic / DESCRIPTION] -[Generic / OVERVIEW] - -[Collect / ATTRIBUTES] -command = attr - -[Collect / METHODS] -command = method - -[Leftovers] - -[Region / postlude] - -[Authors] -[Legal] diff --git a/support/bibtexperllibs/Makefile b/support/bibtexperllibs/Makefile deleted file mode 100644 index d1b0bdc84d..0000000000 --- a/support/bibtexperllibs/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# This is Makefile for TDS-compliant TeX distributions -# Written by Boris Veytsman, boris@varphi.com -# -# This file is in public domain -# - -PACKAGE = bibtexperllibs - -DIRS = BibTeX-Parser LaTeX-ToUnicode - -all: - -clean: - for dir in ${DIRS}; do (cd $$dir && ${MAKE} -f Makefile.TDS clean); done - - -distclean: clean - for dir in ${DIRS}; do (cd $$dir && ${MAKE} -f Makefile.TDS distclean); done - -install: - for dir in ${DIRS}; do (cd $$dir && ${MAKE} -f Makefile.TDS install); done - -archive: - for dir in ${DIRS}; do (cd $$dir && ${MAKE} -f Makefile.TDS docs); done - for dir in ${DIRS}; do (cd $$dir && ${MAKE} -f Makefile.TDS clean); done - COPYFILE_DISABLE=1 tar -czvf ../$(PACKAGE).tgz -C .. --exclude '*~' --exclude '*.tgz' --exclude CVS --exclude .git --exclude .gitignore --exclude blib --exclude "*.tar.gz" --exclude pm_to_blib $(PACKAGE) diff --git a/support/bibtexperllibs/README b/support/bibtexperllibs/README deleted file mode 100644 index fef3d0b276..0000000000 --- a/support/bibtexperllibs/README +++ /dev/null @@ -1,49 +0,0 @@ - BibTeX Perl Libs - Version 1.9 - Gerhard Gossen, Boris Veytsman, Karl Berry - -This package provides BibTeX-related Perl libraries by Gerhard Gossen, -maintained and repackaged by Boris Veytsman for TeX Live and other -TDS-compliant distributions. The libraries are written in pure Perl, -so shoud work out of the box on any architecture. - -To use them in your scripts, add to the @INC variable the directory -scripts/bibtexperllibs inside your TeX distribution. A script ltx2unitxt -packages the conversion libraries for use from the command line. - -Bug reports, source code: https://github.com/borisveytsman/bibtexperllibs -Releases: https://ctan.org/pkg/bibtexperllibs - -For an example of using the LaTeX::ToUnicode module, see the -crossrefware package (which is also the reason for continued development). - -Changes: - - version 1.9 2023-11-18 Now braces are rendered correctly by - LaTeX-ToUnicode - - version 1.8 2023-08-20 Tests updates, timestamp updates. - - version 1.7 2021-01-20 LaTeX::ToUnicode 0.51 for still more - ltx2crossrefxml support, including simple html output. - (No changes to BibTeX::Parser.) - - version 1.6 2020-12-10 LaTeX::ToUnicode 0.11 for more ltx2crossrefxml - support. (No changes to BibTeX::Parser.) - - version 1.5 Upgraded BibTeX::Parser to 1.02 (bugfixes) - - version 1.4 Upgraded BibTeX::Parser to 1.01 - - version 1.3 Upgraded BibTeX::Parser to 1.00 - - version 1.2 Upgraded BibTeX::Parser to v0.70 and LaTeX::ToUnicode to 0.05 - - version 1.1 Upgraded BibTeX::Parser to v0.69 - - version 1.0 Upgraded BibTeX::Parser to v0.68 and LaTeX::ToUnicode to 0.04 - - version 0.2 New upstream version for BibTeX::Parser (0.66) - -This is free software; you can redistribute it and/or modify it under -the same terms as the Perl 5 programming language system itself. diff --git a/support/digestif/INSTALL.md b/support/digestif/INSTALL.md index f99f4b286a..ff4ac037e0 100644 --- a/support/digestif/INSTALL.md +++ b/support/digestif/INSTALL.md @@ -59,12 +59,12 @@ Packaging for a TeX distribution -------------------------------- For an installation depending only on the `texlua` interpreter from -LuaTeX (which already includes all other dependencies except cjson), +LuaTeX (which bundles all dependencies except the optional cjson), create a zip file containing `digestif/*.lua` and `data/*.tags` (no subdirectories), place it anywhere kpathsearch will find it and use the `bin/digestif.texlua` executable script. For instance: - zip -j digestif.zip digestif/*.lua tags/*.tags + zip -j digestif.zip digestif/*.lua data/*.tags install -Dt $TEXMF/scripts digestif.zip install bin/digestif.texlua $PREFIX/bin/digestif diff --git a/support/digestif/LICENSE.md b/support/digestif/LICENSE.md index 55165a272d..2b19eb74af 100644 --- a/support/digestif/LICENSE.md +++ b/support/digestif/LICENSE.md @@ -119,6 +119,20 @@ latex.tags: Adapted from the LaTeX2e Unofficial Reference Manual, which can be found at https://latexref.xyz/. +natbib.sty.tags: + + Copyright 1993-2010 Patrick W Daly + + This file may be distributed and/or modified under the conditions of the + LaTeX Project Public License, either version 1.3 of this license or (at + your option) any later version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + and version 1.3 or later is part of all distributions of LaTeX version + 2005/12/01 or later. + + Adapted from the natbib package documentation, which can be found at + https://ctan.org/pkg/natbib + pgf.tags: Copyright 2007-2013 Till Tantau diff --git a/support/digestif/README.md b/support/digestif/README.md index a7528020ec..25b4fe4920 100644 --- a/support/digestif/README.md +++ b/support/digestif/README.md @@ -2,7 +2,7 @@ Digestif ======== <p align="center"> -<a href="https://app.travis-ci.com/astoff/digestif"><img src="https://app.travis-ci.com/astoff/digestif.svg?branch=main" alt="Build Status"></a> +<a href="https://github.com/astoff/digestif/actions/workflows/test.yml"><img src="https://github.com/astoff/digestif/actions/workflows/test.yml/badge.svg"></a> <a href="https://ctan.org/pkg/digestif"><img alt="CTAN" src="https://img.shields.io/ctan/v/digestif?color=blue"></a> <a href="https://luarocks.org/modules/astoff/digestif"><img alt="LuaRocks" src="https://img.shields.io/luarocks/v/astoff/digestif?color=blue"></a> </p> @@ -12,18 +12,20 @@ ConTeXt et caterva. It provides context-sensitive completion, documentation, code navigation, and related functionality to any text editor that speaks the LSP protocol. -<p align="center"><img src="https://raw.githubusercontent.com/astoff/digestif/images/screenshot.gif" alt="Madatory GIF"></p> - Features -------- - Completion for commands, environments, key-value options (for instance, TikZ options), cross-references and citations. + <p align="center"><img src="https://raw.githubusercontent.com/astoff/digestif/images/completion.png"></p> + - Popup help messages, including command signature and documentation. For the best results, make sure you have the [LaTeX reference manual][latexref] installed as an [info node][info-issues]. + <p align="center"><img src="https://raw.githubusercontent.com/astoff/digestif/images/help.png"></p> + - Find definition and references to labels and citations. - Document outline. @@ -37,12 +39,16 @@ Features - Digestif is fuzzy! For citations, it tries an exact match against the BibTeX identifier and a fuzzy match against author and title. - In the GIF above, the user types `groalhom`, which matches + In the picture below, the user typed `groalhom`, which matches **Gro**thendieck's “Sur quelques points d'**al**gébre **hom**ologique”; selecting this inserts the BibTeX identifier - `Tohoku`. Similarly, for cross-references, Digestif tries an exact - match against the label and a fuzzy match against the text around - the label. + `Tohoku`. + + <p align="center"><img src="https://raw.githubusercontent.com/astoff/digestif/images/cite.png"></p> + + Similarly, for cross-references, Digestif tries an exact match + against the label and a fuzzy match against the text around the + label. - Support for LaTeX, ConTeXt, plain TeX, DocTeX (`.dtx` files) and Texinfo. @@ -112,6 +118,10 @@ To ensure that Digestif is used, add the following to your init file: See instructions [here](https://github.com/neoclide/coc.nvim/wiki/Language-servers#latex). +### Sublime Text with the [LSP](https://packagecontrol.io/packages/LSP) package + +See instructions [here](https://lsp.sublimetext.io/language_servers/#digestif). + ### Other editors It shouldn't be hard to set up other editors to use Digestif. Please diff --git a/support/digestif/bin/digestif b/support/digestif/bin/digestif index 818d5b355a..73b51457b4 100755 --- a/support/digestif/bin/digestif +++ b/support/digestif/bin/digestif @@ -1,2 +1,5 @@ #!/usr/bin/env lua +-- Remove relative directories from package path +package.path = package.path:gsub("%f[^\0;]%.[^;]*", ""):gsub(";+", ";"):gsub("^;", ""):gsub(";$", "") +package.cpath = package.cpath:gsub("%f[^\0;]%.[^;]*", ""):gsub(";+", ";"):gsub("^;", ""):gsub(";$", "") require "digestif.langserver".main(arg) diff --git a/support/digestif/bin/digestif.texlua b/support/digestif/bin/digestif.texlua index 5f22a17e12..f0f6c9e84f 100755 --- a/support/digestif/bin/digestif.texlua +++ b/support/digestif/bin/digestif.texlua @@ -1,4 +1,7 @@ #!/usr/bin/env texlua +-- Remove relative directories from package path +package.path = package.path:gsub("%f[^\0;]%.[^;]*", ""):gsub(";+", ";"):gsub("^;", ""):gsub(";$", "") +package.cpath = package.cpath:gsub("%f[^\0;]%.[^;]*", ""):gsub(";+", ";"):gsub("^;", ""):gsub(";$", "") -- Use an invalid directory name in order not to allow kpse to search -- in the current directory. os.setenv("TEXMFDOTDIR", package.config:find("^\\") and "NUL" or "/dev/null") diff --git a/support/digestif/data/natbib.sty.tags b/support/digestif/data/natbib.sty.tags index fc62570636..5cf757d7c6 100644 --- a/support/digestif/data/natbib.sty.tags +++ b/support/digestif/data/natbib.sty.tags @@ -1,34 +1,616 @@ +-- Copyright 1993-2010 Patrick W Daly +-- SPDX-License-Identifier: LPPL-1.3c+ +-- +-- Adapted from the natbib package documentation, which can be found at +-- https://ctan.org/pkg/natbib ctan_package = "natbib" + +-- 5 Package Options +options = { + round = { + summary = "for round parentheses (default)" + }, + square = { + summary = "for square brackets" + }, + angle = { + summary = "for angle brackets" + }, + semicolon = { + summary = "separate multiple citations with semi-colons (default)" + }, + colon = { + summary = "same as `semicolon`" + }, + comma = { + summary = "use commas as separators" + }, + authoryear = { + summary = "for author-year citations (default)" + }, + numbers = { + summary = "for numerical citations" + }, + super = { + summary = "for superscripted numerical citations" + }, + sort = { + summary = "orders multiple citations into the sequence of the list of references" + }, + ["sort&compress"] = { + summary = "as `sort` but multiple numerical citations are compressed if possible" + }, + compress = { + summary = "compress without sorting" + }, + longnamesfirst = { + summary = "makes the first citation of any reference the equivalent of the starred variant" + }, + sectionbib = { + "redefines `\\thebibliography` to issue `\\section*` instead of `\\chapter*`" + }, + nonamebreak = { + summary = "keeps all the authors' names in a citation on one line" + }, + merge = { + summary = "allow the * prefix to the citation key and for merging" + }, + elide = { + summary = "elide common elements of merged references" + }, + mcite = { + summary = "elide common elements of merged references" + } +} + commands = { - Citealp = "$ref:natbib.sty#/commands/cite", - Citealt = "$ref:natbib.sty#/commands/cite", - Citeauthor = "$ref:natbib.sty#/commands/cite", - Citep = "$ref:natbib.sty#/commands/cite", - Citet = "$ref:natbib.sty#/commands/cite", + + -- 2.3 Basic Citation Commands cite = { action = "cite", arguments = { + {literal = "*", optional = true}, {delimiters = {"[", "]"}, meta = "prenote", optional = true}, {delimiters = {"[", "]"}, meta = "postnote", optional = true}, {list = true, meta = "keys"} }, - summary = "Refer to a bibliography item." - }, - citealp = "$ref:natbib.sty#/commands/cite", - citealt = "$ref:natbib.sty#/commands/cite", - citeauthor = "$ref:natbib.sty#/commands/cite", - citeauthoryear = "$ref:natbib.sty#/commands/cite", - citefullauthor = "$ref:natbib.sty#/commands/cite", - citename = "$ref:natbib.sty#/commands/cite", - citenum = "$ref:natbib.sty#/commands/cite", - citep = "$ref:natbib.sty#/commands/cite", - citepalias = "$ref:natbib.sty#/commands/cite", - citestarts = "$ref:natbib.sty#/commands/cite", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\cite[prenote][postnote]{key} +\cite*[prenote][postnote]{key} +``` + +`\cite` (without notes) is the same as `\citet` in author-year mode, +whereas in numerical mode, it is the same as `\citep`. The starred +version, as well as the one or two optional notes, may also be used. +This syntax has been retained for compatibility, but is no longer +encouraged. + +* `\cite{jon90}` => Jones et al., (1990) +* `\cite[]{jon90}` => (Jones et al., 1990) +* `\cite[chap.~2]{jon90}` => (Jones et al., 1990, chap. 2) +* `\cite*{jon90}` => Jones, Baker, and Williams, (1990) +* `\cite*[]{jon90}` => (Jones, Baker, and Williams, 1990)]] + }, + + citep = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item in parenthetical form.", + details = [[ +```latex +\citep[prenote][postnote]{key} +\citep*[prenote][postnote]{key} +``` + +Basic command for a parenthetical citation. The starred version prints +the full author list, and not just the abbreviated one. These macros +may take one or two optional arguments to add some text before and +after the citation. Multiple citations may be made by including more +than one citation key in the \cite command argument. + +* `\citep{jon90}` => (Jones et al., 1990) +* `\citep[chap.~2]{jon90}` => (Jones et al., 1990, chap. 2) +* `\citep[see][]{jon90}` => (see Jones et al., 1990) +* `\citep[see][chap.~2]{jon90}` => (see Jones et al., 1990, chap. 2) +* `\citep*{jon90}` => (Jones, Baker, and Williams, 1990) +* `\citep{jon90,jam91}` => (Jones et al., 1990; James et al. 1991) +* `\citep{jon90,jon91}` => (Jones et al., 1990, 1991) +* `\citep{jon90a,jon90b}` => (Jones et al., 1990a,b) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text, as shown above.]] + }, + + citet = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item in textual form.", + details = [[ +```latex +\citet[prenote][postnote]{key} +\citet*[prenote][postnote]{key} +``` + +Basic command for a textual citation. The starred version prints the +full author list, and not just the abbreviated one. These macros may +take one or two optional arguments to add some text before and after +the citation. Multiple citations may be made by including more than +one citation key in the \cite command argument. + +* `\citet{jon90}` => Jones et al. (1990) +* `\citet[chap.~2]{jon90}` => Jones et al. (1990, chap. 2) +* `\citet[see][]{jon90}` => Jones et al. (see 1990) +* `\citet[see][chap.~2]{jon90}` => Jones et al. (see 1990, chap. 2) +* `\citet*{jon90}` => Jones, Baker, and Williams (1990) +* `\citet{jon90,jam91}` => Jones et al. (1990); James et al. (1991) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text, as shown above.]] + }, + + -- 2.4 Extended Citation Commands + + citealp = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citalp[prenote][postnote]{key} +\citalp*[prenote][postnote]{key} +``` + +Alternative from of `\citep` without parentheses. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citealp{jon90}` => Jones et al., 1990 +* `\citealp*{jon90}` => Jones, Baker, and Williams, 1990 +* `\citealp{jon90,jam91}` => Jones et al., 1990; James et al. 1991 +* `\citealp[pg.~32]{jon90}` => Jones et al., 1990, pg. 32 + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citealt = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citealt[prenote][postnote]{key} +\citealt*[prenote][postnote]{key} +``` + +Alternative from of `\citet` without parentheses. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citealt{jon90}` => Jones et al. 1990 +* `\citealt*{jon90}` => Jones et al. 1990 + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citenum = { + action = "cite", + arguments = {{meta = "key"}}, + summary = "Print the citation number.", + details = [[ +```latex +\citenum{key} +``` + +This command prints the citation number, without parentheses, even in +author-year mode, and without raising it in superscript mode. This is +intended to be able to refer to citation numbers without +superscripting them. + +`\citenum{jon90}` => 11]] + }, + + citetext = { + arguments = {{meta = "text"}}, + summary = "Insert text in the current citation parentheses.", + details = [[ +```latex +\citetext{text} +``` + +This command allows arbitrary text to be placed in the current +citation parentheses. This may be used in combination with +`\citealp`. For example, + +* `\citetext{see \citealp{jon90}, or even better \citealp{jam91}}` +=> (see Jones et al., 1990, or even better James et al., 1991)]] + }, + + citeauthor = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citeauthor[prenote][postnote]{key} +\citeauthor*[prenote][postnote]{key} +``` + +Refer to the authors without the year. Mostly useful in author-year +schemes. The starred version prints the full author list, and not +just the abbreviated one. These macros may take one or two optional +arguments to add some text before and after the citation. Multiple +citations may be made by including more than one citation key in the +\cite command argument. + +* `\citeauthor{jon90}` => Jones et al. +* `\citeauthor*{jon90}` => Jones, Baker, and Williams + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citefullauthor = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/citeyear/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citefullauthor[prenote][postnote]{key} +``` + +Refer to the full list of authors without the year. Mostly useful in +author-year schemes. This macro is equivalent to `\citeauthor*`: + +`\citefullauthor{jon90}` => Jones, Baker, and Williams + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citeyear = { + action = "cite", + arguments = { + {delimiters = {"[", "]"}, meta = "prenote", optional = true}, + {delimiters = {"[", "]"}, meta = "postnote", optional = true}, + {list = true, meta = "key"} + }, + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citeyear[prenote][postnote]{key} +``` + +Refer to the year of a citation. Mostly useful in author-year +schemes.: + +`\citeyear{jon90}` => 1990 + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citeyearpar = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/citeyear/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\citeyearpar[prenote][postnote]{key} +``` + +Refer to the year of a citation printed in parentheses. Mostly useful +in author-year schemes.: + +`\citeyearpar{jon90}` => (1990) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + -- 2.5 Forcing Upper Cased Name + + Citep = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item in parenthetical form.", + details = [[ +```latex +\Citep[prenote][postnote]{key} +\Citep*[prenote][postnote]{key} +``` + +Like `\citep` with the first letter uppercased. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citep{dRob98}` => (della Robbia, 1990) +* `\Citep{dRob98}` => (Della Robbia, 1990) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + Citet = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item in textual form.", + details = [[ +```latex +\Citet[prenote][postnote]{key} +\Citet*[prenote][postnote]{key} +``` + +Like `\citet` with the first letter uppercased. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citet{dRob98}` => della Robbia (1998) +* `\Citet{dRob98}` => Della Robbia (1998) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + Citealp = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\Citealp[prenote][postnote]{key} +\Citealp*[prenote][postnote]{key} +``` + +Like `\citealp` with the first letter uppercased. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citealp{dRob98}` => della Robbia, 1998 +* `\Citealp{dRob98}` => Della Robbia, 1998 + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + Citealt = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\Citealt[prenote][postnote]{key} +\Citealt*[prenote][postnote]{key} +``` + +Like `\citealt` with the first letter uppercased. The starred version +prints the full author list, and not just the abbreviated one. These +macros may take one or two optional arguments to add some text before +and after the citation. Multiple citations may be made by including +more than one citation key in the \cite command argument. + +* `\citealt{dRob98}` => della Robbia 1998 +* `\Citealt{dRob98}` => Della Robbia 1998 + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + Citeauthor = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography item.", + details = [[ +```latex +\Citeauthor[prenote][postnote]{key} +\Citeauthor*[prenote][postnote]{key} +``` + +Like `\citeauthor` with the first letter uppercased. Mostly useful in +author-year schemes. The starred version prints the full author list, +and not just the abbreviated one. These macros may take one or two +optional arguments to add some text before and after the citation. +Multiple citations may be made by including more than one citation key +in the \cite command argument. + +* `\citeauthor{dRob98}` => della Robbia +* `\Citeauthor{dRob98}` => Della Robbia + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + -- 2.6 Citation Aliasing + + defcitealias = { + action = "bibitem", + arguments = { + {meta = "key"}, + {meta = "replacement"} + }, + summary = "Create an alias to a bibliography item.", + details = [[ +```latex +\defcitealias{key}{replacement} +``` + +This command creates a special designation for a reference, i.e. Paper I. +Such aliases can be defined like this: + +`\defcitealias{jon90}{Paper~I}`]] + }, + + citetalias = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/citeyear/arguments", + summary = "Refer to a bibliography alias in textual form.", + details = [[ +```latex +\citetalias[prenote][postnote]{key} + +``` + +Like `\citet` but for aliases. This macro may take one or two +optional arguments to add some text before and after the citation. +Multiple citations may be made by including more than one citation key +in the \cite command argument. + +* `\defcitealias{jon90}{Paper~I}` +* `\citetalias{jon90}` => Paper I + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text.]] + }, + + citepalias = { + action = "cite", + arguments = "$ref:natbib.sty#/commands/cite/arguments", + summary = "Refer to a bibliography alias in parenthetical form.", + details = [[ +```latex +\citepalias[prenote][postnote]{key} +``` + +Like `\citep` but for aliases. This macro may take one or two +optional arguments to add some text before and after the citation. +Multiple citations may be made by including more than one citation key +in the \cite command argument. + +* `\defcitealias{jon90}{Paper~I}` +* `\citepalias{jon90}` => (Paper I) + +Note that a single optional text is a post-note, while two are the pre- +and post-notes. To have only a pre-note, it is necessary to provide +an empty post-note text, as shown above.]] + }, + + -- 2.9 Selecting Citation Punctuation + + setcitestyle = { + arguments = { + {meta = "citestyle", + keys = { + authoryear = { + summary = "citation mode, corresponds to fourth argument of `\\bibpunct`." + }, + numbers = { + summary = "citation mode, corresponds to fourth argument of `\\bibpunct`." + }, + super = { + summary = "citation mode, corresponds to fourth argument of `\\bibpunct`." + }, + round = { + summary = "braces, corresponds to first and second arguments of `\\bibpunct`" + }, + square = { + summary = "braces, corresponds to first and second arguments of `\\bibpunct`" + }, + open = { + summary = "braces, corresponds to first and second arguments of `\\bibpunct`" + }, + close = { + summary = "braces, corresponds to first and second arguments of `\\bibpunct`" + }, + semicolon = { + summary = "between citations, corresponds to third argument of `\\bibpunct`" + }, + comma = { + summary = "between citations, corresponds to third argument of `\\bibpunct`" + }, + citesep = { + summary = "between citations, corresponds to third argument of `\\bibpunct`" + }, + aysep = { + summary = "between years with common author, corresponds to fifth argument of `\\bibpunct`" + }, + yysep = { + summary = "between years with common author, corresponds to sixth argument of `\\bibpunct`" + }, + notesep = { + summary = "Text before post-note, corresponds to optional argument of `\\bibpunct`" + } + } + } + }, + summary = "Command for setting the citation style.", + details = [[ +```latex +\setcitestyle{key=val} +``` + +Command for setting the citation style with key=val pairs.]] + }, + + bibpunct = { + arguments = { + {meta = "before postnote", + optional = true, delimiters = {"[", "]"}}, + {meta = "opening bracket"}, + {meta = "closing bracket"}, + {meta = "between citations"}, + {meta = "style"}, + {meta = "between names&year"}, + {meta = "between years for suppressed author lists"} + }, + summary = "Older command for setting the citation style.", + details = [[ +```latex +\bibpunct[before-postnote]{open}{close]{between}{style}{author-year}{between-years} +``` + +Command for setting the citation style. This command is superseded by +`\setcitestyle`.]] + }, + + -- 2.10 Predefining a citation style citestyle = {arguments = {{meta = "style"}}}, - citet = "$ref:natbib.sty#/commands/cite", - citetalias = "$ref:natbib.sty#/commands/cite", - citetext = {arguments = {{meta = "text"}}}, - citeyear = "$ref:natbib.sty#/commands/cite", - citeyearpar = "$ref:natbib.sty#/commands/cite", - shortcites = "$ref:natbib.sty#/commands/cite" + + -- 2.18 Long Author List on First Citation + shortcites = { + action = "cite", + arguments = {{meta = "key", list = true,}}, + summary = "Print short list of authors on first citation.", + details = [[ +```latex +\shortcites{key} +``` + +When the package option `longnamesfirst` is given, the full author +list is printed with the first citation of any reference, and +afterwards only the abbreviated list. Some references have so many +authors that you want to suppress the automatic long list only for +them. In this case, issue + +`\shortcites{key}` + +before the first citations, and those included in key-list will have a +short list on their first citation.]] + } } diff --git a/support/digestif/data/tikz.tags b/support/digestif/data/tikz.tags index f14f8093f9..2c20853bca 100644 --- a/support/digestif/data/tikz.tags +++ b/support/digestif/data/tikz.tags @@ -2103,7 +2103,8 @@ Sections ?? to ??. documentation = "texmf:doc/generic/pgf/pgfmanual.pdf#pgf.back/usegdlibrary" }, usetikzlibrary = { - arguments = {{meta = "list of libraries"}}, + arguments = {{meta = "list of libraries", list=true}}, + action="input", filename="tikzlibrary?.code.tex", details = [[ Once TikZ has been loaded, you can use this command to load further libraries. The list of libraries should contain the names of libraries diff --git a/support/digestif/digestif/Cache.lua b/support/digestif/digestif/Cache.lua index d7e3e16f85..303e6d34b9 100644 --- a/support/digestif/digestif/Cache.lua +++ b/support/digestif/digestif/Cache.lua @@ -78,7 +78,7 @@ local search_magic_comment_patt = util.choice( -- Determine the root path of a document from magic comments. function Cache:rootname(filename) - local _, cookie = self(filename) -- warm up + local _, cookie = self(filename) -- luacheck: ignore cookie (warm up the cache) local props = assert(self.store[filename]) local rootname = props.rootname if rootname == nil then diff --git a/support/digestif/digestif/Manuscript.lua b/support/digestif/digestif/Manuscript.lua index d9101d8c07..e358a70b47 100644 --- a/support/digestif/digestif/Manuscript.lua +++ b/support/digestif/digestif/Manuscript.lua @@ -1,12 +1,14 @@ -- Manuscript class +local lfs = require "lfs" local config = require "digestif.config" local util = require "digestif.util" local require_data = require "digestif.data".require +local ctan_package_of = require "digestif.data".ctan_package_of local get_info = require "digestif.data".get_info local resolve_doc_items = require "digestif.data".resolve_doc_items -local path_join, path_split = util.path_join, util.path_split +local path_split = util.path_split local path_normalize = util.path_normalize local find_file = util.find_file local format_filename_template = util.format_filename_template @@ -244,23 +246,23 @@ end -- Compute the line and column number (both 1-based) at the given -- position. --- --- TODO: make len function a parameter -function Manuscript:line_column_at(pos) - -- Out ranges are excluside on the right, Lua is inclusive, so we +-- `length_fun` should be utf8.len or a similar function adapted to +-- other text encodings. +function Manuscript:line_column_at(pos, length_fun) + -- Our ranges are exclusive on the right, Lua is inclusive, so we -- may have pos == 1 + #self.src. pos = min(pos, #self.src) local l, line_pos = self:line_number_at(pos) - local c = utf8_len(self.src, line_pos, pos) or error("Invalid UTF-8") + local c = length_fun(self.src, line_pos, pos) or error("Invalid offset") return l, c end -- Compute the source position at the given line an column. --- --- TODO: make offset function a parameter -function Manuscript:position_at(line, col) +-- `offset_fun` should be utf8.offset or a similar function adapted to +-- other text encodings. +function Manuscript:position_at(line, col, offset_fun) local line_pos = self.lines[line] or error("Position out of bounds") - return utf8_offset(self.src, col, line_pos) or error("Position out of bounds") + return offset_fun(self.src, col, line_pos) or error("Position out of bounds") end @@ -679,7 +681,7 @@ end -- (of length twice that of args) indicating the positions of each -- argument within that string. -- -function Manuscript:signature_args(args, before) +function Manuscript:signature_args(args, before) -- luacheck: ignore self if not args then return before or "", {} end local t, p, pos = {before}, {}, 1 + (before and #before or 0) for i = 1, #args do @@ -727,7 +729,7 @@ Manuscript.signature_env = Manuscript.signature_cmd -- Returns: -- The formatted snippet, as a string, without the $0 placeholder. -- -function Manuscript:snippet_args(args, i) +function Manuscript:snippet_args(args, i) -- luacheck: ignore self if not args then return "" end i = i or 1 local t = {} @@ -809,6 +811,7 @@ end Manuscript.completion_handlers = {} +--** Command and environment name completion function Manuscript.completion_handlers.cs(self, ctx) local commands, environments = self.commands, self.environments local extra_snippets = config.extra_snippets @@ -845,6 +848,28 @@ function Manuscript.completion_handlers.cs(self, ctx) return ret end +function Manuscript.completion_handlers.begin(self, ctx, pos) + local environments = self.environments + local prefix = self:substring(ctx.pos, pos - 1) + local has_prefix = matcher(prefix) + local r = { + pos = ctx.pos, + prefix = prefix, + kind = "environment" + } + for env in pairs(map_keys(has_prefix, environments)) do + local cmd = environments[env] + r[#r+1] = { + text = env, + summary = cmd.summary, + } + end + return r +end + +Manuscript.completion_handlers["end"] = Manuscript.completion_handlers.begin + +--** Key/value completion function Manuscript.completion_handlers.key(self, ctx, pos) local prefix = self:substring(ctx.pos, pos - 1) local len = #prefix @@ -887,26 +912,7 @@ function Manuscript.completion_handlers.value(self, ctx, pos) return r end -function Manuscript.completion_handlers.begin(self, ctx, pos) - local environments = self.environments - local prefix = self:substring(ctx.pos, pos - 1) - local has_prefix = matcher(prefix) - local r = { - pos = ctx.pos, - prefix = prefix, - kind = "environment" - } - for env in pairs(map_keys(has_prefix, environments)) do - local cmd = environments[env] - r[#r+1] = { - text = env, - summary = cmd.summary, - } - end - return r -end - -Manuscript.completion_handlers["end"] = Manuscript.completion_handlers.begin +--** Cross-reference and citation completion -- Get a short piece of text around a label. If there is a recognized -- command ending right before the label, the context starts there. @@ -990,6 +996,58 @@ function Manuscript.completion_handlers.cite(self, ctx, pos) return r end +--** File name completion +function Manuscript.completion_handlers.input(self, ctx, pos) + local template + if ctx.arg then + template = nested_get(ctx, "parent", "data", "filename") or "?" + elseif ctx.item then + template = nested_get(ctx, "parent", "parent", "data", "filename") or "?" + else + return + end + local pre, post = template:match("([^?]*)%?(.*)") + local i_pre, i_post = #pre + 1, -1 - #post + local prefix = self:substring(ctx.pos, pos - 1) + local has_prefix = matcher(pre..prefix) + local has_suffix = matcher(post) + local match = function(s) + return has_suffix(s, -#post) and has_prefix(s) + end + local r = { + pos = ctx.pos, + prefix = prefix, + kind = "file" + } + -- Candidate from TeX directories. Don't try that if the command + -- expects the literal file name. + if template ~= "?" then + for name, _ in pairs(require "digestif.data".texmf_index) do + if match(name) then + local pkg = ctan_package_of(name) + r[#r+1] = { + text = name:sub(i_pre, i_post), + summary = pkg and pkg.summary + } + end + end + end + -- Candidates from current directory + local ok, iter, dir_obj = pcall(lfs.dir, ".") + if ok then + for name in iter, dir_obj do + if match(name) and lfs.attributes(name, "mode") == "file" then + r[#r+1] = { + text = name:sub(i_pre, i_post) + } + end + end + end + -- Sort candidates + table.sort(r, function(a, b) return a.text < b.text end) + return r +end + --* Context help -- Get information about the thing at the given position. @@ -1102,6 +1160,30 @@ function Manuscript.help_handlers.ref(self, ctx) } end +function Manuscript.help_handlers.input(self, ctx) + local name = self:substring(ctx) + local template + if ctx.arg then + template = nested_get(ctx, "parent", "data", "filename") or "?" + elseif ctx.item then + template = nested_get(ctx, "parent", "parent", "data", "filename") or "?" + else + return + end + local pre, post = template:match("([^?]*)%?(.*)") + local filename = pre .. name .. post + local data = ctan_package_of(filename) + if not data then return end + local docstring = self:make_docstring("file", filename, data) + return { + pos = ctx.pos, + cont = ctx.cont, + kind = "file", + summary = data.summary, + details = docstring, + } +end + function Manuscript.help_handlers.begin(self, ctx) local env_name = self:substring(ctx) local data = self.environments[env_name] @@ -1186,6 +1268,9 @@ function Manuscript:make_docstring_header(kind, name, data) ret = self:signature_env(name, data.arguments) elseif kind == "key" and data.meta then ret = ret .. " = " .. data.meta + elseif kind == "file" then + local pkg = ctan_package_of(name) + ret = pkg and pkg.ctan_package or name end if data.summary then ret = "`" .. ret .. "`: " .. data.summary @@ -1231,11 +1316,11 @@ local function make_docstring_details(data) local details = data.details local doc_field = data.documentation if details then - return "# Details\n\n" .. details + return "# Details\n\n" .. details .. (details:sub(-1) == "\n" and "" or "\n") elseif type(doc_field) == "string" and doc_field:match"^info:" then local str, node, subnode = get_info(doc_field) if str then - return format("# Info: (%s)%s\n\n```Info\n%s```", node, subnode, str) + return format("# Info: (%s)%s\n\n```Info\n%s```\n", node, subnode, str) end else return @@ -1243,8 +1328,8 @@ local function make_docstring_details(data) end function Manuscript:make_docstring_docs(kind, name, data) - local item_doc = data.documentation - local pkg = data.package + local item_doc = kind ~= "file" and data.documentation + local pkg = kind == "file" and data or data.package local pkg_doc = pkg and pkg.documentation local t = {"# Documentation\n"} if pkg and pkg.ctan_package then @@ -1253,10 +1338,17 @@ function Manuscript:make_docstring_docs(kind, name, data) elseif kind == "cs" then name = self:signature_cmd(name) end - t[#t+1] = format( - "`%s` is defined in the [%s](https://www.ctan.org/pkg/%s) package.\n", - name, pkg.ctan_package, pkg.ctan_package - ) + if kind == "file" then + t[#t+1] = format( + "`%s` is part of the [%s](https://www.ctan.org/pkg/%s) package.\n", + name, pkg.ctan_package, pkg.ctan_package + ) + else + t[#t+1] = format( + "`%s` is defined in the [%s](https://www.ctan.org/pkg/%s) package.\n", + name, pkg.ctan_package, pkg.ctan_package + ) + end end if item_doc then extend(t, resolve_doc_items(item_doc)) diff --git a/support/digestif/digestif/ManuscriptBibTeX.lua b/support/digestif/digestif/ManuscriptBibTeX.lua index 219f4552b4..659c3d5ec9 100644 --- a/support/digestif/digestif/ManuscriptBibTeX.lua +++ b/support/digestif/digestif/ManuscriptBibTeX.lua @@ -1,13 +1,8 @@ -local lpeg = require "lpeg" local util = require "digestif.util" local Manuscript = require "digestif.Manuscript" local Parser = require "digestif.Parser" local bibtex = require "digestif.bibtex" -local path_join, path_split = util.path_join, util.path_split -local nested_get, nested_put = util.nested_get, util.nested_put -local map, update, merge = util.map, util.update, util.merge - local ManuscriptBibtex = util.class(Manuscript) ManuscriptBibtex.parser = Parser() diff --git a/support/digestif/digestif/ManuscriptConTeXt.lua b/support/digestif/digestif/ManuscriptConTeXt.lua index 2243d3a9fc..4ee33b5df4 100644 --- a/support/digestif/digestif/ManuscriptConTeXt.lua +++ b/support/digestif/digestif/ManuscriptConTeXt.lua @@ -28,7 +28,7 @@ local function collect(s) local top = {} table.insert(stack, top) local ni,c,label,xarg, empty - local i, j = 1, 1 + local i, j = 1, 1 -- luacheck: ignore j while true do ni,j,c,label,xarg, empty = string.find(s, "<(%/?)([%w:]+)(.-)(%/?)>", i) if not ni then break end @@ -290,7 +290,7 @@ end local function tags_from_xml(file, pkg) local ok, str = util.find_file(file, nil, true) if not ok then return end - local ok, data = pcall(collect, str) + local ok, data = pcall(collect, str) -- luacheck: ignore ok if not ok then return end return setmetatable(gen_tags(data), {__index = pkg}) end diff --git a/support/digestif/digestif/ManuscriptLaTeX.lua b/support/digestif/digestif/ManuscriptLaTeX.lua index 1366b0e146..22df3e9980 100644 --- a/support/digestif/digestif/ManuscriptLaTeX.lua +++ b/support/digestif/digestif/ManuscriptLaTeX.lua @@ -5,8 +5,7 @@ local Parser = require "digestif.Parser" local path_join, path_split = util.path_join, util.path_split local path_normalize = util.path_normalize -local nested_get, nested_put = util.nested_get, util.nested_put -local map, update, merge = util.map, util.update, util.merge +local merge = util.merge local format_filename_template = util.format_filename_template local ManuscriptLatex = util.class(Manuscript) @@ -49,7 +48,7 @@ local function first_mand(args) end end -local function first_opt(args) +local function first_opt(args) -- luacheck: ignore first_opt for i, v in ipairs(args) do if v.optional then return i end end diff --git a/support/digestif/digestif/Schema.lua b/support/digestif/digestif/Schema.lua index b59a95157d..0ce26199a5 100644 --- a/support/digestif/digestif/Schema.lua +++ b/support/digestif/digestif/Schema.lua @@ -151,7 +151,7 @@ function Schema:assert_fail(obj) assert(not self:validate(obj)) end -local schema_of_schema = Schema { +local schema_of_schema = Schema { -- luacheck: ignore schema_of_schema fields = { description = { type = "string", diff --git a/support/digestif/digestif/bibtex.lua b/support/digestif/digestif/bibtex.lua index f1430474e3..277db0d364 100644 --- a/support/digestif/digestif/bibtex.lua +++ b/support/digestif/digestif/bibtex.lua @@ -1,10 +1,8 @@ local lpeg = require "lpeg" local util = require "digestif.util" -local B, P, R, S, V - = lpeg.B, lpeg.P, lpeg.R, lpeg.S, lpeg.V -local C, Cc, Cp, Ct, Cmt, Cg - = lpeg.C, lpeg.Cc, lpeg.Cp, lpeg.Ct, lpeg.Cmt, lpeg.Cg +local B, P, R, S = lpeg.B, lpeg.P, lpeg.R, lpeg.S +local C, Cp, Ct, Cg = lpeg.C, lpeg.Cp, lpeg.Ct, lpeg.Cg local concat = table.concat local merge = util.merge local search, gobble_until, case_fold = util.search, util.gobble_until, util.case_fold @@ -34,7 +32,6 @@ local rparen = P")" * whitespace local equals = P"=" * whitespace local hash = P"#" * whitespace local comma = P"," * whitespace -local quote = P'"' * whitespace local lit_string = C(case_fold "string") * whitespace local lit_comment = C(case_fold "comment") * whitespace local lit_preamble = C(case_fold "preamble") * whitespace @@ -54,7 +51,6 @@ local fields = field * (comma * field)^0 local token = curly_braced_string/0 + char local nonspace = token - space local author_sep = space * "and" * space -local etal_marker = P("et al") * whitespace * P(-1) -- either curly or round braced local function braced(patt) @@ -114,9 +110,7 @@ function bibtex.parse(src, options) } for _, t in ipairs(entries) do local entry_type = t[1]:lower() - if entry_type == "comment" then - -- pass - elseif entry_type == "preamble" then + if entry_type == "preamble" then preambles[#preambles + 1] = t[2] elseif entry_type == "string" then for _, u in ipairs_from(t, 2) do @@ -124,9 +118,9 @@ function bibtex.parse(src, options) local val = process_value(u, strings) strings[key] = val end - else + elseif entry_type ~= "comment" then local id = t[2] - local fields = {} + local fields = {} -- luacheck: ignore fields for _, u in ipairs_from(t, 3) do local key = u[1]:lower() local val = process_value(u, strings) @@ -203,7 +197,6 @@ local detexify_symbols = replace(tex_cs_patt, tex_symbols, tex_char_or_math) local detexify_accents = replace(tex_accent_patt, repl_accents_fun, tex_char_or_math) local debracify = replace(curly_braced_string, 1, tex_char_or_math) local detitlify = replace(B(space) * C(tex_letter), string.lower, tex_char_or_math) -local trim = util.trim(space) local clean = util.clean(space) local function deuglify_name (s) @@ -231,11 +224,11 @@ local split_last = search(Cp() * C(nonspace^1) * whitespace * P(-1)) function BibItem:authors() local t = {} - local author = self.fields.author - if not author then return {} end - for _, name in ipairs(split_authors(author)) do + local authors = self.fields.author + if not authors then return {} end + for _, author in ipairs(split_authors(authors)) do local u = {} - local parts = split_name(name) + local parts = split_name(author) if #parts == 3 then u.first = parts[3] u.last = parts[1] @@ -244,12 +237,12 @@ function BibItem:authors() u.first = parts[2] u.last = parts[1] else - local p, l = split_last:match(name) + local p, l = split_last:match(author) if p then - u.first = name:sub(1, p - 1) + u.first = author:sub(1, p - 1) u.last = l else - u.last = name + u.last = author end end t[#t + 1] = u @@ -259,8 +252,8 @@ end function BibItem:pretty_print() local t, a = {}, {} - for _, name in ipairs(self:authors()) do - a[#a + 1] = deuglify_name(name.last) + for _, author in ipairs(self:authors()) do + a[#a + 1] = deuglify_name(author.last) end t[#t + 1] = concat(a, ", ") t[#t + 1] = (self.fields.year or self.fields.date or "(n.d.)") .. ";" diff --git a/support/digestif/digestif/config.lua b/support/digestif/digestif/config.lua index 43b7971094..edad15b317 100644 --- a/support/digestif/digestif/config.lua +++ b/support/digestif/digestif/config.lua @@ -3,7 +3,7 @@ local format = string.format local config = {} -config.version = "0.5.1" +config.version = "0.6" local pre_version = os.getenv("DIGESTIF_PRERELEASE") if pre_version then config.version = config.version .. "-" .. pre_version @@ -142,8 +142,8 @@ end function config.check_data(dir) if not dir then - for _, dir in ipairs(config.data_dirs) do - if config.check_data(dir) then return true end + for _, data_dir in ipairs(config.data_dirs) do + if config.check_data(data_dir) then return true end end end local f = io.open(util.path_join(dir, "primitives.tags")) diff --git a/support/digestif/digestif/data.lua b/support/digestif/digestif/data.lua index 621048f4a9..c9a094536b 100644 --- a/support/digestif/digestif/data.lua +++ b/support/digestif/digestif/data.lua @@ -1,3 +1,4 @@ +local lfs = require "lfs" local lpeg = require "lpeg" local util = require "digestif.util" local config = require "digestif.config" @@ -9,11 +10,11 @@ local P, C, Cg, Ct = lpeg.P, lpeg.C, lpeg.Cg, lpeg.Ct local match = lpeg.match local many, sequence = util.many, util.sequence local gobble, search = util.gobble, util.search -local nested_get, extend = util.nested_get, util.extend +local nested_get = util.nested_get local find_file = util.find_file local parse_uri, make_uri = util.parse_uri, util.make_uri local log = util.log -local path_split, path_join = util.path_split, util.path_join +local path_join, path_split = util.path_join, util.path_split local data = {} local loaded_tags = {} @@ -123,51 +124,63 @@ else if config.verbose then log("TLPDB not found") end end - ---* kpathsea emulation - --- function kpsewhich(name) --- --- Like the kpsewhich command, return the full path of tex input file --- name. We use luatex's kpse bindings if available, and parse the --- system's ls-R files otherwise. --- -local kpsewhich - -if kpse then -- we're on luatex - - local kpse_obj = kpse.new("luatex") - - function kpsewhich(name) - return kpse_obj:find_file(name, "tex") - end - -else -- on plain lua, we look for ls-R files - - local texmf_files = {} - local texmf_dirs = config.texmf_dirs - local dir_patt = P"./" * C(gobble(":" * P(-1))) - for i = 1, #texmf_dirs do - local texmf_dir = texmf_dirs[i] - local listing_path = find_file(texmf_dir, "ls-R") - if listing_path then +data.ctan_package_of = ctan_package_of + +--* Indexing of TeX input files + +-- Table mapping TeX input file names to the directory where it is +-- located. +local texmf_index = {} +do + local dir_patt = C(P"."^-2 * P"/" * gobble(":" * P(-1))) + for _, texmf_dir in ipairs(config.texmf_dirs) do + local clock = config.verbose and os.clock() + local ls_file = io.open(path_join(texmf_dir, "ls-R")) + if ls_file then local current_dir - for line in io.lines(listing_path) do - local subdir = match(dir_patt, line) - if subdir then - current_dir = path_join(texmf_dir, subdir) - elseif current_dir and not texmf_files[line] then - texmf_files[line] = path_join(current_dir, line) + for name in ls_file:lines() do + if name ~= "" then + local subdir = match(dir_patt, name) + if subdir then + current_dir = path_join(texmf_dir, subdir) + elseif current_dir and not texmf_index[name] then + texmf_index[name] = current_dir + end end end + ls_file:close() + else + local function recur(current_dir, max_depth) + local ok, iter, dir_obj = pcall(lfs.dir, current_dir) + if not ok then return end + for name in iter, dir_obj do + if name ~= "." and name ~= ".." then + local path = path_join(current_dir, name) + local mode = lfs.attributes(path, "mode") + if mode == "directory" then + if max_depth > 0 then + recur(path, max_depth - 1) + end + elseif mode == "file" then + if not texmf_index[name] then + texmf_index[name] = current_dir + end + end + end + end + end + recur(texmf_dir, 10) + end + if clock then + log( + "Scanned %s%s in %0.3f ms", + texmf_dir, ls_file and "/ls-R" or "", + 1000*(os.clock() - clock) + ) end end - - function kpsewhich(name) - return texmf_files[name] - end - end +data.texmf_index = texmf_index --* Generate tags from the user's TeX installation @@ -213,12 +226,13 @@ local function tags_from_manuscript(script, ctan_data) end -- Generate tags from TeX source code (or ConTeXt interface XML file, --- if applicable). The argument is a file name found by kpsewhich. +-- if applicable). The argument is TeX input file name. -- local function generate_tags(name) - local path = kpsewhich(name) - path = path and find_file(config.texmf_dirs, path) - if not path then return end + local dir = texmf_index[name] + local path = dir and path_join(dir, name) + local f = path and io.open(path) + if f then f:close() else return end local texformat = infer_format(path) if not texformat then return end if config.verbose then log("Generating tags: %s", path) end @@ -251,7 +265,7 @@ local parse_ref = util.matcher( P"$ref:", C(gobble"#") * P"#", Ct(many(P"/" * C(gobble"/"))))) -p=parse_ref + local function resolve_refs(tbl, seen) seen = seen or {} for k, v in pairs(tbl) do @@ -310,8 +324,6 @@ data.require_tags = require_tags -- for debugging and testing only, and depends on luafilesystem. local function load_all_tags() local t = {} - local ok, lfs = pcall(require, "lfs") - assert(ok, "Function data.load_all() need the luafilesystem library.") for _, data_dir in ipairs(config.data_dirs) do for path in lfs.dir(data_dir) do local pkg = path:match("(.*)%.tags") @@ -352,7 +364,16 @@ local function resolve_doc_items(items) local t = {} for _, item in ipairs(items) do if type(item) == "string" then - t[#t+1] = format("- <%s>", resolve_uri(item)) + local uri = resolve_uri(item) + local scheme, _, location, _, fragment = parse_uri(uri) + if scheme == "info" then + t[#t+1] = format("- Info node [%s(%s)](%s)", location, fragment, uri) + elseif scheme == "file" then + local _, filename = path_split(location) + t[#t+1] = format("- [%s](%s)", filename, uri) + else + t[#t+1] = format("- <%s>", uri) + end else t[#t+1] = format("- [%s](%s)", item.summary, resolve_uri(item.uri)) end diff --git a/support/digestif/digestif/langserver.lua b/support/digestif/digestif/langserver.lua index bbda819f11..ac460d758d 100644 --- a/support/digestif/digestif/langserver.lua +++ b/support/digestif/digestif/langserver.lua @@ -21,6 +21,7 @@ else end --* Convert LSP API objects to/from internal representations +local length_fun, offset_fun = utf8.len, utf8.offset -- This will be a digestif.Cache object. Its initialization is -- deferred to `initialized` method. @@ -61,7 +62,7 @@ local function from_Position(str, position, p0, l0) if l0 and l0 > l then p0, l0 = nil, nil end for n, i in lines(str, p0, l0) do if n == l then - return utf8.offset(str, c, i), i, l + return offset_fun(str, c, i), i, l end end end @@ -85,13 +86,13 @@ local function from_TextDocumentPositionParams(arg) local texformat = open_documents[filename] local script = cache:manuscript(filename, texformat) local l, c = arg.position.line + 1, arg.position.character + 1 - return script, script:position_at(l, c) + return script, script:position_at(l, c, offset_fun) end local function to_Range(item) local script = item.manuscript - local l1, c1 = script:line_column_at(item.pos) - local l2, c2 = script:line_column_at(item.cont) + local l1, c1 = script:line_column_at(item.pos, length_fun) + local l2, c2 = script:line_column_at(item.cont, length_fun) return { start = {line = l1 - 1, character = c1 - 1}, ["end"] = {line = l2 - 1, character = c2 - 1}, @@ -110,8 +111,8 @@ local function to_MarkupContent(str) end local function to_TextEdit(script, pos, old, new) - local l, c_start = script:line_column_at(pos) - local c_end = c_start + utf8.len(old) + local l, c_start = script:line_column_at(pos, length_fun) + local c_end = c_start + length_fun(old) return { range = { start = {line = l - 1, character = c_start - 1}, @@ -185,8 +186,37 @@ methods["initialize"] = function(params) if params.initializationOptions then config.load_from_table(params.initializationOptions) end + local enc, encodings = nil, nested_get(params.capabilities, "general", "positionEncodings") + for _, e in ipairs(encodings or {}) do + if e == "utf-32" then + enc = e + break + elseif e == "utf-8" then + enc = e + length_fun = function(s, i, j) + if i then + j = j or #s + if i < 1 or j < i then error("Invalid offset") end + return j - i + 1 + else + return #s + end + end + offset_fun = function(s, n, i) + i = i or n < 0 and #s + 1 or 1 + local v = n + (i or 1) - 1 + if v < 1 or v > #s + 1 then error("Invalid offset") end + return v + end + break + end + end + if not enc and config.verbose then + log("Digestif and you editor couldn't agree on a fully supported position encoding") + end return { capabilities = { + positionEncoding = enc, textDocumentSync = { openClose = true, change = 2 diff --git a/support/digestif/digestif/util.lua b/support/digestif/digestif/util.lua index 2e042ebd70..c33756cdf0 100644 --- a/support/digestif/digestif/util.lua +++ b/support/digestif/digestif/util.lua @@ -301,7 +301,7 @@ local line_patt = I * (search(I * eol) * I + P(true)) local function lines(s, i, n) return co_wrap(function() - local n, i, j, k = n or 1, match(line_patt, s, i) + local n, i, j, k = n or 1, match(line_patt, s, i) -- luacheck: ignore n i while k do co_yield(n, i, j - 1) n, i, j, k = n + 1, match(line_patt, s, k) @@ -641,10 +641,10 @@ do t[n] = encode_number(obj) return n + 1 elseif obj_type == "table" then - local v = obj[1] - if v ~= nil then + local v1 = obj[1] + if v1 ~= nil then t[n] = "[" - n = do_encode(v, t, n + 1) + n = do_encode(v1, t, n + 1) for i = 2, #obj do t[n] = "," n = do_encode(obj[i], t, n + 1) @@ -658,7 +658,7 @@ do t[n + 1] = encode_string(k) t[n + 2] = "\":" n = do_encode(v, t, n + 3) - for k, v in next, obj, k do + for k, v in next, obj, k do -- luacheck: ignore k v t[n] = ",\"" t[n + 1] = encode_string(k) t[n + 2] = "\":" diff --git a/support/epstopdf/epstopdf.pl b/support/epstopdf/epstopdf.pl index 1a59965017..4fa1a59001 100755 --- a/support/epstopdf/epstopdf.pl +++ b/support/epstopdf/epstopdf.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl use warnings; -# $Id: epstopdf.pl 71584 2024-06-21 22:40:28Z karl $ +# $Id: epstopdf.pl 71777 2024-07-11 21:24:57Z karl $ # (Copyright lines below.) # # Redistribution and use in source and binary forms, with or without @@ -36,7 +36,9 @@ use warnings; # # emacs-page # -my $ver = "2.35"; +my $ver = "2.36"; +# 2024/07/11 2.36 (Karl Berry) +# * regexp syntax for OS/2 test, found by John Collins. # 2024/06/21 2.35 (Karl Berry) # * path_sep for OS/2 is also ";". # 2024/04/29 2.34 (Karl Berry) @@ -228,7 +230,7 @@ my $ver = "2.35"; ### emacs-page ### program identification my $program = "epstopdf"; -my $ident = '($Id: epstopdf.pl 71584 2024-06-21 22:40:28Z karl $)' . " $ver"; +my $ident = '($Id: epstopdf.pl 71777 2024-07-11 21:24:57Z karl $)' . " $ver"; my $copyright = <<END_COPYRIGHT ; Copyright 2009-2024 Karl Berry et al. Copyright 2002-2009 Gerben Wierda et al. @@ -260,7 +262,7 @@ debug " on_cygwin=$on_cygwin, on_msys=$on_msys"; # Split PATH and use / as directory separator. # -my $path_sep = ($^O =~ /^(OS2|MSWin)i/) ? ';' : ':'; # not msys +my $path_sep = ($^O =~ /^(OS2|MSWin)/i) ? ';' : ':'; # not msys my @pdirs = split($path_sep, $ENV{"PATH"}); # Normalize directory separators to /. Always valid on Windows. if ($on_windows_or_cygwin) { diff --git a/support/lacheck/Makefile.in b/support/lacheck/Makefile.in index c9bca0b244..08234e7ceb 100644 --- a/support/lacheck/Makefile.in +++ b/support/lacheck/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. +# Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2021 Free Software Foundation, Inc. +# Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -70,6 +70,8 @@ am__make_running_with_option = \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +am__rm_f = rm -f $(am__rm_f_notfound) +am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -172,10 +174,9 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ + { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ } man1dir = $(mandir)/man1 NROFF = nroff @@ -307,6 +308,7 @@ am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ + $$am__collect_skipped_logs \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the @@ -331,6 +333,11 @@ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ +if test -n '$(IGNORE_SKIPPED_LOGS)'; then \ + am__collect_skipped_logs='--collect-skipped-logs no'; \ +else \ + am__collect_skipped_logs=''; \ +fi; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ @@ -391,20 +398,22 @@ distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -rf "$(distdir)" \ + find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \ + ; rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best +GZIP_ENV = -9 DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = find . -type f -print +distcleancheck_listfiles = \ + find . \( -type f -a \! \ + \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ @@ -464,8 +473,10 @@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ +am__xargs_n = @am__xargs_n@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ @@ -559,12 +570,12 @@ config.h: stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h + $(AM_V_at)rm -f stamp-h1 + $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ + $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + $(AM_V_at)rm -f stamp-h1 + $(AM_V_at)touch $@ distclean-hdr: -rm -f config.h stamp-h1 @@ -608,10 +619,10 @@ uninstall-binPROGRAMS: `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files + cd "$(DESTDIR)$(bindir)" && $(am__rm_f) $$files clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + -$(am__rm_f) $(bin_PROGRAMS) lacheck$(EXEEXT): $(lacheck_OBJECTS) $(lacheck_DEPENDENCIES) $(EXTRA_lacheck_DEPENDENCIES) @rm -f lacheck$(EXEEXT) @@ -627,7 +638,7 @@ distclean-compile: $(am__depfiles_remade): @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + @: >>$@ am--depfiles: $(am__depfiles_remade) @@ -763,7 +774,6 @@ distclean-tags: am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: - $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ @@ -839,10 +849,37 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ + output_system_information () \ + { \ + echo; \ + { uname -a | $(AWK) '{ \ + printf "System information (uname -a):"; \ + for (i = 1; i < NF; ++i) \ + { \ + if (i != 2) \ + printf " %s", $$i; \ + } \ + printf "\n"; \ +}'; } 2>&1; \ + if test -r /etc/os-release; then \ + echo "Distribution information (/etc/os-release):"; \ + sed 8q /etc/os-release; \ + elif test -r /etc/issue; then \ + echo "Distribution information (/etc/issue):"; \ + cat /etc/issue; \ + fi; \ + }; \ + please_report () \ + { \ +echo "Some test(s) failed. Please report this to $(PACKAGE_BUGREPORT),"; \ +echo "together with the test-suite.log file (gzipped) and your system"; \ +echo "information. Thanks."; \ + }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ + output_system_information; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ @@ -862,26 +899,25 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG) for debugging.$${std}";\ if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + please_report | sed -e "s/^/$${col}/" -e s/'$$'/"$${std}"/; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(dist_check_SCRIPTS) - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @$(am__rm_f) $(RECHECK_LOGS) + @$(am__rm_f) $(RECHECK_LOGS:.log=.trs) + @$(am__rm_f) $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(dist_check_SCRIPTS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @$(am__rm_f) $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ @@ -910,7 +946,7 @@ distdir: $(BUILT_SOURCES) distdir-am: $(DISTFILES) $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" + $(AM_V_at)$(MKDIR_P) "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -996,7 +1032,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -1006,7 +1042,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ @@ -1106,28 +1142,28 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + -$(am__rm_f) $(TEST_LOGS) + -$(am__rm_f) $(TEST_LOGS:.log=.trs) + -$(am__rm_f) $(TEST_SUITE_LOG) clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -$(am__rm_f) $(CLEANFILES) distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -$(am__rm_f) $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -rm -f lacheck.c + -$(am__rm_f) lacheck.c clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f ./$(DEPDIR)/lacheck.Po + -rm -f ./$(DEPDIR)/lacheck.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags @@ -1175,7 +1211,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -f ./$(DEPDIR)/lacheck.Po + -rm -f ./$(DEPDIR)/lacheck.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1222,3 +1258,10 @@ lacheck.log: lacheck$(EXEEXT) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: + +# Tell GNU make to disable its built-in pattern rules. +%:: %,v +%:: RCS/%,v +%:: RCS/% +%:: s.% +%:: SCCS/s.% diff --git a/support/lacheck/aclocal.m4 b/support/lacheck/aclocal.m4 index cf145f2e53..4a0523918b 100644 --- a/support/lacheck/aclocal.m4 +++ b/support/lacheck/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.5 -*- Autoconf -*- +# generated automatically by aclocal 1.17 -*- Autoconf -*- -# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Copyright (C) 1996-2024 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# Copyright (C) 2002-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.16' +[am__api_version='1.17' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.5], [], +m4_if([$1], [1.17], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.5])dnl +[AM_AUTOMAKE_VERSION([1.17])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -273,7 +273,7 @@ AC_CACHE_CHECK([dependency style of $depcc], # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: + # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -400,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -534,7 +534,7 @@ if test -z "$CSCOPE"; then fi AC_SUBST([CSCOPE]) -AC_REQUIRE([AM_SILENT_RULES])dnl +AC_REQUIRE([_AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. @@ -542,47 +542,9 @@ AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. +AC_REQUIRE([_AM_PROG_RM_F]) +AC_REQUIRE([_AM_PROG_XARGS_N]) -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <https://www.gnu.org/software/coreutils/>. - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. @@ -615,7 +577,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -636,7 +598,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2021 Free Software Foundation, Inc. +# Copyright (C) 2003-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -658,7 +620,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -693,7 +655,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -736,7 +698,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2021 Free Software Foundation, Inc. +# Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -770,7 +732,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -799,7 +761,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -846,7 +808,23 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# Copyright (C) 2022-2024 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_RM_F +# --------------- +# Check whether 'rm -f' without any arguments works. +# https://bugs.gnu.org/10828 +AC_DEFUN([_AM_PROG_RM_F], +[am__rm_f_notfound= +AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) +AC_SUBST(am__rm_f_notfound) +]) + +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -865,16 +843,169 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# _AM_SLEEP_FRACTIONAL_SECONDS +# ---------------------------- +AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl +AC_CACHE_CHECK([whether sleep supports fractional seconds], + am_cv_sleep_fractional_seconds, [dnl +AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], + [am_cv_sleep_fractional_seconds=no]) +])]) + +# _AM_FILESYSTEM_TIMESTAMP_RESOLUTION +# ----------------------------------- +# Determine the filesystem's resolution for file modification +# timestamps. The coarsest we know of is FAT, with a resolution +# of only two seconds, even with the most recent "exFAT" extensions. +# The finest (e.g. ext4 with large inodes, XFS, ZFS) is one +# nanosecond, matching clock_gettime. However, it is probably not +# possible to delay execution of a shell script for less than one +# millisecond, due to process creation overhead and scheduling +# granularity, so we don't check for anything finer than that. (See below.) +AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl +AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) +AC_CACHE_CHECK([filesystem timestamp resolution], + am_cv_filesystem_timestamp_resolution, [dnl +# Default to the worst case. +am_cv_filesystem_timestamp_resolution=2 + +# Only try to go finer than 1 sec if sleep can do it. +# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, +# - 1 sec is not much of a win compared to 2 sec, and +# - it takes 2 seconds to perform the test whether 1 sec works. +# +# Instead, just use the default 2s on platforms that have 1s resolution, +# accept the extra 1s delay when using $sleep in the Automake tests, in +# exchange for not incurring the 2s delay for running the test for all +# packages. +# +am_try_resolutions= +if test "$am_cv_sleep_fractional_seconds" = yes; then + # Even a millisecond often causes a bunch of false positives, + # so just try a hundredth of a second. The time saved between .001 and + # .01 is not terribly consequential. + am_try_resolutions="0.01 0.1 $am_try_resolutions" +fi + +# In order to catch current-generation FAT out, we must *modify* files +# that already exist; the *creation* timestamp is finer. Use names +# that make ls -t sort them differently when they have equal +# timestamps than when they have distinct timestamps, keeping +# in mind that ls -t prints the *newest* file first. +rm -f conftest.ts? +: > conftest.ts1 +: > conftest.ts2 +: > conftest.ts3 + +# Make sure ls -t actually works. Do 'set' in a subshell so we don't +# clobber the current shell's arguments. (Outer-level square brackets +# are removed by m4; they're present so that m4 does not expand +# <dollar><star>; be careful, easy to get confused.) +if ( + set X `[ls -t conftest.ts[12]]` && + { + test "$[]*" != "X conftest.ts1 conftest.ts2" || + test "$[]*" != "X conftest.ts2 conftest.ts1"; + } +); then :; else + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + _AS_ECHO_UNQUOTED( + ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], + [AS_MESSAGE_LOG_FD]) + AC_MSG_FAILURE([ls -t produces unexpected output. +Make sure there is not a broken ls alias in your environment.]) +fi + +for am_try_res in $am_try_resolutions; do + # Any one fine-grained sleep might happen to cross the boundary + # between two values of a coarser actual resolution, but if we do + # two fine-grained sleeps in a row, at least one of them will fall + # entirely within a coarse interval. + echo alpha > conftest.ts1 + sleep $am_try_res + echo beta > conftest.ts2 + sleep $am_try_res + echo gamma > conftest.ts3 + + # We assume that 'ls -t' will make use of high-resolution + # timestamps if the operating system supports them at all. + if (set X `ls -t conftest.ts?` && + test "$[]2" = conftest.ts3 && + test "$[]3" = conftest.ts2 && + test "$[]4" = conftest.ts1); then + # + # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, + # because we don't need to test make. + make_ok=true + if test $am_try_res != 1; then + # But if we've succeeded so far with a subsecond resolution, we + # have one more thing to check: make. It can happen that + # everything else supports the subsecond mtimes, but make doesn't; + # notably on macOS, which ships make 3.81 from 2006 (the last one + # released under GPLv2). https://bugs.gnu.org/68808 + # + # We test $MAKE if it is defined in the environment, else "make". + # It might get overridden later, but our hope is that in practice + # it does not matter: it is the system "make" which is (by far) + # the most likely to be broken, whereas if the user overrides it, + # probably they did so with a better, or at least not worse, make. + # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html + # + # Create a Makefile (real tab character here): + rm -f conftest.mk + echo 'conftest.ts1: conftest.ts2' >conftest.mk + echo ' touch conftest.ts2' >>conftest.mk + # + # Now, running + # touch conftest.ts1; touch conftest.ts2; make + # should touch ts1 because ts2 is newer. This could happen by luck, + # but most often, it will fail if make's support is insufficient. So + # test for several consecutive successes. + # + # (We reuse conftest.ts[12] because we still want to modify existing + # files, not create new ones, per above.) + n=0 + make=${MAKE-make} + until test $n -eq 3; do + echo one > conftest.ts1 + sleep $am_try_res + echo two > conftest.ts2 # ts2 should now be newer than ts1 + if $make -f conftest.mk | grep 'up to date' >/dev/null; then + make_ok=false + break # out of $n loop + fi + n=`expr $n + 1` + done + fi + # + if $make_ok; then + # Everything we know to check worked out, so call this resolution good. + am_cv_filesystem_timestamp_resolution=$am_try_res + break # out of $am_try_res loop + fi + # Otherwise, we'll go on to check the next resolution. + fi +done +rm -f conftest.ts? +# (end _am_filesystem_timestamp_resolution) +])]) + # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) +[AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) +# This check should not be cached, as it may vary across builds of +# different projects. +AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -893,49 +1024,40 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! +am_build_env_is_sane=no +am_has_slept=no +rm -f conftest.file +for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[]*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + test "$[]2" = conftest.file + ); then + am_build_env_is_sane=yes + break + fi + # Just in case. + sleep "$am_cv_filesystem_timestamp_resolution" + am_has_slept=yes +done + +AC_MSG_RESULT([$am_build_env_is_sane]) +if test "$am_build_env_is_sane" = no; then + AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT([yes]) + # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & +AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl + ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! -fi +]) AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then @@ -946,18 +1068,18 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# Copyright (C) 2009-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl +# _AM_SILENT_RULES +# ---------------- +# Enable less verbose build rules support. +AC_DEFUN([_AM_SILENT_RULES], +[AM_DEFAULT_VERBOSITY=1 +AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) @@ -965,11 +1087,6 @@ AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. @@ -988,14 +1105,6 @@ am__doit: else am_cv_make_support_nested_variables=no fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl @@ -1004,9 +1113,33 @@ AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls +dnl to AM_SILENT_RULES to change the default value. +AC_CONFIG_COMMANDS_PRE([dnl +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; +esac +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +])dnl ]) -# Copyright (C) 2001-2021 Free Software Foundation, Inc. +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or +# empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_REQUIRE([_AM_SILENT_RULES]) +AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) + +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1034,7 +1167,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2021 Free Software Foundation, Inc. +# Copyright (C) 2006-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1053,7 +1186,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2021 Free Software Foundation, Inc. +# Copyright (C) 2004-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1099,15 +1232,19 @@ m4_if([$1], [v7], am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) + if test x$am_uid = xunknown; then + AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) + elif test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) else - AC_MSG_RESULT([no]) - _am_tools=none + AC_MSG_RESULT([no]) + _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) + if test x$gm_gid = xunknown; then + AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) + elif test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none @@ -1184,5 +1321,25 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +# Copyright (C) 2022-2024 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_XARGS_N +# ---------------- +# Check whether 'xargs -n' works. It should work everywhere, so the fallback +# is not optimized at all as we never expect to use it. +AC_DEFUN([_AM_PROG_XARGS_N], +[AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl +AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 +3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) +AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl + am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' +])dnl +AC_SUBST(am__xargs_n) +]) + m4_include([../../m4/kpse-common.m4]) m4_include([../../m4/kpse-warnings.m4]) diff --git a/support/lacheck/configure.texk b/support/lacheck/configure.texk index 06f1ce8f4e..0b986c73d7 100755 --- a/support/lacheck/configure.texk +++ b/support/lacheck/configure.texk @@ -669,6 +669,8 @@ CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +am__xargs_n +am__rm_f_notfound AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V @@ -2408,7 +2410,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -am__api_version='1.16' +am__api_version='1.17' @@ -2511,6 +2513,165 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sleep supports fractional seconds" >&5 +printf %s "checking whether sleep supports fractional seconds... " >&6; } +if test ${am_cv_sleep_fractional_seconds+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if sleep 0.001 2>/dev/null +then : + am_cv_sleep_fractional_seconds=yes +else case e in #( + e) am_cv_sleep_fractional_seconds=no ;; +esac +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_sleep_fractional_seconds" >&5 +printf "%s\n" "$am_cv_sleep_fractional_seconds" >&6; } + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking filesystem timestamp resolution" >&5 +printf %s "checking filesystem timestamp resolution... " >&6; } +if test ${am_cv_filesystem_timestamp_resolution+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Default to the worst case. +am_cv_filesystem_timestamp_resolution=2 + +# Only try to go finer than 1 sec if sleep can do it. +# Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, +# - 1 sec is not much of a win compared to 2 sec, and +# - it takes 2 seconds to perform the test whether 1 sec works. +# +# Instead, just use the default 2s on platforms that have 1s resolution, +# accept the extra 1s delay when using $sleep in the Automake tests, in +# exchange for not incurring the 2s delay for running the test for all +# packages. +# +am_try_resolutions= +if test "$am_cv_sleep_fractional_seconds" = yes; then + # Even a millisecond often causes a bunch of false positives, + # so just try a hundredth of a second. The time saved between .001 and + # .01 is not terribly consequential. + am_try_resolutions="0.01 0.1 $am_try_resolutions" +fi + +# In order to catch current-generation FAT out, we must *modify* files +# that already exist; the *creation* timestamp is finer. Use names +# that make ls -t sort them differently when they have equal +# timestamps than when they have distinct timestamps, keeping +# in mind that ls -t prints the *newest* file first. +rm -f conftest.ts? +: > conftest.ts1 +: > conftest.ts2 +: > conftest.ts3 + +# Make sure ls -t actually works. Do 'set' in a subshell so we don't +# clobber the current shell's arguments. (Outer-level square brackets +# are removed by m4; they're present so that m4 does not expand +# <dollar><star>; be careful, easy to get confused.) +if ( + set X `ls -t conftest.ts[12]` && + { + test "$*" != "X conftest.ts1 conftest.ts2" || + test "$*" != "X conftest.ts2 conftest.ts1"; + } +); then :; else + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + printf "%s\n" ""Bad output from ls -t: \"`ls -t conftest.ts[12]`\""" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "ls -t produces unexpected output. +Make sure there is not a broken ls alias in your environment. +See 'config.log' for more details" "$LINENO" 5; } +fi + +for am_try_res in $am_try_resolutions; do + # Any one fine-grained sleep might happen to cross the boundary + # between two values of a coarser actual resolution, but if we do + # two fine-grained sleeps in a row, at least one of them will fall + # entirely within a coarse interval. + echo alpha > conftest.ts1 + sleep $am_try_res + echo beta > conftest.ts2 + sleep $am_try_res + echo gamma > conftest.ts3 + + # We assume that 'ls -t' will make use of high-resolution + # timestamps if the operating system supports them at all. + if (set X `ls -t conftest.ts?` && + test "$2" = conftest.ts3 && + test "$3" = conftest.ts2 && + test "$4" = conftest.ts1); then + # + # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, + # because we don't need to test make. + make_ok=true + if test $am_try_res != 1; then + # But if we've succeeded so far with a subsecond resolution, we + # have one more thing to check: make. It can happen that + # everything else supports the subsecond mtimes, but make doesn't; + # notably on macOS, which ships make 3.81 from 2006 (the last one + # released under GPLv2). https://bugs.gnu.org/68808 + # + # We test $MAKE if it is defined in the environment, else "make". + # It might get overridden later, but our hope is that in practice + # it does not matter: it is the system "make" which is (by far) + # the most likely to be broken, whereas if the user overrides it, + # probably they did so with a better, or at least not worse, make. + # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html + # + # Create a Makefile (real tab character here): + rm -f conftest.mk + echo 'conftest.ts1: conftest.ts2' >conftest.mk + echo ' touch conftest.ts2' >>conftest.mk + # + # Now, running + # touch conftest.ts1; touch conftest.ts2; make + # should touch ts1 because ts2 is newer. This could happen by luck, + # but most often, it will fail if make's support is insufficient. So + # test for several consecutive successes. + # + # (We reuse conftest.ts[12] because we still want to modify existing + # files, not create new ones, per above.) + n=0 + make=${MAKE-make} + until test $n -eq 3; do + echo one > conftest.ts1 + sleep $am_try_res + echo two > conftest.ts2 # ts2 should now be newer than ts1 + if $make -f conftest.mk | grep 'up to date' >/dev/null; then + make_ok=false + break # out of $n loop + fi + n=`expr $n + 1` + done + fi + # + if $make_ok; then + # Everything we know to check worked out, so call this resolution good. + am_cv_filesystem_timestamp_resolution=$am_try_res + break # out of $am_try_res loop + fi + # Otherwise, we'll go on to check the next resolution. + fi +done +rm -f conftest.ts? +# (end _am_filesystem_timestamp_resolution) + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_filesystem_timestamp_resolution" >&5 +printf "%s\n" "$am_cv_filesystem_timestamp_resolution" >&6; } + +# This check should not be cached, as it may vary across builds of +# different projects. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory @@ -2531,49 +2692,45 @@ esac # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! +am_build_env_is_sane=no +am_has_slept=no +rm -f conftest.file +for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + test "$2" = conftest.file + ); then + am_build_env_is_sane=yes + break + fi + # Just in case. + sleep "$am_cv_filesystem_timestamp_resolution" + am_has_slept=yes +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_build_env_is_sane" >&5 +printf "%s\n" "$am_build_env_is_sane" >&6; } +if test "$am_build_env_is_sane" = no; then + as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } + # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & +if test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1 +then : + +else case e in #( + e) ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! + ;; +esac fi rm -f conftest.file @@ -2863,17 +3020,13 @@ else fi rmdir .tst 2>/dev/null +AM_DEFAULT_VERBOSITY=1 # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } @@ -2896,15 +3049,45 @@ esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi AM_BACKSLASH='\' +am__rm_f_notfound= +if (rm -f && rm -fr && rm -rf) 2>/dev/null +then : + +else case e in #( + e) am__rm_f_notfound='""' ;; +esac +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking xargs -n works" >&5 +printf %s "checking xargs -n works... " >&6; } +if test ${am_cv_xargs_n_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 +3" +then : + am_cv_xargs_n_works=yes +else case e in #( + e) am_cv_xargs_n_works=no ;; +esac +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_xargs_n_works" >&5 +printf "%s\n" "$am_cv_xargs_n_works" >&6; } +if test "$am_cv_xargs_n_works" = yes +then : + am__xargs_n='xargs -n' +else case e in #( + e) am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "" "$am__xargs_n_arg"; done; }' + ;; +esac +fi + @@ -4151,7 +4334,7 @@ else case e in #( # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: + # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported @@ -4469,47 +4652,9 @@ fi -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542> -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: <https://www.gnu.org/software/coreutils/>. - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi # am_maintainer_mode @@ -5058,6 +5203,18 @@ printf %s "checking that generated files are newer than configure... " >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; +esac +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi + if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' diff --git a/support/latexdiff/README b/support/latexdiff/README index 6f4d1a280a..f0310ce32d 100644 --- a/support/latexdiff/README +++ b/support/latexdiff/README @@ -1,4 +1,13 @@ +latexdiff +========= + +Compares two latex files and marks up significant differences between them. Releases on https://ctan.org/pkg/latexdiff and mirrors. + +Link to full manual: http://mirrors.ctan.org/support/latexdiff/doc/latexdiff-man.pdf + + INTRODUCTION +------------ latexdiff is a Perl script, which compares two latex files and marks up significant differences between them (i.e. a diff for latex files). @@ -16,11 +25,9 @@ behaviour and accept or reject selected changes only. The author is F Tilmann. -Project webpage: https://github.com/ftilmann/latexdiff/ -CTAN page: http://www.ctan.org/pkg/latexdiff - REQUIREMENTS +------------ Perl 5.8 or higher must be installed. The latexdiff script makes use of the Perl package Algorithm::Diff (available @@ -38,6 +45,7 @@ UNIX-diff mean that the resulting set of differences will generally not be the s for the standard latexdiff. In most practical cases, these differences are minor, though. INSTALLATION UNIX/LINUX +----------------------- The basic installation procedure is almost trivial: @@ -53,34 +61,40 @@ The basic installation procedure is almost trivial: The attached trivial Makefile contains example commands to carry out above steps as root for a typical UNIX installation. Type - make install (for the stand alone version) + `make install` (for the stand alone version) + or - make install-ext (for the version using the external Algorithm::Diff) + + `make install-ext` (for the version using the external Algorithm::Diff) + or - make install-fast (for the version using the UNIX 'diff' function for fast differencing) + + `make install-fast` (for the version using the UNIX 'diff' function for fast differencing) to get it rolling. You can type - make test -or - make test-ext -or - make test-fast + `make test` or + + `make test-ext` or + + `make test-fast` to test the respective versions on a brief example before installation. It will often be as easy to carry out these steps manually instead of using the Makefile. -DOCUMENTATION: +DOCUMENTATION +------------- Usage instructions are in the manual latexdiff-man.pdf as well as the man pages. -CHANGELOGS: - +CHANGELOGS +---------- Check out the comment lines at the beginning of the perl scripts (latexdiff, latexdiff-vc, latexrevise) CONTRIBUTIONS +------------- The directory contrib contains code written by others relating to latexdiff. Currently this directory contains: @@ -97,15 +111,19 @@ Contributions by the following authors were incorporated into the latexdiff code extend latexdiff in a similar way: J. Paisley, N. Becker, K. Huebner EXTERNAL LATEXDIFF SUPPORT PROGRAMS +----------------------------------- + +LATEXDIDFFR (Author: David Hugh-Jones) is a small library that uses the latexdiff command to create a diff of two Rmarkdown, .Rnw or TeX files. +https://github.com/hughjonesd/latexdiffr 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 +https://github.com/twilsonco/latexdiffcite GIT-LATEXDIFF (lead author: Matthieu Moy) is a wrapper (bash script) 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) - +LICENSE +------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation. @@ -116,3 +134,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details (file LICENSE in the distribution). + + + diff --git a/support/latexdiff/doc/example-diff.tex b/support/latexdiff/doc/example-diff.tex index 8eda2a43aa..b68c11aff9 100644 --- a/support/latexdiff/doc/example-diff.tex +++ b/support/latexdiff/doc/example-diff.tex @@ -22,7 +22,7 @@ \RequirePackage[normalem]{ulem} %DIF PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE -\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF PREAMBLE +\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF PREAMBLE %DIF SAFE PREAMBLE %DIF PREAMBLE \providecommand{\DIFaddbegin}{} %DIF PREAMBLE \providecommand{\DIFaddend}{} %DIF PREAMBLE @@ -53,6 +53,8 @@ } %DIF PREAMBLE \lstnewenvironment{DIFverbatim}{\lstset{style=DIFverbatimstyle}}{} %DIF PREAMBLE \lstnewenvironment{DIFverbatim*}{\lstset{style=DIFverbatimstyle,showspaces=true}}{} %DIF PREAMBLE +\lstset{extendedchars=\true,inputencoding=utf8} + %DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF \begin{document} diff --git a/support/latexdiff/doc/latexdiff-man.pdf b/support/latexdiff/doc/latexdiff-man.pdf Binary files differindex 2ea00571b3..d0e57ad5c9 100644 --- a/support/latexdiff/doc/latexdiff-man.pdf +++ b/support/latexdiff/doc/latexdiff-man.pdf diff --git a/support/latexdiff/latexdiff b/support/latexdiff/latexdiff index a032ae23b5..5df02b753f 100755 --- a/support/latexdiff/latexdiff +++ b/support/latexdiff/latexdiff @@ -25,6 +25,21 @@ # # Note references to issue numbers are for the github repository of latexdiff: https://github.com/ftilmann/latexdiff # +# Version 1.3.4: +# New features: +# - Option to use lua-ul instead of ulem (for use with LuaLaTeX) (fix #17, #60, #188, #255, #270) +# Enhancement +# - If amsmath is detected as one of the included (based on idea in PR #263 contributed by github user xlucn +# Bug fix +# - sometimes the introduction of aux commands to show deleted lists or descriptions leaves in place empty auxiliary +# list environments, which would cause error messages (though skipping messages would result in a correct output pdf). +# These are now removed. +# - add more mboxsafecmd and safecmd commands for SIunitx to stay compatible with newer versionsof SIunitx (PR #283, fixing issue #282, contributed by github user joe6302413) +# - File added via --preamble option is no longer assumed to be ASCII, but read either with encoding as defined by --encoding option or using the encoding of the LOCALE (fixes issue #285 ) +# - multicolumn argument is now treated as text +# - when tikz-dependency package is used, \& is no longer a safe command as it has special meaning inside dependency environment. The fix is a little of a hack as really it should only be considered unsafe within dependency environment (fixes (mostly) issue #303 ) +# - listings package had trouble with non-ASCII chars. The encoding is now set (thanks to github user anka-213 for finding this). Fixes #304 +# # Version 1.3.3: # New features: # - Option --no-del to remove all deleted text (merge contributed by github user tdegeus PR #252, fixing issue #66 @@ -33,22 +48,22 @@ # - Abbreviations involving punctuations within them. They need special treatment because otherwise in some # circumstances the gnoring of white space differences in conjunction with merging according to MINWORDSBLOCK rule # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269). A few abbreviations -# are now hard-coded and treated as atomic: +# are now hard-coded and treated as atomic: # English: i.e., e.g. Deutsch: z.B. # (fixes issue #269) # - In WHOLE and COARSE math modes, now properly treat math environments with arguments such as \alignat. Fixes #251 -# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes -# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result -# in errors. (Partially) fixes issues #235 and #244. -# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a -# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which +# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes +# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result +# in errors. (Partially) fixes issues #235 and #244. +# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a +# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which # in amsmath (and with eqnarray) will result in the same environment but without line numbers. Config variable MATHARRREPL # is therefore (nearly) redundant, and a depracation warning is given when it is set. Reference to MATHARRREPL are have # been removed from the manual (there is one exception, when it's still being used: sometimes latexdiff can figure out # that there is a deleted array environment, but does not know which one. In this case, MATHARRREPL is still being used -# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). +# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). # Fixes issue #216 -# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. +# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. # Exclude \begin and \end in math environments in COARSE and WHOLE modes. Fixes #258. Fixes #109 # - --flatten now works for empty files. Fixes issue #242 # - improved processing of Chinese and Japanese texts in that splitting is done based on characters. Thanks to LuXu (Oliver Lew) in git for working this out. Fixes #229, fixes #145 @@ -65,7 +80,7 @@ # Bug fixes: # - fix issue #206 affecting proper markup of text commands which are not also safe cmd's and have multiple arguments # - fix issue #210 by adding \eqref (amsmath package) to the list of safe commands -# - fix bug reported in issue #168 mangled verbatim line environment +# - fix bug reported in issue #168 mangled verbatim line environment # - fix bug reported in issue #218 by replacing \hspace{0pt} after \mbox{..} auxiliary commands with \hskip0pt. # - more ways to process \frac correctly with atomic arguments (committed by julianuu PR #246 # - fix a bug in biblatex mode, which prevented proper processing of modified \textcite (see: https://tex.stackexchange.com/questions/555157/latexdiff-and-biblatex-citation-commands) @@ -74,10 +89,10 @@ # Version 1.3.1.1 # - remove spurious \n to fix error: Unknown regexp modifier "/n" at .../latexdiff line 1974, near "=~ " (see github issue #201) # -# Version 1.3.1 +# Version 1.3.1 # Bug fixes: # - remove some uninitialised variable $2 warnings in string substitution in flatten function in case included file is not found -# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) +# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) # - pre-processing: replace (contributed) routine take_comments_and_enter_from_frac() with take_comments_and_newline_from_frac(), which does the same thing # (remove whitespace characters and comments between the argument of \frac commands) in an easier and more robust way. In addition, it # will replace commands like \frac12 with \frac{1}{2} as pre-processing step. Fixes issue #184 @@ -95,15 +110,15 @@ # Version 1.3.0 (7 October 2018): # - treat options to \documentclass as potential package names (some packages allow implicit loading of or imply selected packages # - improved pattern matching: now allows nested angular brackets, and is no longer confused by escaped curly braces -# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . +# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . # - verbatim and lstlisting environments are marked-up with line-by-line in a similar style to non-verbatim text (requires the listing package to be installed) # (see new configuration variable VERBATIMLINEENV) (several issues and pull requests by jprotze) -# - --flatten: now supports \verbatiminput and \lstlistinput +# - --flatten: now supports \verbatiminput and \lstlistinput # - --flatten: if file is not found, do not fail, simply warn and leave command unexpanded (inspired by issue #112). Don't warn if file name contains #[0-9] as it is then most likely an argument within a command definition rather than an actual file (applies to \input, \subfile, \include commands) # - added to textcmds: \intertext # - new config variable CUSTOMDIFCMD to allow defining special versions of commands in added or deleted blocks (Pull request by github user jprotze) # - added option -no-links (mostly for use by latexdiff-vc in only-changes modes) (Pull request by github user jprotze) -# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) +# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) # new option --no-filter-stderr to hide stderr output from filter-script (potentially dangerous, as this might hide malfunctioning of filter scripts) # - --flatten now can deal with imports made using the import package {PR jasonmccsmith #173) # Bug fixes: @@ -122,12 +137,12 @@ # make environments that are treated like verbatim environments configurable (config variable VERBATIMENV) # treat lstinlne as equivalent to verb command # partially addresses issue #38 -# - refactoring: set default configuration variables in a hash, and those that correspond to lists +# - refactoring: set default configuration variables in a hash, and those that correspond to lists # - feature: option --add-to-config used to amend configuration variables, which are regex pattern lists # - bug fix: deleted figures when endfloat package is activated # - bug fix: alignat environment now always processed correctly (fix issues #65) # - bug fix: avoid processing of commands as potential files in routine init_regex_arr (fix issue #70 ) -# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be +# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be # @ a letter if it is part of a command name will usually lead to the correct behaviour (see http://tex.stackexchange.com/questions/346651/latexdiff-and-let) # - new feature/bug fix: --flatten option \endinput in included files now respected but only if \endinput stands right at the beginning of the line (issue #77) # - bug fix: flatten would incorrectly attempt to process commented out \include commands (from discussion in issue #77 ) @@ -165,7 +180,7 @@ # - introduce list UNSAFEMATHCMD, which holds list of commands which cannot be marked up with \DIFadd or \DIFdel commands (only relevant for WHOLE and COARSE math markup modes) # - new subtype LABEL which gives each change a label. This can later be used to only display pages where changes # have been made (instructions for that are put as comments into the diff'ed file) inspired by answer on http://tex.stackexchange.com/questions/166049/invisible-markers-in-pdfs-using-pdflatex -# - Configuration variables take into accout some commands from additional packages: +# - Configuration variables take into accout some commands from additional packages: # tikzpicture environment now treated as PICTUREENV, and \smallmatrix in ARRENV (amsmath) # - --flatten: support for \subfile command (subfiles package) (in response to http://tex.stackexchange.com/questions/167620/latexdiff-with-subfiles ) # - --flatten: \bibliography commands expand if corresponding bbl file present @@ -179,11 +194,11 @@ # - \% in one-letter sub/Superscripts was not converted correctly # # Version 1.0.3 -# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator +# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator # command in preamble # - \(..\) inline math expressions were not parsed correctly, if they contained a linebreak # - applied patch contributed by tomflannaghan via Berlios: [ Patch #3431 ] Adds correct handling of \left< and \right> -# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug +# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug # and sketching out the solution) # - \^ and \_ are correctly interpreted as accent and underlined space, respectively, not as superscript of subscript # (thanks to Wail Yahyaoui for pointing out this bug) @@ -191,19 +206,19 @@ # Version 1.0.1 - treat \big,\bigg etc. equivalently to \left and # \right - include starred version in MATHENV - apply # - flatten recursively and --flatten expansion is now -# aware of comments (thanks to Tim Connors for patch) +# aware of comments (thanks to Tim Connors for patch) # - Change to post-processing for more reliability for # deleted math environments -# - On linux systems, recognise and remove DOS style newlines +# - On linux systems, recognise and remove DOS style newlines # - Provide markup for some special preamble commands (\title, -# \author,\date, -# - configurable by setting context2cmd +# \author,\date, +# - configurable by setting context2cmd # - for styles using ulem package, remove \emph and \text.. from list of # safe commands in order to allow linebreaks within the -# highlighted sections. -# - for ulem style, now show citations by enclosing them in \mbox commands. -# This unfortunately implies linebreaks within citations no longer function, -# so this functionality can be turned off (Option --disable-citation-markup). +# highlighted sections. +# - for ulem style, now show citations by enclosing them in \mbox commands. +# This unfortunately implies linebreaks within citations no longer function, +# so this functionality can be turned off (Option --disable-citation-markup). # With --enable-citation-markup, the mbox markup is forced for other styles) # - new substyle COLOR. This is particularly useful for marking up citations # and some special post-processing is implemented to retain cite @@ -211,11 +226,11 @@ # - four different levels of math-markup # - Option --driver for choosing driver for modes employing changebar package # - accept \\* as valid command (and other commands of form \.*). Also accept -# \<nl> (backslashed newline) +# \<nl> (backslashed newline) # - some typo fixes, include commands defined in preamble as safe commands -# (Sebastian Gouezel) +# (Sebastian Gouezel) # - include compared filenames as comments as line 2 and 3 of -# the preamble (can be modified with option --label, and suppressed with +# the preamble (can be modified with option --label, and suppressed with # --no-label), option --visible-label to show files in generated pdf or dvi # at the beginning of main document # @@ -231,7 +246,7 @@ # # Version 0.4 March 06 option for fast differencing using UNIX diff command, several minor bug fixes (\par bug, improved highlighting of textcmds) # -# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces +# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces # option, several minor bug fixes # # Version 0.25 October 04 Fix bug with deleted equations, add math mode commands to safecmd, add | to allowed interpunctuation signs @@ -247,12 +262,13 @@ use utf8 ; use File::Spec ; + my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.3.3 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) - (c) 2004-2022 F J Tilmann +This is LATEXDIFF 1.3.4 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) + (c) 2004-2024 F J Tilmann EOF # Hash with defaults for configuration variables. These marked undef have default values constructed from list defined in the DATA block @@ -343,9 +359,9 @@ my $DELCMDOPEN='%DIFDELCMD < '; # To mark begin of deleted commands (must begin my $DELCMDCLOSE="%%%\n"; # To mark end of deleted commands (must end with a new line) my $AUXCMD='%DIFAUXCMD' ; # follows auxiliary commands put in by latexdiff to make difference file legal # auxiliary commands must be on a line of their own - # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in + # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in # the same line as this would mean they are shown - # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line + # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line # is an auxiliary command # Similarly "%DIFAUXCMD LAST" would indicate the auxiliary command is in previous line (not currently used) my $DELCOMMENT='DIF < '; # To mark deleted comment line @@ -356,21 +372,21 @@ my @TEXTCMDLIST=(); # array containing patterns of commands with text arguments my @TEXTCMDEXCL=(); # array containing patterns of commands without text arguments (if a pattern # matches both TEXTCMDLIST and TEXTCMDEXCL it is excluded) my @CONTEXT1CMDLIST=(); # array containing patterns of commands with text arguments (subset of text commands), - # but which cause confusion if used out of context (e.g. \caption). + # but which cause confusion if used out of context (e.g. \caption). # In deleted passages, the command will be disabled but its argument is marked up - # Otherwise they behave exactly like TEXTCMD's + # Otherwise they behave exactly like TEXTCMD's my @CONTEXT1CMDEXCL=(); # exclude list for above, but always empty my @CONTEXT2CMDLIST=(); # array containing patterns of commands with text arguments, but which fail or cause confusion # if used out of context (e.g. \title). They and their arguments will be disabled in deleted # passages my @CONTEXT2CMDEXCL=(); # exclude list for above, but always empty my @MATHTEXTCMDLIST=(); # treat like textcmd. If a textcmd is in deleted or added block, just wrap the - # whole content with \DIFadd or \DIFdel irrespective of content. This functionality + # whole content with \DIFadd or \DIFdel irrespective of content. This functionality # is useful for pseudo commands \MATHBLOCK.. into which math environments are being - # transformed -my @MATHTEXTCMDEXCL=(); # + # transformed +my @MATHTEXTCMDEXCL=(); # -# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these +# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these our @SAFECMDLIST=(); # array containing patterns of safe commands (which do not break when in the argument of DIFadd or DIFDEL) our @SAFECMDEXCL=(); my @MBOXCMDLIST=(); # patterns for commands which are in principle safe but which need to be surrounded by an \mbox @@ -435,7 +451,7 @@ $mathmarkup=COARSE; $verbose=0; $onlyadditions=0; # output debug and intermediate files, set to 0 in final distribution -$debug=0; +$debug=0; # insert preamble directly after documentclass - experimental feature, set to 0 in final distribution # Note that this failed with mini example (or other files, where packages used in latexdiff preamble # are called again with incompatible options in preamble of resulting file) @@ -458,9 +474,9 @@ END my %verbhash; Getopt::Long::Configure('bundling'); -GetOptions('type|t=s' => \$type, - 'subtype|s=s' => \$subtype, - 'floattype|f=s' => \$floattype, +GetOptions('type|t=s' => \$type, + 'subtype|s=s' => \$subtype, + 'floattype|f=s' => \$floattype, 'config|c=s' => \@configlist, 'add-to-config=s' => \@addtoconfiglist, 'preamble|p=s' => \$preamblefile, @@ -509,11 +525,11 @@ if ( $help ) { if ( $version ) { - print STDERR $versionstring ; + print STDERR $versionstring ; exit 0; } -print STDERR $versionstring if $verbose; +print STDERR $versionstring if $verbose; if (defined($showall)){ $showpreamble=$showsafe=$showtext=$showconfig=1; @@ -531,7 +547,7 @@ if (defined($mathmarkup)) { $mathmarkup=~tr/a-z/A-Z/; if ( $mathmarkup eq 'OFF' ){ $mathmarkup=OFF; - } elsif ( $mathmarkup eq 'WHOLE' ){ + } elsif ( $mathmarkup eq 'WHOLE' ){ $mathmarkup=WHOLE; } elsif ( $mathmarkup eq 'COARSE' ){ $mathmarkup=COARSE; @@ -634,7 +650,7 @@ foreach $config ( @configlist ) { } } foreach $assign ( @config ) { - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}=$2; } @@ -671,7 +687,7 @@ foreach $key ( keys(%CONFIG) ) { foreach $assign ( @addtoconfig ) { ###print STDERR "assign:|$assign|\n"; - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}.=";$2"; } @@ -686,8 +702,8 @@ foreach ( keys(%CONFIG) ) { elsif ( $_ eq "MATHENV" ) { $MATHENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "MATHREPL" ) { $MATHREPL = $CONFIG{$_} ; } elsif ( $_ eq "MATHARRENV" ) { $MATHARRENV = liststringtoregex($CONFIG{$_}) ; } - elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; - print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; + elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; + print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; } elsif ( $_ eq "ARRENV" ) { $ARRENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "VERBATIMENV" ) { $VERBATIMENV = liststringtoregex($CONFIG{$_}) ; } @@ -714,11 +730,11 @@ foreach $pkg ( @packagelist ) { if ($showconfig || $showtext || $showsafe || $showpreamble) { show_configuration(); - exit 0; + exit 0; } -if ( @ARGV != 2 ) { +if ( @ARGV != 2 ) { print STDERR "2 and only 2 non-option arguments required. Write latexdiff -h to get help\n"; exit(2); } @@ -726,7 +742,7 @@ if ( @ARGV != 2 ) { # Are extra spaces between command arguments permissible? my $extraspace; if ($allowspaces) { - $extraspace='\s*'; + $extraspace='\s*'; } else { $extraspace=''; } @@ -749,14 +765,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # 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.'\}|\\\\\{|\\\\\})*'; - # Actually within the text body, quoted braces are replaced in pre-processing. The only place where + # Actually within the text body, quoted braces are replaced in pre-processing. The only place where # the last part of the pattern matters is when processing the arguments of context2cmds in the preamble # and these contain a \{ or \} combination, probably rare. # It should thus be fine to use the simpler version below. ### $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; } - my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $brat_n = $brat0; for (my $i_pat = 0; $i_pat < 4; ++$i_pat){ $brat_n = '(?:[^\[\]]|\['.$brat_n.'\]|\\\[|\\\])*'; @@ -773,7 +789,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269) # English: i.e., e.g. Deutsch: z.B. my $abbreviation='(?:i\. ?e\.|e\. ?g\.|z\. ?B\.)' ; - my $number='-?\d*\.\d*'; + my $number='-?\d*\.\d*'; # word: sequence of letters or accents followed by letter my $word_cj='\p{Han}|\p{InHiragana}|\p{InKatakana}'; @@ -801,7 +817,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # inline math $....$ or \(..\) ### the commented out version is simpler but for some reason cannot cope with newline (in spite of s option) - need to include \newline explicitly ### my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(].*?\\\\[)]'; - my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; + my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ### test version (this seems to give the same results as version above) ## the current maths command cannot cope with newline within the math expression ### my $math='\$(?:[^$]|\\\$)*?\$|\\[(].*?\\[)]'; @@ -819,7 +835,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); -# now we are done setting up and can start working +# now we are done setting up and can start working my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { @@ -847,7 +863,7 @@ my ($oldtime,$newtime,$oldlabel,$newlabel); if (defined($labels[0])) { $oldlabel=$labels[0] ; } else { - $oldtime=localtime((stat($oldfile))[9]); + $oldtime=localtime((stat($oldfile))[9]); $oldlabel="$oldfile " . " "x($oldlabel_n_spaces) . $oldtime; } if (defined($labels[1])) { @@ -860,6 +876,7 @@ if (defined($labels[1])) { $encoding=guess_encoding($newfile) unless defined($encoding); $encoding = "utf8" if $encoding =~ m/^utf8/i ; +print STDERR "Encoding $encoding\n" if $verbose; if (lc($encoding) eq "utf8" ) { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -943,7 +960,7 @@ my @auxlines; my ($ulem)=0; if ( length $oldpreamble && length $newpreamble ) { - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) # and marking up content with latexdiff markup @auxlines=preprocess_preamble($oldpreamble,$newpreamble); @@ -975,7 +992,7 @@ if (defined($graphicsmarkup)) { } else { # Default: no explicit setting in menu if ( defined $packages{"graphicx"} or defined $packages{"graphics"} ) { - $graphicsmarkup=NEWONLY; + $graphicsmarkup=NEWONLY; } else { $graphicsmarkup=NONE; } @@ -1008,7 +1025,7 @@ if ($graphicsmarkup != NONE ) { @matches=( $latexdiffpreamble =~ m/command\{\\DIFaddbeginFL}\{($pat_n)}/sg ) ; # we look at the last one of the list to take into account possible redefinition but almost always matches should have exactly one element if ( $matches[$#matches] =~ m/\\DIFaddbegin/ ) { - die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; + die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; exit 10; } ###} @@ -1022,6 +1039,11 @@ if ($graphicsmarkup != NONE ) { $ulem = ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{ulem\}/ || defined $packages{"ulem"}); +# If amsmath is defined and $ulem is used for markup, redefine the \sout command to also work (mostly) in math mode +# See stack exchange https://tex.stackexchange.com/questions/20609/strikeout-in-math-mode/308647#308647 based on comment by Taylor Raine +if ( defined($packages{'amsmath'}) and $ulem ) { + $latexdiffpreamble .= join "\n",(extrapream('AMSMATHULEM'),""); +} # If listings is being used or can be found in the latexdiff search path, add to the preamble auxiliary code to enable line-by-line markup if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @@ -1031,7 +1053,7 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { } my @listingDIFcode=(); my $replaced; - # note that in case user supplies preamblefile the type might not reflect well the + # note that in case user supplies preamblefile the type might not reflect well the actual markup style @listingDIFcode=extrapream("-nofail","DIFCODE_" . $type) unless defined($preamblefile); if (!(@listingDIFcode)) { # if listingDIFcode is empty try to guess a suitable one from the preamble @@ -1045,13 +1067,17 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @listingDIFcode=extrapream("DIFCODE_BOLD"); } } - # now splice it in + # add configuration so that listings work with utf-8 + push @listingpreamble, '\lstset{extendedchars=\true,inputencoding='.$encoding."}\n"; + + + # now splice it in $replaced=0; ###print STDERR "DEBUG: listingDIFcode: ",join("\n",@listingDIFcode),"|||\n" if $debug; - @listingpreamble=grep { + @listingpreamble=grep { # only replace if this has not been done already (use short-circuit property of and) - if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { + if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { ###print STDERR "DEBUG: Replaced text $_\n" if $debug; $replaced=1; 1; @@ -1081,7 +1107,7 @@ if ( length $oldpreamble && length $newpreamble ) { unshift @oldpreamble,''; @diffpreamble = linediff(\@oldpreamble, \@newpreamble); # remove dummy line again - shift @diffpreamble; + shift @diffpreamble; # add filenames, modification time and latexdiff mark defined($nolabel) or splice @diffpreamble,1,0, "%DIF LATEXDIFF DIFFERENCE FILE", @@ -1130,8 +1156,8 @@ if (defined $packages{"siunitx"} ) { # protect SI command by surrounding them with an \mbox # this is done to get around an incompatibility between the ulem and siunitx package print STDERR "siunitx package detected.\n" if $verbose ; - my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange'; - init_regex_arr_list(\@SAFECMDLIST,'num,si'); + my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange,qty,qtylist,qtyproduct,qtyrange,complexqty'; + init_regex_arr_list(\@SAFECMDLIST,'num,si,numproduct,unit,complexnum'); if ( $enablecitmark || ( $ulem && ! $disablecitmark )) { init_regex_arr_list(\@MBOXCMDLIST,$mboxcmds); } else { @@ -1153,7 +1179,7 @@ if (defined $packages{"cleveref"} ) { if (defined $packages{"glossaries"} ) { # protect selected command by surrounding them with an \mbox - # this is done to get around an incompatibility between ulem and glossaries package + # this is done to get around an incompatibility between ulem and glossaries package print STDERR "glossaries package detected.\n" if $verbose ; my $mboxcmds='[gG][lL][sS](?:|pl|disp|link|first|firstplural|desc|user[iv][iv]?[iv]?),[aA][cC][rR](?:long|longpl|full|fullpl),[aA][cC][lfp]?[lfp]?'; init_regex_arr_list(\@SAFECMDLIST,'[gG][lL][sS](?:(?:entry)?(?:text|plural|name|symbol)|displaynumberlist|entryfirst|entryfirstplural|entrydesc|entrydescplural|entrysymbolplural|entryuser[iv][iv]?[iv]?|entrynumberlist|entrydisplaynumberlist|entrylong|entrylongpl|entryshort|entryshortpl|entryfull|entryfullpl),[gG]lossentry(?:name|desc|symbol),[aA][cC][rR](?:short|shortpl),[aA]csp?'); @@ -1182,6 +1208,10 @@ if (defined $packages{"mhchem"} ) { # push(@MATHTEXTCMDLIST,'cee'); } +if ( defined $packages{"tikz-dependency"} ) { + init_regex_arr_ext(\@SAFECMDEXCL, 'AMPERSAND'); +} + my ( $citpat); @@ -1269,7 +1299,7 @@ print STDERR "(",exetime()," s)\n","Done.\n" if $verbose; # liststringtoregex(liststring) -# expands string with semi-colon separated list into a regular expression corresponding +# expands string with semi-colon separated list into a regular expression corresponding # matching any of the elements sub liststringtoregex { my ($liststring)=@_; @@ -1282,7 +1312,7 @@ sub liststringtoregex { } # show_configuration -# note that this is not encapsulated but uses variables from the main program +# note that this is not encapsulated but uses variables from the main program # It is provided for convenience because in the future it is planned to allow output # to be modified based on what packages are read etc - this works only if the input files are actually read # whether or not additional files are provided @@ -1309,7 +1339,7 @@ sub show_configuration { print "\nContext1 commands (last argument textual, command will be disabled in deleted passages, last argument will be shown as plain text):\n"; print_regex_arr(@CONTEXT1CMDLIST); print "\nContext2 commands (last argument textual, command and its argument will be disabled in deleted passages):\n"; - print_regex_arr(@CONTEXT2CMDLIST); + print_regex_arr(@CONTEXT2CMDLIST); print "\nExclude list of Commands with last argument not textual (overrides patterns above):\n"; print_regex_arr(@TEXTCMDEXCL); } @@ -1417,7 +1447,7 @@ sub list_packages { my %packages=(); my $pkg; - # remove comments + # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat_n)\])?\{(.*?)\}/gs ) { @@ -1522,7 +1552,7 @@ sub flatten { my ($includeonly,$dirname,$fname,$newpage,$fullfile,$filecontent,$replacement,$begline,$inputcmd,$bblfile,$subfile,$command,$verbenv,$verboptions,$ignore,$fileonly); my ($subpreamble,$subbody,$subpost); my ($subdir,$subdirfull,$importfilepath); - require File::Basename ; + require File::Basename ; ### require File::Spec ; # now this is needed even if flatten option not given $filename = File::Spec->rel2abs( $filename ) ; ($ignore, $dirname, $fileonly) = File::Spec->splitpath($filename) ; @@ -1562,15 +1592,15 @@ sub flatten { $subdirfull = (defined($3) ? File::Spec->catdir($dirname,$subdir) : $subdir); $importfilepath = File::Spec->catfile($subdirfull, $fname); - + print STDERR "importing importfilepath:", $importfilepath,"\n" if $verbose; if ( -f $importfilepath ) { # If file exists, replace input or include command with expanded input #TODO: need remove_endinput & newpage similar to other replacements inside flatten - $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); + $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$importfilepath,". I will continue but not expand |$2|\n"; $replacement = $2; $replacement .= "{$subdir}{$fname} % Processed"; @@ -1579,13 +1609,13 @@ sub flatten { }/exgm; # recursively replace \\input and \\include files - $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ + $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ $begline=(defined($1)? $1 : "") ; $inputcmd=$2; $fname = $3 if defined($3) ; $fname = $4 if defined($4) ; $newpage=(defined($4)? " \\newpage " : "") ; - # # add tex extension unless there is a three or four letter extension already + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}$|; $fullfile = File::Spec->catfile($dirname,$fname); print STDERR "DEBUG Beg of line match |$1|\n" if defined($1) && $debug ; @@ -1594,12 +1624,12 @@ sub flatten { # content of file becomes replacement value (use recursion), add \newpage if the command was include if ( -f $fullfile ) { # If file exists, replace input or include command with expanded input - $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); - $replacement = remove_endinput($replacement); + $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); + $replacement = remove_endinput($replacement); # \include always starts a new page; use explicit \newpage command to simulate this } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$fullfile,". I will continue but not expand |$inputcmd|\n" unless $fname =~ m(#[0-9]) ; $replacement = $inputcmd ; # i.e. just the original command again -> make no change file does not exist $newpage=""; @@ -1608,7 +1638,7 @@ sub flatten { }/exgm; # replace bibliography with bbl file if it exists - $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ if ( -f $bblfile ){ $replacement=read_file_with_encoding(File::Spec->catfile($bblfile), $encoding); } else { @@ -1620,10 +1650,10 @@ sub flatten { }/exgm; # replace subfile with contents (subfile package) - $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; - $fname = $2; - # # add tex extension unless there is a three or four letter extension already + $fname = $2; + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}|; print STDERR "Include file as subfile $fname\n" if $verbose; # content of file becomes replacement value (use recursion) @@ -1634,10 +1664,10 @@ sub flatten { # if file exists, expand \subfile command by contents of file $subfile=read_file_with_encoding($fullfile,$encoding) or die "Could not open included subfile ",$fullfile,": $!"; ($subpreamble,$subbody,$subpost)=splitdoc($subfile,'\\\\begin\{document\}','\\\\end\{document\}'); - ### $subfile=~s|^.*\\begin{document}||s; + ### $subfile=~s|^.*\\begin{document}||s; ### $subfile=~s|\\end{document}.*$||s; $replacement=flatten($subbody, $preamble,$fullfile,$encoding); - ### $replacement = remove_endinput($replacement); + ### $replacement = remove_endinput($replacement); } else { # if file does not exist, do not expand subfile print STDERR "WARNING: Could not find subfile ",$fullfile,". I will continue but not expand |$2|\n" unless $fname =~ m(#[0-9]) ; @@ -1648,11 +1678,11 @@ sub flatten { }/exgm; # replace \verbatiminput and \lstlistinginput - $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; $command = $2 ; $fname = $4 ; - $verboptions = defined($3)? $3 : "" ; + $verboptions = defined($3)? $3 : "" ; if ($command eq 'verbatiminput' ) { $verbenv = "verbatim" ; } elsif ($command eq 'verbatiminput*' ) { @@ -1661,7 +1691,7 @@ sub flatten { $verbenv = "lstlisting" ; } else { die "Internal errorL Unexpected verbatim input type $command.\n"; - } + } print STDERR "DEBUG Beg of line match |$begline|\n" if $debug ; print STDERR "Include file $fname verbatim\n" if $verbose; print STDERR "DEBUG looking for file ",File::Spec->catfile($dirname,$fname), "\n" if $debug; @@ -1693,8 +1723,8 @@ sub print_regex_arr { # if $type is a filename, it will read the file instead of reading from the appendix # otherwise it will screen appendix for line "%DIF $TYPE" and copy everything up to line # '%DIF END $TYPE' (where $TYPE is upcased version of $type) -# extrapream('-nofail',$type) will---instead of failing---simply return nothing if -# it does not find the matching line in a appendix (do not use -nofail option with multiple types!) +# extrapream('-nofail',$type) will---instead of failing---simply return nothing if +# it does not find the matching line in appendix (do not use -nofail option with multiple types!) sub extrapream { my @types=@_; my ($type,$arg); @@ -1711,14 +1741,20 @@ sub extrapream { $type=$arg; $copy=0; if ( -f $type || lc $type eq '/dev/null' ) { - open (FILE,$type) or die "Cannot open preamble file $type: $!"; print STDERR "Reading preamble file $type\n" if $verbose ; + open (FILE,$type) or die "Cannot open preamble file $type: $!"; + if (defined($encoding)) { + binmode(FILE,":encoding($encoding)"); + } else { + require Encode::Locale; + binmode(FILE,":encoding(locale)"); + } while (<FILE>) { chomp ; if ( $_ =~ m/%DIF PREAMBLE/ ) { - push (@retval,"$_"); + push (@retval,"$_"); } else { - push (@retval,"$_ %DIF PREAMBLE"); + push (@retval,"$_ %DIF PREAMBLE"); } } } else { # not (-f $type) @@ -1730,9 +1766,9 @@ sub extrapream { my $data_start = tell DATA; while (<DATA>) { if ( m/^%DIF $type/ ) { - $copy=1; + $copy=1; } elsif ( m/^%DIF END $type/ ) { - last; + last; } chomp; push (@retval,"$_ %DIF PREAMBLE") if $copy; @@ -1772,7 +1808,7 @@ sub splitdoc { $pos=pos $rest; $part2=substr($rest,0,$pos-length($2)); $part3=substr($rest,$pos); - } + } else { die "$word1 and $word2 not in the correct order or not present as a pair." ; } @@ -1844,7 +1880,7 @@ sub splitlatex { my $leadin=$1; length($string)>0 or return ($leadin); - my @retval=($string =~ m/$pat/osg); + my @retval=($string =~ m/$pat/osg); if (length($string) != length(join("",@retval))) { print STDERR "\nWARNING: Inconsistency in length of input string and parsed string:\n This often indicates faulty or non-standard latex code.\n In many cases you can ignore this and the following warning messages.\n Note that character numbers in the following are counted beginning after \\begin{document} and are only approximate." unless $ignorewarnings; @@ -1888,17 +1924,17 @@ sub splitlatex { # pass1( \@seq1,\@seq2) # Look for differences between seq1 and seq2. -# Where an common-subsequence block is flanked by deleted or appended blocks, +# Where an common-subsequence block is flanked by deleted or appended blocks, # and is shorter than $MINWORDSBLOCK words it is appended -# to the last deleted or appended word. If the block contains tokens other than words +# to the last deleted or appended word. If the block contains tokens other than words # or punctuation it is not merged. # Deleted or appended block consisting of words and safe commands only are # also merged, to prevent break-up in pass2 (after previous isolated words have been removed) -# If there are commands with textual arguments (e.g. \caption) both in corresponding -# appended and deleted blocks split them such that the command and opening bracket -# are one token, then the rest is split up following standard rules, and the closing +# If there are commands with textual arguments (e.g. \caption) both in corresponding +# appended and deleted blocks split them such that the command and opening bracket +# are one token, then the rest is split up following standard rules, and the closing # bracket is a separate token, ie. turn -# "\caption{This is a textual argument}" into +# "\caption{This is a textual argument}" into # ("\caption{","This ","is ","a ","textual ","argument","}") # No return value. Destructively changes sequences sub pass1 { @@ -1927,15 +1963,15 @@ sub pass1 { my $adddiscard = sub { if ($cnt > 0 ) { $matblkcnt++; - # just after an unchanged block + # just after an unchanged block # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; - if ($cnt < $MINWORDSBLOCK + if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { - # merge identical blocks shorter than $MINWORDSBLOCK + # merge identical blocks shorter than $MINWORDSBLOCK # and only containing ordinary words # with preceding different word # We cannot carry out this merging immediately as this @@ -1943,23 +1979,23 @@ sub pass1 { # the algorithm, instead we store in @$todo where we have to merge push(@$todo, [ $last1,$last2,$cnt,@$block ]); } - $block = []; + $block = []; $cnt=0; $last1=-1; $last2=-1; } }; my $discard=sub { $deltokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$delblock,[ $seq1->[$_[0]],$_[0] ]); - $last1=$_[0] }; + $last1=$_[0] }; my $add = sub { $addtokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$addblock,[ $seq2->[$_[1]],$_[1] ]); - $last2=$_[1] }; + $last2=$_[1] }; my $match = sub { $mattokcnt++; if ($cnt==0) { # first word of matching sequence after changed sequence or at beginning of word sequence - $deltextblocks = extracttextblocks($delblock); + $deltextblocks = extracttextblocks($delblock); $delblkcnt++ if scalar @$delblock; $addtextblocks = extracttextblocks($addblock); $addblkcnt++ if scalar @$addblock; @@ -1975,7 +2011,7 @@ sub pass1 { ### Algorithm::Diff 1.19 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, 0, sub { $_[0]->[0] } ); } else { - ### Algorithm::Diff 1.15 + ### Algorithm::Diff 1.15 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, sub { $_[0]->[0] } ); } @@ -2006,11 +2042,11 @@ sub pass1 { my ($index,$block,$cnt)=@{ shift(@$addtextblocks) }; push(@$todo, [-1,$index,$cnt,@$block]); } - + $addblock=[]; $delblock=[]; } - push(@$block,$seq2->[$_[1]]); + push(@$block,$seq2->[$_[1]]); $cnt++ }; my $keyfunc = sub { join(" ",split(" ",shift())) }; @@ -2018,7 +2054,7 @@ sub pass1 { traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - # now carry out the merging/splitting. Refer to elements relative from + # now carry out the merging/splitting. Refer to elements relative from # the end (with negative indices) as these offsets don't change before the instruction is executed # cnt>0: merged small unchanged groups with previous changed blocks # cnt==-1: split textual commands into components @@ -2033,7 +2069,7 @@ sub pass1 { } } - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens in $matblkcnt blocks.\n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2043,10 +2079,10 @@ sub pass1 { # extracttextblocks(\@blockindex) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form # [[ $index, $textblock, $cnt ], .. # where $index index of block to be merged # $textblock contains all the words to be merged with the word at $index (but does not contain this word) @@ -2054,7 +2090,7 @@ sub pass1 { # # requires: iscmd # -sub extracttextblocks { +sub extracttextblocks { my $block=shift; my ($i,$token,$index); my $textblock=[]; @@ -2064,13 +2100,13 @@ sub extracttextblocks { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text if ($last<0) { @@ -2078,7 +2114,7 @@ sub extracttextblocks { $last=$index; } else { # add to pure-text block - push(@$textblock, $token); + push(@$textblock, $token); } } else { # it is not text @@ -2099,29 +2135,29 @@ sub extracttextblocks { # extractcommands( \@blockindex ) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form -# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. -# where index is just taken from input array -# command must have a textual argument as last argument -# -# requires: iscmd -# -sub extractcommands { +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form +# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. +# where index is just taken from input array +# command must have a textual argument as last argument +# +# requires: iscmd +# +sub extractcommands { my $block=shift; my ($i,$token,$index,$cmd,$open,$mid,$closing); my $retval=[]; # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: \cmd @@ -2129,7 +2165,7 @@ sub extractcommands { # $4: } + trailing spaces if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat_n\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { - print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; + print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; $closing =~ s/\}/\\RIGHTBRACE/ ; @@ -2140,7 +2176,7 @@ sub extractcommands { } # iscmd($cmd,\@regexarray,\@regexexcl) checks -# return 1 if $cmd matches any of the patterns in the +# return 1 if $cmd matches any of the patterns in the # array $@regexarray, and none of the patterns in \@regexexcl, otherwise return 0 sub iscmd { my ($cmd,$regexar,$regexexcl)=@_; @@ -2148,7 +2184,7 @@ sub iscmd { ### print STDERR "DEBUG: iscmd($cmd)=" if $debug; foreach $pat ( @$regexar ) { if ( $cmd =~ m/^${pat}$/ ) { - $ret=1 ; + $ret=1 ; last; } } @@ -2164,13 +2200,13 @@ sub iscmd { # pass2( \@seq1,\@seq2) -# Look for differences between seq1 and seq2. +# Look for differences between seq1 and seq2. # Mark begin and end of deleted and appended sequences with tags $DELOPEN and $DELCLOSE # and $ADDOPEN and $ADDCLOSE, respectively, however exclude { } & and all comands, unless # they match an element of the whitelist (SAFECMD) # For words in TEXTCMD but not in SAFECMD, enclose interior with $ADDOPEN and $ADDCLOSE brackets -# Deleted comment lines are marked with %DIF < -# Added comment lines are marked with %DIF > +# Deleted comment lines are marked with %DIF < +# Added comment lines are marked with %DIF > sub pass2 { my $seq1 = shift ; my $seq2 = shift ; @@ -2202,7 +2238,7 @@ sub pass2 { $addhunk = []; } push(@$retval,$seq2->[$_[1]]) }; - + my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); @@ -2211,7 +2247,7 @@ sub pass2 { push @$retval,marktags($ADDMARKOPEN,$ADDMARKCLOSE,$ADDOPEN,$ADDCLOSE,"","",$ADDCOMMENT,$addhunk) if scalar @$addhunk; - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens. \n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2233,7 +2269,7 @@ sub marktags { my (@argtext); my $retval=[]; my $noncomment=0; - my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word + my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word # 1: last token written is a command # for keeping track whether we are just in a command sequence or in a word sequence my $cmdcomment= ($opencmd =~ m/^%/); # Flag to indicate whether opencmd is a comment (i.e. if we intend to simply comment out changed commands) @@ -2249,31 +2285,31 @@ sub marktags { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace_mt='\s*'; + my $extraspace_mt='\s*'; foreach (@$block) { - $word=$_; + $word=$_; if ( $word =~ s/^%/%$comment/ ) { # a comment if ($cmd==1) { push (@$retval,$closecmd) ; $cmd=-1; } - push (@$retval,$word); + push (@$retval,$word); next; } if ( $word =~ m/^\s*$/ ) { ### print STDERR "DEBUG MARKTAGS: whitespace detected |$word| cmdcom |$cmdcomment| |$opencmd|\n" if $debug; # a sequence of white-space characters - this should only ever happen for the first element of block. - # in deleted block, omit, otherwise just copy it in + # in deleted block, omit, otherwise just copy it in if ( ! $cmdcomment) { # ignore in deleted blocks push(@$retval,$word); } next; } if (! $noncomment) { - push (@$retval,$openmark); + push (@$retval,$openmark); $noncomment=1; } # negative lookahead pattern (?!) in second clause is put in to avoid matching \( .. \) patterns @@ -2283,7 +2319,7 @@ sub marktags { # word is a command or other significant token (not in SAFECMDLIST) ## same conditions as in subroutine extractcommand: # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: cmd @@ -2300,11 +2336,11 @@ sub marktags { # Condition 3: But if we are in a deleted block ($cmdcomment=1) and # $2 (the command) is in context2, just treat it as an ordinary command (i.e. comment it open with $opencmd) # Because we do not want to disable this command - # here we do not use $opencmd and $closecmd($opencmd is empty) + # here we do not use $opencmd and $closecmd($opencmd is empty) print STDERR "DEBUG: Detected text |$word| but not safe command \$2: $2 \$3: $3\n." if $debug; if ($cmd==1) { push (@$retval,$closecmd) ; - } elsif ($cmd==0) { + } elsif ($cmd==0) { push (@$retval,$close) ; } $command=$1; $commandword=$2; $closingbracket=$4; @@ -2320,16 +2356,16 @@ sub marktags { # for latexrevise push (@$retval,$command,"%\n{$AUXCMD\n",marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } elsif ( iscmd($commandword,,\@MATHTEXTCMDLIST, \@MATHTEXTCMDEXCL) ) { - # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) - # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to + # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) + # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to # "" - local @SAFECMDLIST=(".*"); + local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { # normal textcmd or context1cmd in an added block - push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); + push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } push (@$retval,$AUXCMD,"\n") if $cmdcomment ; $cmd=-1 ; @@ -2415,10 +2451,10 @@ sub take_comments_and_newline_from_frac() { # names or labels but it does not matter because they are converted back in the postprocessing step # Returns: leading white space removed in step 1 sub preprocess { - for (@_) { + for (@_) { - # change in \verb and similar commands - note that I introduce an extra space here so that the + # change in \verb and similar commands - note that I introduce an extra space here so that the # already hashed variants do not trigger again # transform \lstinline{...} # s/\\lstinline(\[$brat0\])?(\{(?:.*?)\})/"\\DIFlstinline". $1 ."{". tohash(\%verbhash,"$2") ."}"/esg; @@ -2448,7 +2484,7 @@ sub preprocess { 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$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 ; @@ -2468,16 +2504,16 @@ sub preprocess { if ( $mathmarkup != FINE ) { # DIFANCHORARRB and DIFANCHORARRE, DIFANCHORMATHB and DIFANCHORMATHE markers are inserted here to encourage the matching algorithm # to always match up the closing brace. Otherwise sometimes one ends up with a situation where - # the closing brace is deleted and added at another point. The deleted closing brace is then + # the closing brace is deleted and added at another point. The deleted closing brace is then # prevented by a %DIFDELCMD, leading to material leaking in or out of the math environment. # The anchors are removed in post-processing again. (note that they are simple text to cause least amount of complications - # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to + # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to # resort to WHOLE or FINE, or NONE math mode processing. s/\\begin\{($ARRENV)}(.*?)\\end\{\1}/\\ARRAYBLOCK$1\{$2\\DIFANCHORARRB \}\\DIFANCHORARRE /sg; take_comments_and_newline_from_frac(); - # Convert Math environments with arguments + # Convert Math environments with arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}((?:\[$brat_n\])|(?:\{$pat_n\}))+(.*?)\\end\{\1\}/\\MATHBLOCK$1\[$2\]\{$3\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; # Convert Math environments without arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\end\{\1\}/\\MATHBLOCK$1\{$2\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; @@ -2491,7 +2527,7 @@ sub preprocess { # $expanded=linecomment($string) #preface all lines with verbatim marker (usually DIFVRB) -sub linecomment { +sub linecomment { my @verbatimlines=split("\n",$_[0]); # the first line needs special treatment - we do want to retain optional arguments as is but wrap the remainder also with VERBCOMMENT ### print STDERR "DEBUG: before verbatimlines[0] = ",$verbatimlines[0],"\n"; @@ -2501,7 +2537,7 @@ sub linecomment { } # $simple=reverselinecomment($env $string) -# remove DIFVRB comments but leave changed lines marked +# remove DIFVRB comments but leave changed lines marked sub reverselinecomment { my ($environment, $verbatimtext)=@_; ### print STDERR "DEBUG REVERSELINECOMMENT input: $environment,|$verbatimtext|\n" if $debug; @@ -2516,7 +2552,7 @@ sub reverselinecomment { $verbatimtext =~ s/\\DIFdelend //g; $verbatimtext =~ s/$DELCMDOPEN.*//g; - # remove DIFVRB mark + # remove DIFVRB mark $verbatimtext=~ s/%$VERBCOMMENT//g; # remove part of the markup in changed lines @@ -2607,7 +2643,7 @@ sub writedebugfile { # * Remove STOP token from the end # * Replace \RIGHTBRACE by } # * If option --no-del is set delete all deleted blocks -# 1. Check all deleted blocks: +# 1. Check all deleted blocks: # a.where a deleted block contains a matching \begin and # \end environment (these will be disabled by a %DIFDELCMD statements), for selected environments enable # these commands again (such that for example displayed math in a deleted equation @@ -2628,14 +2664,14 @@ sub writedebugfile { # For added blocks: # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es # d. place \cite commands in mbox'es (for UNDERLINE style) -# +# # 2. If math-mode COARSE,WHOLE or NONE option set: Convert \MATHBLOCKmath{..} commands back to environments # # Convert all PICTUREblock{..} commands back to the appropriate environments # 3. Convert DIFadd, DIFdel, DIFaddbegin , ... into FL varieties # within floats (currently recognised float environments: plate,table,figure # plus starred varieties). -# 4. Remove empty %DIFDELCMD < lines +# 4. Remove empty %DIFDELCMD < lines # 4. Convert \begin{SQUAREBRACKET} \end{SQUAREBRACKET} into \[ \] # Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} @@ -2648,7 +2684,7 @@ sub writedebugfile { # 4, undo renaming of the \begin, \end,{,} in comments # Change \QLEFTBRACE, \QRIGHTBRACE,\AMPERSAND to \{,\},\& # -# Note have to manually synchronize substitution commands below and +# Note have to manually synchronize substitution commands below and # DIF.. command names in the header sub postprocess { my ($begin,$len,$float,$delblock,$addblock); ### $cnt @@ -2660,7 +2696,7 @@ sub postprocess { my (@itemargs, $itemarg); - for (@_) { + for (@_) { # change $'s in comments to something harmless 1 while s/(%.*)\$/$1DOLLARDIF/mg ; @@ -2670,7 +2706,7 @@ sub postprocess { # the only way to get these is as %DIFDELCMD < \RIGHTBRACE construction # This essentially marks closing right braces of MATHBLOCK environments, which did not get matched # up. This case should be rare, so I just leave this in the diff file output. Not really elegant - # but can still be dealt with later if it results in problems. + # but can still be dealt with later if it results in problems. s/%DIFDELCMD < \\RIGHTBRACE/%DIFDELCMD < \\MBLOCKRIGHTBRACE/g ; # Replace \RIGHTBRACE by } s/\\RIGHTBRACE/}/g; @@ -2698,7 +2734,7 @@ sub postprocess { $len=length($&); $begin=pos($_) - $len; $delblock=$&; - ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following + ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following ### this strategy: ### 1. a Insert aux commands \begin{MATHMODE} or \end{MATHMODE} for all deleted commands opening or closing displayed math mode ### b Insert aux commands \begin{MATHARRMODE} or \end{MATHARRMODE} for all deleted commands opening or closing math array mode @@ -2724,14 +2760,14 @@ sub postprocess { ###0.5: $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end\{MATHMODE\}$AUXCMD\n$1$3\n\\begin\{MATHMODE\}$AUXCMD\n$4/sg; - # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\begin{$MATHREPL}$AUXCMD\n/sg ) { ### print STDERR "BINGO: begin block: \nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug ; $delblock =~ s/(\\DIFdelend$)/\\end{$MATHREPL}$AUXCMD\n$1/s ; ### print STDERR "After: |" . $delblock . "|\n\n" if $debug ; } - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end\{MATHMODE\}$AUXCMD\n/sg ) { ### print STDERR "BINGO: end block:\nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug; @@ -2754,15 +2790,15 @@ sub postprocess { $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; ### print STDERR "STEP1: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{($MATHARRENV)\}(.*?)(?:$DELCMDCLOSE|\n))/$1\\begin{$2*}$3$AUXCMD\n/sg ) { $arrenv=$2; - $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}}$AUXCMD\n$1/s ; + $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}$AUXCMD\n$1/s ; } ### print STDERR "STEP2: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end{MATHMODE}$AUXCMD\n/sg ) { $delblock =~ s/(\\DIFdelend$)/\\begin{MATHMODE}$AUXCMD\n$1/s ; @@ -2780,7 +2816,7 @@ sub postprocess { ### $eqarrayblock=~ s/(\%DIFDELCMD < \s*(\&|\\\\)\s*?(?:$DELCMDCLOSE|\n))/$1$2$AUXCMD\n/sg ; $eqarrayblock =~ s/(\%DIFDELCMD < (.*?(?:\&|\\\\).*)(?:$DELCMDCLOSE|\n))/ # The pattern captures comments with at least one of & or \\ - @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence + @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence @symbols= grep ( m@&|\\\\\s*@, @symbols); # select & and \\ (and subsequent spaces) "$1@symbols$AUXCMD\n" /eg ; @@ -2793,7 +2829,7 @@ sub postprocess { } elsif ( $mathmarkup == COARSE || $mathmarkup == WHOLE ) { # 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 their starred variety + # will be replaced by their starred variety $delblock=~ s/\\MATHBLOCK($MATHENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$MATHREPL$2\{$3\}/sg; $delblock=~ s/\\MATHBLOCK($MATHARRENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$1\*$2\{$3\}/sg; } @@ -2807,10 +2843,10 @@ sub postprocess { print STDERR "DELBLOCK after maths processing: |" . $delblock . "|\n\n" if $debug ; - # Reinstate completely deleted list environments. note that items within the + # 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 + ### # 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; @@ -2844,7 +2880,7 @@ sub postprocess { ### if ($CITE2CMD) { ###### ${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})) .*?%%%\n ### $delblock=~s/($DELCMDOPEN\s*\\($CITE2CMD)(.*)$DELCMDCLOSE)/ - ### # Replacement code + ### # Replacement code ### {my ($aux,$all); ### $aux=$all=$1; ### $aux=~s#\n?($DELCMDOPEN|$DELCMDCLOSE)##g; @@ -2854,7 +2890,7 @@ sub postprocess { ### if ($CITECMD) { ###### $delblock=~s/(\\($CITECMD)${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; ### $delblock=~s/(\\($CITECMD)${extraspace}(?:<$abrat0>${extraspace})?(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; - ### } + ### } # if MBOXINLINEMATH is set, protect inlined math environments with an extra mbox @@ -2862,7 +2898,7 @@ sub postprocess { # note additional \newline after command is omitted from output if right at the end of deleted block (otherwise a spurious empty line is generated) $delblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { ### # change included verbatim environments ### $delblock =~ s/\\DIFverb\{/\\DIFDIFdelverb\{/g; ### $delblock =~ s/\\DIFlstinline/\\DIFDIFdellstinline/g; @@ -2904,7 +2940,7 @@ sub postprocess { ##$addblock=~s/($math)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; $addblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { # mark added verbatim commands $addblock =~ s/\\DIFverb/\\DIFDIFaddverb/g; $addblock =~ s/\\DIFlstinline/\\DIFDIFaddlstinline/g; @@ -2922,11 +2958,11 @@ 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. + # 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\})/ ; + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; @liststack=(); - @newtextparts=map { + @newtextparts=map { ### print STDERR ":::::::: $_\n"; if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; @@ -2942,7 +2978,7 @@ sub postprocess { } 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 + # 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 @@ -2955,17 +2991,17 @@ sub postprocess { # Replace MATHMODE environments from step 1a above by the correct Math environment and remove unncessary pairings - + if ( $mathmarkup == FINE ) { # look for AUXCMD math-mode pairs which have only comments (or empty lines between them), and remove the added commands # \begin{..} ... \end{..} pairs - s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; + s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; # \end{..} .... \begin{..} pairs - s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; + s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; writedebugfile($_,'postprocess15'); # The next line is complicated. The negative look-ahead insertion makes sure that no \end{$MATHENV} (or other mathematical - # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching + # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching # is not globally minimal but only 'locally' (matching is beginning from the left side of the string) # [NB: Do not be tempted to prettify the expression with /x modified. It seems this is applied after strings are expanded so will ignore spaces in strings 1 while s/(?<!$DELCMDOPEN)\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:${DELCMDOPEN}[^\n]*|.(?!(?:\\end\{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin\{MATHMODE})))*?)\\end\{MATHMODE}/\\begin{$1}$2\\end{$1}/s; @@ -3040,7 +3076,7 @@ sub postprocess { # remove empty DIFCMD < lines s/^\Q${DELCMDOPEN}\E\n//msg; - # Expand hashes of verb and verbatim environments + # Expand hashes of verb and verbatim environments s/${DELCMDOPEN}\\($VERBATIMENV)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg; # revert changes to verbatim environments for line diffs (and add code to mark up changes) (note negative look behind assertions to not leak out of DIFDELCMD comments) # Example: @@ -3066,8 +3102,8 @@ sub postprocess { ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E[^\n]*?\n)*) # Deleted \end command of verbatim environment. Note that the type is forced to match the opening. Captures: $5: Whole deleted environment (previous way this line was written: (\Q$DELCMDOPEN\E\\end\{\2\}(?:\n|\s|\Q$DELCMDOPEN\E)*\Q$DELCMDCLOSE\E) (\Q$DELCMDOPEN\E\\end\{\2\}) - / # Substitution part - $1 # Leave expression as is + / # Substitution part + $1 # Leave expression as is . "$AUXCMD NEXT\n" # Mark the following line as an auxiliary command . "" # reinstate the original environment without options . reverselinecomment($2, "$3$4") # modify the body to change the markup; reverselinecomment parses for options @@ -3076,7 +3112,7 @@ sub postprocess { /esgx; # Modifiers of substitution command writedebugfile($_,'postprocess2'); # where changes have occurred in verbatim environment, change verbatim to DIFverbatim to allow mark-up - # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim + # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim # environment does not take optional arguments) s/(?<!$DELCMDOPEN)\\begin\{(verbatim[*]?)\}(\[$brat_n\].*?)\\end\{\1\}/\\begin{DIF$1}$2\\end{DIF$1}/sg; @@ -3090,7 +3126,7 @@ sub postprocess { # convert remaining PAR commands (which are preceded by non-white space characters, usually "}" ($ADDCLOSE) s/\\PAR\n/\n\n/sg; - # package specific processing: + # package specific processing: if ( defined($packages{"endfloat"})) { #endfloat: make sure \begin{figure} and \end{figure} are always # on a line by themselves, similarly for table environment @@ -3103,12 +3139,16 @@ sub postprocess { s/^((?:[^%]+)\\(?:begin|end)\{(?:figure|table)\}(?:\[[a-zA-Z]+\])?)(.+)((?:%.*)?)$/$1\n$2$3/mg; } - # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated + # Remove empty auxiliary LISTENV (sometmes these are generated if list environment occurs within the argument of a deleted comment) + # (slightly hacky but I could not see an easy way to see if in argument of another command when this extra markup is added) + s/\\begin\{($LISTENV)\}$AUXCMD\n((?:\s*\%[^\n]*\n)*\n?)\\end\{\1\}$AUXCMD\n/$2\n/msg ; + + # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated s/\\PERCENTAGE ?/\\%/g; - # Convert '\DOLLAR ' back into '\$' + # Convert '\DOLLAR ' back into '\$' s/\\DOLLAR /\\\$/g; - # undo renaming of the \begin and \end,{,} and dollars in comments + # undo renaming of the \begin and \end,{,} and dollars in comments # although we only renamed $ in comments to DOLLARDIFF, we might have lost the % in unchanged verbatim blocks, so rename all s/DOLLARDIF/\$/g; @@ -3126,7 +3166,7 @@ sub postprocess { # 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/(%.*)\\CFRAC (.*)$/$1\\frac$2/mg ; 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -3137,7 +3177,7 @@ sub postprocess { s/\\QRIGHTBRACE /\\\}/sg; s/\\AMPERSAND /\\&/sg; # Highlight added inline verbatim commands if possible - if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { + if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { # wrap added verb commands with color commands s/\\DIFDIFadd((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*)/\{\\color{blue}$AUXCMD\n\\DIF$1%\n\}$AUXCMD\n/sg; s/\\DIFDIFdel((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*$AUXCMD)/\{\\color{red}${AUXCMD}\n\\DIF$1\n\}${AUXCMD}/sg; @@ -3152,8 +3192,8 @@ sub postprocess { # finally add the comment to the ones not having an optional argument before ###s/\\DIFaddlstinline(?!\[)/\\lstinline\n[basicstyle=\\color{blue}]$AUXCMD\n/g; - return; } + return; } # $out = restore_item_commands($listenviron) @@ -3177,13 +3217,13 @@ sub restore_item_commands { # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) - # the list of commands is defined in CONTEXT2CMD - # if found then use a bodydiff to mark up content, and replace the corresponding commands + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # the list of commands is defined in CONTEXT2CMD + # if found then use a bodydiff to mark up content, and replace the corresponding commands # in both preambles by marked up version to 'fool' the linediff (such that only body is marked up). # A special case are e.g. author commands being added (or removed) # 1. If commands are added, then the entire content is marked up as new, but also the lines are marked as new in the linediff - # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns + # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns # with $auxlines a text to be appended at the end of the preamble, which shows the respective fields as deleted sub preprocess_preamble { my ($oldpreambleref,$newpreambleref)=(\$_[0],\$_[1]) ; @@ -3205,7 +3245,7 @@ EOF $titlecmd = "(?:".join("|",@CONTEXT2CMDLIST).")"; # as context2cmdlist is stored as regex, e.g. ((?-xism:^title$), we need to remove ^- fo # resue in a more complex regex - $titlecmd =~ s/[\$\^]//g; + $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat_n)\])?(?:\{($pat_n)\}))/ms; ###print STDERR "DEBUG:",$titlecmdpat,"\n"; @@ -3231,7 +3271,7 @@ EOF $cmd=shift @newtitlecommands; $optarg=shift @newtitlecommands; $arg=shift @newtitlecommands; - + if ( defined($newhash{$cmd})) { warn "$cmd is used twice in preamble of new file. Reverting to pure line diff mode for preamble.\n"; print STDERR $warnmsgdetail; @@ -3258,7 +3298,7 @@ EOF } $argnew=$newhash{$cmd}->[2]; $argdiff="{" . join("",bodydiff($argold,$argnew)) ."}"; - # Replace \RIGHTBRACE by } + # Replace \RIGHTBRACE by } $argdiff =~ s/\\RIGHTBRACE/}/g; if ( length $optargnew ) { @@ -3273,7 +3313,7 @@ EOF $optargdiff=""; } ### print STDERR "DEBUG s/\\Q$newhash{$cmd}->[0]\\E/\\$cmd$optargdiff$argdiff/s\n"; - # Note: \Q and \E force literal interpretation of what it between them but allow + # Note: \Q and \E force literal interpretation of what it between them but allow # variable interpolation, such that e.g. \title matches just that and not TAB-itle $$newpreambleref=~s/\Q$newhash{$cmd}->[0]\E/\\$cmd$optargdiff$argdiff/s; # replace this in old preamble if necessary @@ -3313,7 +3353,7 @@ EOF #%< old deleted line(s) #%DIF ------- #%DIF mmann-nn -#new appended line %< +#new appended line %< #%DIF ------- # Future extension: mark change explicitly # Assumes: traverse_sequence traverses deletions before insertions in changed sequences @@ -3325,9 +3365,9 @@ sub linediff { my $block = []; my $retseq = []; my @begin=('','',''); # dummy initialisation - my $instring ; + my $instring ; - my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; + my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; push(@$block, "%DIF < " . $seq1->[$_[0]]) }; my $add = sub { if (! scalar @$block) { @begin=('a',$_[0],$_[1]) ;} @@ -3342,12 +3382,12 @@ sub linediff { $instring = sprintf "%%DIF %da%d-%d",$begin[1],$begin[2],$_[1]-1; } elsif ( $begin[0] eq 'c' ) { $instring = sprintf "%%DIF %sc%s", - ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , + ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , ($begin[2]==$_[1]-1) ? "$begin[2]" : $begin[2]."-".($_[1]-1) ; } else { $instring = sprintf "%%DIF %d%s%d",$begin[1],$begin[0],$begin[2]; } - push @$retseq, $instring,@$block, "%DIF -------" ; - $block = []; + push @$retseq, $instring,@$block, "%DIF -------" ; + $block = []; } push @$retseq, $seq2->[$_[1]] }; @@ -3355,7 +3395,7 @@ sub linediff { my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - push @$retseq, @$block if scalar @$block; + push @$retseq, @$block if scalar @$block; return wantarray ? @$retseq : $retseq ; } @@ -3365,23 +3405,23 @@ sub linediff { # init_regex_arr_data(\@array,"TOKEN INIT") # scans DATA file handel for line "%% TOKEN INIT" line # then appends each line not beginning with % into array (as a quoted regex) -# This is used for command lists and configuration variables, but the processing is slightly -# different: +# This is used for command lists and configuration variables, but the processing is slightly +# different: # For lists, the regular expression is extended to include beginning (^) and end ($) markers, to require full-string matching # For configuration variables (and all others), simply an unadorned list is copied sub init_regex_arr_data { my ($arr,$token)=@_; my $copy=0; my ($mode); - if ($token =~ m/COMMANDS/ ) { - $mode=0; # Reading command list + if ($token =~ m/COMMANDS/ ) { + $mode=0; # Reading command list } else { $mode=1; # Reading configuration variables } while (<DATA>) { if ( m/^%%BEGIN $token\s*$/ ) { - $copy=1; + $copy=1; next; } elsif ( m/^%%END $token\s*$/ ) { last; } @@ -3462,17 +3502,18 @@ sub exetime { sub usage { - print STDERR <<"EOF"; + print STDERR <<"EOF"; Usage: $0 [options] old.tex new.tex > diff.tex -Compares two latex files and writes tex code to stdout, which has the same format as new.tex but +Compares two latex files and writes tex code to stdout, which has the same format as new.tex but has all changes relative to old.tex marked up or commented. Note that old.tex and new.tex need to -be real files (not pipes or similar) as they are opened twice. +be real files (not pipes or similar) as they are opened twice. --type=markupstyle -t markupstyle Add code to preamble for selected markup style - Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE + Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT + LUAUNDERLINE [ Default: UNDERLINE ] --subtype=markstyle @@ -3483,7 +3524,7 @@ be real files (not pipes or similar) as they are opened twice. * LABEL subtype is deprecated --floattype=markstyle --f markstyle Add code to preamble for selected style which +-f markstyle Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats so marginal marking can be disabled thus) @@ -3492,11 +3533,11 @@ be real files (not pipes or similar) as they are opened twice. --encoding=enc -e enc Specify encoding of old.tex and new.tex. Typical encodings are - ascii, utf8, latin1, latin9. A list of available encodings can be - obtained by executing + ascii, utf8, latin1, latin9. A list of available encodings can be + obtained by executing perl -MEncode -e 'print join ("\\n",Encode->encodings( ":all" )) ;' [Default encoding is utf8 unless the first few lines of the preamble contain - an invocation "\\usepackage[..]{inputenc} in which case the + an invocation "\\usepackage[..]{inputenc} in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -3513,22 +3554,22 @@ be real files (not pipes or similar) as they are opened twice. --exclude-safecmd=exclude-file --exclude-safecmd="cmd1,cmd2,..." --A exclude-file +-A exclude-file --replace-safecmd=replace-file --append-safecmd=append-file --append-safecmd="cmd1,cmd2,..." -a append-file Exclude from, replace or append to the list of regex - matching commands which are safe to use within the + matching commands which are safe to use within the scope of a \\DIFadd or \\DIFdel command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are ignored). A literal comma within the comma-separated list must be - escaped thus "\\,", Note that the RegEx needs to match the whole of + escaped thus "\\,", Note that the RegEx needs to match the whole of the token, i.e., /^regex\$/ is implied and that the initial "\\" of the command is not included. The --exclude-safecmd - and --append-safecmd options can be combined with the --replace-safecmd + and --append-safecmd options can be combined with the --replace-safecmd option and can be used repeatedly to add cumulatively to the lists. ---exclude-textcmd=exclude-file +--exclude-textcmd=exclude-file --exclude-textcmd="cmd1,cmd2,..." -X exclude-file --replace-textcmd=replace-file @@ -3544,7 +3585,7 @@ be real files (not pipes or similar) as they are opened twice. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. \\caption will only work within a figure - or table. These commands behave like text commands, except when + or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. @@ -3554,7 +3595,7 @@ be real files (not pipes or similar) as they are opened twice. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. - context2 commands are also the only commands in the preamble, whose argument will + context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). @@ -3563,15 +3604,15 @@ be real files (not pipes or similar) as they are opened twice. --append-mboxsafecmd=append-file --append-mboxsafecmd="cmd1,cmd2,..." Define safe commands, which additionally need to be protected by encapsulating - in an \\mbox{..}. This is sometimes needed to get around incompatibilities + in an \\mbox{..}. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE - + --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. --c configfile Available variables: +-c configfile Available variables: ARRENV (RegEx) COUNTERCMD (RegEx) FLOATENV (RegEx) @@ -3590,15 +3631,15 @@ be real files (not pipes or similar) as they are opened twice. --add-to-config varenv1=pattern1,varenv2=pattern2 For configuration variables containing a regular expression (essentially those ending - in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration + in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. varenv must be one of the variables listed above that take a regular - expression as argument, and pattern is any regular expression (which might need to be + expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. --add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote" --packages=pkg1,pkg2,.. - Tell latexdiff that .tex file is processed with the packages in list + Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the preamble, as the preamble is automatically scanned for \\usepackage commands. Use of the --packages option disables automatic scanning, so if for any @@ -3619,57 +3660,57 @@ be real files (not pipes or similar) as they are opened twice. --show-all Show all of the above - NB For all --show commands, no old.tex or new.tex file needs to be given, and no + NB For all --show commands, no old.tex or new.tex file needs to be given, and no differencing takes place. Other configuration options: --allow-spaces Allow spaces between bracketed or braced arguments to commands - [Default requires arguments to directly follow each other without + [Default requires arguments to directly follow each other without intervening spaces] --math-markup=level Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): - off or 0: suppress markup for math environments. Deleted equations will not - appear in diff file. This mode can be used if all the other modes + off or 0: suppress markup for math environments. Deleted equations will not + appear in diff file. This mode can be used if all the other modes cause invalid latex code. whole or 1: Differencing on the level of whole equations. Even trivial changes - to equations cause the whole equation to be marked changed. This - mode can be used if processing in coarse or fine mode results in + to equations cause the whole equation to be marked changed. This + mode can be used if processing in coarse or fine mode results in invalid latex code. coarse or 2: Detect changes within equations marked up with a coarse - granularity; changes in equation type (e.g.displaymath to equation) + granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] fine or 3: Detect small change in equations and mark up and fine granularity. This mode is most suitable, if only minor changes to equations are - expected, e.g. correction of typos. + expected, e.g. correction of typos. --graphics-markup=level Change highlight style for graphics embedded with \\includegraphics commands Possible values for level: none,off or 0: no highlighting for figures new-only or 1: surround newly added or changed figures with a blue frame [Default] - both or 2: highlight new figures with a blue frame and show deleted figures + both or 2: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. - Note that changes to the optional parameters will make the figure appear as changed + Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \\noalign" errors can occur if there are certain types - of changes in tables. In this case please use option --graphics-markup=none as a - work-around. + of changes in tables. In this case please use option --graphics-markup=none as a + work-around. ---no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, +--no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, but the deleted text ist not just invisible in the output, it is also not included in the - diff text file. This can be more robust than just making it invisible. + diff text file. This can be more robust than just making it invisible. ---disable-citation-markup ---disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles +--disable-citation-markup +--disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) --enable-citation-markup ---enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections +--enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections with \\mbox command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -3685,14 +3726,14 @@ Miscellaneous options --no-label Suppress inclusion of old and new file names as comment in output file ---visible-label Include old and new filenames (or labels set with --label option) as +--visible-label Include old and new filenames (or labels set with --label option) as visible output --flatten Replace \\input and \\include commands within body by the content of the files in their argument. If \\includeonly is present in the - preamble, only those files are expanded into the document. However, - no recursion is done, i.e. \\input and \\include commands within - included sections are not expanded. The included files are assumed to + preamble, only those files are expanded into the document. However, + no recursion is done, i.e. \\input and \\include commands within + included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further @@ -3715,7 +3756,7 @@ Miscellaneous options -h Show this help text. --ignore-warnings Suppress warnings about inconsistencies in length between input - and parsed strings and missing characters. + and parsed strings and missing characters. --verbose -V Output various status information to stderr during processing. @@ -3727,10 +3768,10 @@ Internal options: These options are mostly for automated use by latexdiff-vc. They can be used directly, but the API should be considered less stable than for the other options. ---no-links Suppress generation of hyperreferences, used for minimal diffs +--no-links Suppress generation of hyperreferences, used for minimal diffs (option --only-changes of latexdiff-vc). EOF - exit 0; + exit 0; } =head1 NAME @@ -3756,8 +3797,8 @@ be real files (not pipes or similar) as they are opened twice (unless C<--encodi The program treats the preamble differently from the main document. Differences between the preambles are found using line-based differencing (similarly to the Unix diff command, but ignoring white -spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a -line present in C<new.tex> but not in C<old.tex>. Discarded lines +spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a +line present in C<new.tex> but not in C<old.tex>. Discarded lines are deactivated by prepending "S<C<%DIF E<lt>>>". Changed blocks are preceded by comment lines giving information about line numbers in the original files. Where there are insignificant differences, the resulting file C<diff.tex> will be similar to @@ -3810,7 +3851,7 @@ curly braces immediately following a command (i.e. a sequence of letters beginning with a backslash) are arguments for that command. As a restriction to condition 1 above it is thus necessary to surround all arguments with curly braces, and to not insert -extraneous spaces. For example, write +extraneous spaces. For example, write \section{\textem{This is an emphasized section title}} @@ -3842,7 +3883,7 @@ but the choice is yours. Any markup within the environment will be removed, and generally everything within the environment will just be taken from the new file. -It is also possible to difference files which do not have a preamble. +It is also possible to difference files which do not have a preamble. In this case, the file is processed in the main document mode, but the definitions of the markup commands are not inserted. @@ -3860,7 +3901,7 @@ the scope of C<\DIFadd>. Added comments are marked by prepending Within deleted blocks text is highlighted with C<\DIFdel>. Deleted comments are marked by prepending "S<C<%DIF E<lt> >>". Non-safe command -and curly braces within deleted blocks are commented out with +and curly braces within deleted blocks are commented out with "S<C<%DIFDELCMD E<lt> >>". @@ -3870,7 +3911,7 @@ and curly braces within deleted blocks are commented out with =head2 Preamble The following options determine the visual markup style by adding the appropriate -command definitions to the preamble. See the end of this section for a description of +command definitions to the preamble. See the end of this section for a description of available styles. =over 4 @@ -3880,15 +3921,16 @@ B<-t markupstyle> Add code to preamble for selected markup style. This option defines C<\DIFadd> and C<\DIFdel> commands. -Available styles: +Available styles: -C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE -CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT> +C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE +CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT +LUAUNDERLINE> [ Default: C<UNDERLINE> ] =item B<--subtype=markstyle> or -B<-s markstyle> +B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines @@ -3901,27 +3943,27 @@ Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> =item B<--floattype=markstyle> or B<-f markstyle> -Add code to preamble for selected style which +Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats -so marginal marking can be disabled thus). This option defines all +so marginal marking can be disabled thus). This option defines all C<\DIF...FL> commands. Available styles: C<FLOATSAFE TRADITIONALSAFE IDENTICAL> [ Default: C<FLOATSAFE> ] -=item B<--encoding=enc> or +=item B<--encoding=enc> or B<-e enc> Specify encoding of old.tex and new.tex. Typical encodings are -C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be -obtained by executing +C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be +obtained by executing C<perl -MEncode -e 'print join ("\n",Encode->encodings( ":all" )) ;' > If this option is used, then old.tex, new.tex are only opened once. [Default encoding is utf8 unless the first few lines of the preamble contain -an invocation C<\usepackage[..]{inputenc}> in which case the +an invocation C<\usepackage[..]{inputenc}> in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -3938,7 +3980,7 @@ C<\DIFaddbeginFL, \DIFaddendFL, \DIFaddFL{..}, (If this option is set B<-t>, B<-s>, and B<-f> options are ignored.) -=item B<--packages=pkg1,pkg2,..> +=item B<--packages=pkg1,pkg2,..> Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the @@ -3949,13 +3991,13 @@ The following packages trigger special behaviour: =over 8 -=item C<endfloat> +=item C<endfloat> Ensure that C<\begin{figure}> and C<\end{figure}> always appear by themselves on a line. =item C<hyperref> -Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and +Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and define new C<\DIFadd> and C<\DIFdel> commands, which provide a wrapper for these commands, using them for the text but not for the link defining command (where any markup would cause errors). @@ -4007,17 +4049,17 @@ B<-A exclude-file> or B<--exclude-safecmd="cmd1,cmd2,..."> =item B<--replace-safecmd=replace-file> -=item B<--append-safecmd=append-file> or +=item B<--append-safecmd=append-file> or B<-a append-file> or B<--append-safecmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions (RegEx) -matching commands which are safe to use within the +matching commands which are safe to use within the scope of a C<\DIFadd> or C<\DIFdel> command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are -ignored). Note that the RegEx needs to match the whole of +ignored). Note that the RegEx needs to match the whole of the token, i.e., /^regex$/ is implied and that the initial -"\" of the command is not included. -The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> +"\" of the command is not included. +The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> option and can be used repeatedly to add cumulatively to the lists. B<--exclude-safecmd> and B<--append-safecmd> can also take a comma separated list as input. If a @@ -4030,7 +4072,7 @@ B<-X exclude-file> or B<--exclude-textcmd="cmd1,cmd2,..."> =item B<--replace-textcmd=replace-file> -=item B<--append-textcmd=append-file> or +=item B<--append-textcmd=append-file> or B<-x append-file> or B<--append-textcmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions @@ -4038,7 +4080,7 @@ matching commands whose last argument is text. See entry for B<--exclude-safecmd> directly above for further details. -=item B<--replace-context1cmd=replace-file> +=item B<--replace-context1cmd=replace-file> =item B<--append-context1cmd=append-file> or @@ -4047,11 +4089,11 @@ entry for B<--exclude-safecmd> directly above for further details. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. C<\caption> will only work within a figure -or table. These commands behave like text commands, except when +or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. -=item B<--replace-context2cmd=replace-file> +=item B<--replace-context2cmd=replace-file> =item B<--append-context2cmd=append-file> or @@ -4061,9 +4103,9 @@ As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. -context2 commands are also the only commands in the preamble, whose argument will be processed in +context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). The algorithm currently cannot cope with repeated context2 commands in the preamble, as they occur e.g. for the C<\author> argument in some journal styles (not in the standard styles, though -If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. +If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. @@ -4072,7 +4114,7 @@ If such a repetition is detected, the whole preamble will be processed in line-b =item B<--append-mboxsafecmd=append-file> or B<--append-mboxsafecmd="cmd1,cmd2,..."> Define safe commands, which additionally need to be protected by encapsulating -in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities +in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE @@ -4086,7 +4128,7 @@ in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE 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): +Available variables (see below for further explanations): C<ARRENV> (RegEx) @@ -4116,10 +4158,10 @@ C<SCALEDELGRAPHICS> (Float) =item B<--add-to-config varenv1=pattern1,varenv2=pattern2,...> For configuration variables, which are a regular expression (essentially those ending -in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration +in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. C<varenv> must be one of the variables listed above that take a regular -expression as argument, and pattern is any regular expression (which might need to be +expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. C<--add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote"> @@ -4139,7 +4181,7 @@ Show values of configuration variables. Combine all --show commands. -NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no +NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no differencing takes place. =back @@ -4156,29 +4198,29 @@ might get lumpeded with preceding commands) so should only be used if the default produces erroneous results. (Default requires arguments to directly follow each other without intervening spaces). -=item B<--math-markup=level> +=item B<--math-markup=level> -Determine granularity of markup in displayed math environments: +Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): -C<off> or C<0>: suppress markup for math environments. Deleted equations will not -appear in diff file. This mode can be used if all the other modes +C<off> or C<0>: suppress markup for math environments. Deleted equations will not +appear in diff file. This mode can be used if all the other modes cause invalid latex code. C<whole> or C<1>: Differencing on the level of whole equations. Even trivial changes -to equations cause the whole equation to be marked changed. This -mode can be used if processing in coarse or fine mode results in +to equations cause the whole equation to be marked changed. This +mode can be used if processing in coarse or fine mode results in invalid latex code. C<coarse> or C<2>: Detect changes within equations marked up with a coarse -granularity; changes in equation type (e.g.displaymath to equation) +granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] C<fine> or C<3>: Detect small change in equations and mark up at fine granularity. This mode is most suitable, if only minor changes to equations are -expected, e.g. correction of typos. +expected, e.g. correction of typos. =item B<--graphics-markup=level> @@ -4190,33 +4232,33 @@ C<none>, C<off> or C<0>: no highlighting for figures C<new-only> or C<1>: surround newly added or changed figures with a blue frame [Default if graphicx package loaded] -C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced +C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. -Note that changes to the optional parameters will make the figure appear as changed +Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \noalign" error can occur if there are certain types -of changes in tables. In this case please use C<--graphics-markup=none> as a -work-around. +of changes in tables. In this case please use C<--graphics-markup=none> as a +work-around. -=item B<--no-del> +=item B<--no-del> -Suppress deleted text from the diff. It is similar in effect to the BOLD style, -but the deleted text ist not just invisible in the output, it is also not included in the diff text file. -This can be more robust than just making it invisible. +Suppress deleted text from the diff. It is similar in effect to the BOLD style, +but the deleted text ist not just invisible in the output, it is also not included in the diff text file. +This can be more robust than just making it invisible. =item B<--disable-citation-markup> or B<--disable-auto-mbox> -Suppress citation markup and markup of other vulnerable commands in styles +Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) =item B<--enable-citation-markup> or B<--enforce-auto-mbox> -Protect citation commands and other vulnerable commands in changed sections +Protect citation commands and other vulnerable commands in changed sections with C<\mbox> command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4262,18 +4304,18 @@ Suppress inclusion of old and new file names as comment in output file =item B<--visible-label> -Include old and new filenames (or labels set with C<--label> option) as +Include old and new filenames (or labels set with C<--label> option) as visible output. =item B<--flatten> Replace C<\input> and C<\include> commands within body by the content of the files in their argument. If C<\includeonly> is present in the -preamble, only those files are expanded into the document. However, -no recursion is done, i.e. C<\input> and C<\include> commands within -included sections are not expanded. The included files are assumed to +preamble, only those files are expanded into the document. However, +no recursion is done, i.e. C<\input> and C<\include> commands within +included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, -respectively, making it possible to organise files into old and new directories. +respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further C<\input> statements. Also handles files included by the import package (C<\import> and C<\subimport>), and C<\subfile> command. @@ -4320,7 +4362,7 @@ Suppress generation of hyperreferences, used for minimal diffs (option --only-ch =back -=head2 Predefined styles +=head2 Predefined styles =head2 Major types @@ -4333,9 +4375,14 @@ The major type determine the markup of plain text and some selected latex comman Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package). +=item C<LUAUNDERLINE> + +Added text is underlined and blue, discarded text is struck out and red +(Requires lua-ul package + LuaLaTeX). + =item C<CTRADITIONAL> -Added text is blue and set in sans-serif, and a red footnote is created for each discarded +Added text is blue and set in sans-serif, and a red footnote is created for each discarded piece of text. (Requires color package) =item C<TRADITIONAL> @@ -4376,13 +4423,13 @@ Added text is set in bold face, discarded is not shown. (also see --no-del optio =item C<PDFCOMMENT> -The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. +The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. =back =head2 Subtypes -The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) +The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) =over 10 @@ -4400,7 +4447,7 @@ from the intended position. An alternative way of marking added passages in blue, and deleted ones in red. (It is recommeneded to use instead the main types to effect colored markup, -although in some cases coloring with dvipscol can be more complete, for example +although in some cases coloring with dvipscol can be more complete, for example with citation commands). =item C<DVIPSCOL> @@ -4415,12 +4462,12 @@ although in some cases coloring with dvipscol can be more complete). can be used to highlight only changed pages, but requires post-processing. It is recommend to not call this option manually but use C<latexdiff-vc> with C<--only-changes> option. Alternatively, use the script given within preamble of diff files made using this style. -=item C<ONLYCHANGEDPAGE> +=item C<ONLYCHANGEDPAGE> also highlights changed pages, without the need for post-processing, but might not work reliably if there is floating material (figures, tables). -=item C<LABEL> +=item C<LABEL> is similar to C<ZLABEL>, but does not need the zref package and works less reliably (deprecated). @@ -4428,7 +4475,7 @@ is similar to C<ZLABEL>, but does not need the zref package and works less relia =head2 Float Types -Some of the markup used in the main text might cause problems when used within +Some of the markup used in the main text might cause problems when used within floats (e.g. figures or tables). For this reason alternative versions of all markup commands are used within floats. The float type defines these alternative commands. @@ -4455,7 +4502,7 @@ Make no difference between the main text and floats. =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 +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: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > @@ -4475,9 +4522,9 @@ C<|subsubsection|paragraph|subparagraph)> ] This option is for advanced users and allows definition of special versions of commands, which do not work as safe commands. Commands in C<CUSTOMDIFCMD> that occur in added or deleted blocks will be given an ADD or DEL prefix. -The prefixed versions of the command must be defined in the preamble, either by putting them +The prefixed versions of the command must be defined in the preamble, either by putting them in the preamble of at least the new file, or by creating a custom preamble file (Option --preamble). -For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that +For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that for the standard markup type, it is not satisfactory to define it as a safe command. Instead, a customised versions without underlining can be defined in the preamble: @@ -4491,7 +4538,7 @@ and then latexdiff should be invoked with the option C<-c CUSTOMDIFCMD=blindtext =item C<FLOATENV> -Environments whose name matches the regular expression in C<FLOATENV> are +Environments whose name matches the regular expression in C<FLOATENV> are considered floats. Within these environments, the I<latexdiff> markup commands are replaced by their FL variaties. @@ -4540,17 +4587,17 @@ If C<--graphics-markup=both> is chosen, C<SCALEDELGRAPHICS> is the factor, by wh =item C<VERBATIMENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: deleted content is commented out, new content is not marked up [ Default: S<C<comment> > ] =item C<VERBATIMLINEENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in line mode, and changes are marked up using the listings package. The markup style is set based on the chosen mains markup type (Option -t), or on an analysis of the preamble. -Note that "listings.sty" must be installed. If this file is not found the fallback solution is to +Note that "listings.sty" must be installed. If this file is not found the fallback solution is to treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV environments. [ Default: S<C<(?:verbatim[*]?|lstlisting> > ] @@ -4561,30 +4608,40 @@ treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV e =over 10 -=item Citations result in overfull boxes +=item Changed citations result in overfull boxes There is an incompatibility between the C<ulem> package, which C<latexdiff> uses for underlining and striking out in the UNDERLINE style, -the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> -command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have two possibilities. +the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> +command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have several possibilities. 1. Use C<CFONT> type markup (option C<-t CFONT>): If this markup is chosen, then changed citations are no longer marked up -with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. +with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. 2. Choose option C<--disable-citation-markup> which turns off the marking up of citations: deleted citations are no longer shown, and -added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older) - +added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older). For custom packages you can define the commands which need to be protected by C<\mbox> with C<--append-mboxsafecmd> and C<--excludemboxsafecmd> options (submit your lists of command as feature request at github page to set the default behaviour of future versions, see section 6) -=item Changes in complicated mathematical equations result in latex processing errors +3. If you are using luatex >= 1.12.0 you can use option LUAUNDERLINE that uses lua-ul instead of ulem for underlining, which does not have this problem (experimental feature). + +=item Changes in complicated mathematical equations result in latex processing errors. + +Try option C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. +=item Deleted parts in equations are not struck out but underlined. -=item How can I just show the pages where changes had been made +This is a limitation of the ulem package that implements the strike-out. If you use the amsmath package, then the strike-out command is redefined in such a way that deleted passages are wrapped with C<\text> command; adding C<\usepackage{amsmath}> to your preamble will trigger this behaviour. (If amsmath is not included directly, but imported by another package, latexdiff will not be able to detect its availability; in this case you can give latexdiff a hint with option C<--packages=amsmath>. -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 + +=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 package to be installed). +=item The character encoding breaks when running latexdiff from powershell. + +This problem is not limited to C<latexdiff> and has to do with the default settings of C<powershell> in Windows. It is recommended to use C<cmd> instead. + =back =head1 BUGS @@ -4597,13 +4654,13 @@ 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>, +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 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 latex, please send me those files, ideally edited to only contain the -offending passage as long as that still reproduces the problem. If your +offending passage as long as that still reproduces the problem. If your file relies on non-standard class files, you must include those. I will not look at examples where I have trouble to latex the original files. @@ -4614,24 +4671,24 @@ L<latexrevise>, L<latexdiff-vc> =head1 PORTABILITY I<latexdiff> does not make use of external commands and thus should run -on any platform supporting Perl 5.6 or higher. If files with encodings +on any platform supporting Perl 5.6 or higher. If files with encodings other than ASCII or UTF-8 are processed, Perl 5.8 or higher is required. The standard version of I<latexdiff> requires installation of the Perl package -C<Algorithm::Diff> (available from I<www.cpan.org> - +C<Algorithm::Diff> (available from I<www.cpan.org> - I<http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15>) but a stand-alone version, I<latexdiff-so>, which has this package inlined, is available, too. I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.3.3 -Copyright (C) 2004-2022 Frederik Tilmann +Version 1.3.4 +Copyright (C) 2004-2024 Frederik Tilmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 -Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, +Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, T. Connors, Sebastian Gouezel and many others. Thanks to the many people who sent in bug reports, feature suggestions, and other feedback. @@ -4902,13 +4959,14 @@ value underline sqrt (SUPER|SUB)SCRIPT -%%END TEXT COMMANDS +%%END TEXT COMMANDS %%BEGIN CONTEXT1 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. These commands behave like text commands, except when they occur in a deleted section, where they are disabled, but their argument is shown as deleted text. caption subcaption -%%END CONTEXT1 COMMANDS +multicolumn +%%END CONTEXT1 COMMANDS %%BEGIN CONTEXT2 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. @@ -4916,7 +4974,7 @@ title author date institute -%%END CONTEXT2 COMMANDS +%%END CONTEXT2 COMMANDS %% CONFIGURATION variabe defaults %%BEGIN LISTENV CONFIG @@ -4994,9 +5052,16 @@ verbatim[*]? \RequirePackage[normalem]{ulem} \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} -\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF END UNDERLINE PREAMBLE +%DIF LUAUNDERLINE PREAMBLE +\RequirePackage{lua-ul} +\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} +\providecommand{\DIFadd}[1]{{\protect\color{blue}\underLine{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\strikeThrough{#1}}} +%DIF END LUAUNDERLINE PREAMBLE + %DIF CTRADITIONAL PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \RequirePackage[stable]{footmisc} @@ -5168,7 +5233,7 @@ verbatim[*]? % To show only pages with changes (dvips/dvipdf) % latex diff.tex % latex diff.tex -% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi +% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi \typeout{Check comments in preamble of output for instructions how to show only pages where changes have been made} \usepackage[user,abspage]{zref} \newcount\DIFcounterb @@ -5188,10 +5253,10 @@ verbatim[*]? \RequirePackage{etoolbox} \RequirePackage{zref} % redefine label command to write immediately to aux file - page references will be lost -\makeatletter \let\oldlabel\label% Store \label -\renewcommand{\label}[1]{% Update \label to write to the .aux immediately -\zref@wrapper@immediate{\oldlabel{#1}}} -\makeatother +\makeatletter \let\oldlabel\label% Store \label +\renewcommand{\label}[1]{% Update \label to write to the .aux immediately +\zref@wrapper@immediate{\oldlabel{#1}}} +\makeatother \newbool{DIFkeeppage} \newbool{DIFchange} \boolfalse{DIFkeeppage} @@ -5209,7 +5274,7 @@ verbatim[*]? \providecommand{\DIFmodend}{\global\booltrue{DIFkeeppage}\global\boolfalse{DIFchange}} %DIF END ONLYCHANGEDPAGE PREAMBLE -%% FLOAT TYPES +%% FLOAT TYPES %DIF FLOATSAFE PREAMBLE \providecommand{\DIFaddFL}[1]{\DIFadd{#1}} @@ -5241,7 +5306,7 @@ verbatim[*]? %DIF END TRADITIONALSAFE PREAMBLE % see: -% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself +% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself %DIF HIGHLIGHTGRAPHICS PREAMBLE \RequirePackage{settobox} @@ -5287,6 +5352,15 @@ verbatim[*]? %% SPECIAL PACKAGE PREAMBLE COMMANDS +%% Redefine strike out command to wrap in text box if amsmath is used and markup style with ulem is used +%DIF AMSMATHULEM PREAMBLE +\makeatletter +\let\sout@orig\sout +\renewcommand{\sout}[1]{\ifmmode\text{\sout@orig{\ensuremath{#1}}}\else\sout@orig{#1}\fi} +\makeatother +%DIF END AMSMATHULEM PREAMBLE + + % Standard \DIFadd and \DIFdel are redefined as \DIFaddtex and \DIFdeltex % when hyperref package is included. %DIF HYPERREF PREAMBLE @@ -5389,7 +5463,7 @@ verbatim[*]? %DIF END DIFCODE_BOLD %DIF DIFCODE_PDFCOMMENT - + moredelim=[il][\color{white}\tiny]{\%DIF\ <\ }, moredelim=[il][\sffamily\bfseries]{\%DIF\ >\ } %DIF END DIFCODE_PDFCOMMENT diff --git a/support/latexdiff/latexdiff-fast b/support/latexdiff/latexdiff-fast index ff9a732bac..44d6005845 100755 --- a/support/latexdiff/latexdiff-fast +++ b/support/latexdiff/latexdiff-fast @@ -25,6 +25,21 @@ # # Note references to issue numbers are for the github repository of latexdiff: https://github.com/ftilmann/latexdiff # +# Version 1.3.4: +# New features: +# - Option to use lua-ul instead of ulem (for use with LuaLaTeX) (fix #17, #60, #188, #255, #270) +# Enhancement +# - If amsmath is detected as one of the included (based on idea in PR #263 contributed by github user xlucn +# Bug fix +# - sometimes the introduction of aux commands to show deleted lists or descriptions leaves in place empty auxiliary +# list environments, which would cause error messages (though skipping messages would result in a correct output pdf). +# These are now removed. +# - add more mboxsafecmd and safecmd commands for SIunitx to stay compatible with newer versionsof SIunitx (PR #283, fixing issue #282, contributed by github user joe6302413) +# - File added via --preamble option is no longer assumed to be ASCII, but read either with encoding as defined by --encoding option or using the encoding of the LOCALE (fixes issue #285 ) +# - multicolumn argument is now treated as text +# - when tikz-dependency package is used, \& is no longer a safe command as it has special meaning inside dependency environment. The fix is a little of a hack as really it should only be considered unsafe within dependency environment (fixes (mostly) issue #303 ) +# - listings package had trouble with non-ASCII chars. The encoding is now set (thanks to github user anka-213 for finding this). Fixes #304 +# # Version 1.3.3: # New features: # - Option --no-del to remove all deleted text (merge contributed by github user tdegeus PR #252, fixing issue #66 @@ -33,22 +48,22 @@ # - Abbreviations involving punctuations within them. They need special treatment because otherwise in some # circumstances the gnoring of white space differences in conjunction with merging according to MINWORDSBLOCK rule # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269). A few abbreviations -# are now hard-coded and treated as atomic: +# are now hard-coded and treated as atomic: # English: i.e., e.g. Deutsch: z.B. # (fixes issue #269) # - In WHOLE and COARSE math modes, now properly treat math environments with arguments such as \alignat. Fixes #251 -# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes -# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result -# in errors. (Partially) fixes issues #235 and #244. -# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a -# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which +# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes +# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result +# in errors. (Partially) fixes issues #235 and #244. +# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a +# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which # in amsmath (and with eqnarray) will result in the same environment but without line numbers. Config variable MATHARRREPL # is therefore (nearly) redundant, and a depracation warning is given when it is set. Reference to MATHARRREPL are have # been removed from the manual (there is one exception, when it's still being used: sometimes latexdiff can figure out # that there is a deleted array environment, but does not know which one. In this case, MATHARRREPL is still being used -# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). +# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). # Fixes issue #216 -# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. +# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. # Exclude \begin and \end in math environments in COARSE and WHOLE modes. Fixes #258. Fixes #109 # - --flatten now works for empty files. Fixes issue #242 # - improved processing of Chinese and Japanese texts in that splitting is done based on characters. Thanks to LuXu (Oliver Lew) in git for working this out. Fixes #229, fixes #145 @@ -65,7 +80,7 @@ # Bug fixes: # - fix issue #206 affecting proper markup of text commands which are not also safe cmd's and have multiple arguments # - fix issue #210 by adding \eqref (amsmath package) to the list of safe commands -# - fix bug reported in issue #168 mangled verbatim line environment +# - fix bug reported in issue #168 mangled verbatim line environment # - fix bug reported in issue #218 by replacing \hspace{0pt} after \mbox{..} auxiliary commands with \hskip0pt. # - more ways to process \frac correctly with atomic arguments (committed by julianuu PR #246 # - fix a bug in biblatex mode, which prevented proper processing of modified \textcite (see: https://tex.stackexchange.com/questions/555157/latexdiff-and-biblatex-citation-commands) @@ -74,10 +89,10 @@ # Version 1.3.1.1 # - remove spurious \n to fix error: Unknown regexp modifier "/n" at .../latexdiff line 1974, near "=~ " (see github issue #201) # -# Version 1.3.1 +# Version 1.3.1 # Bug fixes: # - remove some uninitialised variable $2 warnings in string substitution in flatten function in case included file is not found -# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) +# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) # - pre-processing: replace (contributed) routine take_comments_and_enter_from_frac() with take_comments_and_newline_from_frac(), which does the same thing # (remove whitespace characters and comments between the argument of \frac commands) in an easier and more robust way. In addition, it # will replace commands like \frac12 with \frac{1}{2} as pre-processing step. Fixes issue #184 @@ -95,15 +110,15 @@ # Version 1.3.0 (7 October 2018): # - treat options to \documentclass as potential package names (some packages allow implicit loading of or imply selected packages # - improved pattern matching: now allows nested angular brackets, and is no longer confused by escaped curly braces -# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . +# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . # - verbatim and lstlisting environments are marked-up with line-by-line in a similar style to non-verbatim text (requires the listing package to be installed) # (see new configuration variable VERBATIMLINEENV) (several issues and pull requests by jprotze) -# - --flatten: now supports \verbatiminput and \lstlistinput +# - --flatten: now supports \verbatiminput and \lstlistinput # - --flatten: if file is not found, do not fail, simply warn and leave command unexpanded (inspired by issue #112). Don't warn if file name contains #[0-9] as it is then most likely an argument within a command definition rather than an actual file (applies to \input, \subfile, \include commands) # - added to textcmds: \intertext # - new config variable CUSTOMDIFCMD to allow defining special versions of commands in added or deleted blocks (Pull request by github user jprotze) # - added option -no-links (mostly for use by latexdiff-vc in only-changes modes) (Pull request by github user jprotze) -# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) +# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) # new option --no-filter-stderr to hide stderr output from filter-script (potentially dangerous, as this might hide malfunctioning of filter scripts) # - --flatten now can deal with imports made using the import package {PR jasonmccsmith #173) # Bug fixes: @@ -122,12 +137,12 @@ # make environments that are treated like verbatim environments configurable (config variable VERBATIMENV) # treat lstinlne as equivalent to verb command # partially addresses issue #38 -# - refactoring: set default configuration variables in a hash, and those that correspond to lists +# - refactoring: set default configuration variables in a hash, and those that correspond to lists # - feature: option --add-to-config used to amend configuration variables, which are regex pattern lists # - bug fix: deleted figures when endfloat package is activated # - bug fix: alignat environment now always processed correctly (fix issues #65) # - bug fix: avoid processing of commands as potential files in routine init_regex_arr (fix issue #70 ) -# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be +# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be # @ a letter if it is part of a command name will usually lead to the correct behaviour (see http://tex.stackexchange.com/questions/346651/latexdiff-and-let) # - new feature/bug fix: --flatten option \endinput in included files now respected but only if \endinput stands right at the beginning of the line (issue #77) # - bug fix: flatten would incorrectly attempt to process commented out \include commands (from discussion in issue #77 ) @@ -165,7 +180,7 @@ # - introduce list UNSAFEMATHCMD, which holds list of commands which cannot be marked up with \DIFadd or \DIFdel commands (only relevant for WHOLE and COARSE math markup modes) # - new subtype LABEL which gives each change a label. This can later be used to only display pages where changes # have been made (instructions for that are put as comments into the diff'ed file) inspired by answer on http://tex.stackexchange.com/questions/166049/invisible-markers-in-pdfs-using-pdflatex -# - Configuration variables take into accout some commands from additional packages: +# - Configuration variables take into accout some commands from additional packages: # tikzpicture environment now treated as PICTUREENV, and \smallmatrix in ARRENV (amsmath) # - --flatten: support for \subfile command (subfiles package) (in response to http://tex.stackexchange.com/questions/167620/latexdiff-with-subfiles ) # - --flatten: \bibliography commands expand if corresponding bbl file present @@ -179,11 +194,11 @@ # - \% in one-letter sub/Superscripts was not converted correctly # # Version 1.0.3 -# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator +# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator # command in preamble # - \(..\) inline math expressions were not parsed correctly, if they contained a linebreak # - applied patch contributed by tomflannaghan via Berlios: [ Patch #3431 ] Adds correct handling of \left< and \right> -# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug +# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug # and sketching out the solution) # - \^ and \_ are correctly interpreted as accent and underlined space, respectively, not as superscript of subscript # (thanks to Wail Yahyaoui for pointing out this bug) @@ -191,19 +206,19 @@ # Version 1.0.1 - treat \big,\bigg etc. equivalently to \left and # \right - include starred version in MATHENV - apply # - flatten recursively and --flatten expansion is now -# aware of comments (thanks to Tim Connors for patch) +# aware of comments (thanks to Tim Connors for patch) # - Change to post-processing for more reliability for # deleted math environments -# - On linux systems, recognise and remove DOS style newlines +# - On linux systems, recognise and remove DOS style newlines # - Provide markup for some special preamble commands (\title, -# \author,\date, -# - configurable by setting context2cmd +# \author,\date, +# - configurable by setting context2cmd # - for styles using ulem package, remove \emph and \text.. from list of # safe commands in order to allow linebreaks within the -# highlighted sections. -# - for ulem style, now show citations by enclosing them in \mbox commands. -# This unfortunately implies linebreaks within citations no longer function, -# so this functionality can be turned off (Option --disable-citation-markup). +# highlighted sections. +# - for ulem style, now show citations by enclosing them in \mbox commands. +# This unfortunately implies linebreaks within citations no longer function, +# so this functionality can be turned off (Option --disable-citation-markup). # With --enable-citation-markup, the mbox markup is forced for other styles) # - new substyle COLOR. This is particularly useful for marking up citations # and some special post-processing is implemented to retain cite @@ -211,11 +226,11 @@ # - four different levels of math-markup # - Option --driver for choosing driver for modes employing changebar package # - accept \\* as valid command (and other commands of form \.*). Also accept -# \<nl> (backslashed newline) +# \<nl> (backslashed newline) # - some typo fixes, include commands defined in preamble as safe commands -# (Sebastian Gouezel) +# (Sebastian Gouezel) # - include compared filenames as comments as line 2 and 3 of -# the preamble (can be modified with option --label, and suppressed with +# the preamble (can be modified with option --label, and suppressed with # --no-label), option --visible-label to show files in generated pdf or dvi # at the beginning of main document # @@ -231,7 +246,7 @@ # # Version 0.4 March 06 option for fast differencing using UNIX diff command, several minor bug fixes (\par bug, improved highlighting of textcmds) # -# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces +# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces # option, several minor bug fixes # # Version 0.25 October 04 Fix bug with deleted equations, add math mode commands to safecmd, add | to allowed interpunctuation signs @@ -808,12 +823,13 @@ use utf8 ; use File::Spec ; + my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.3.3 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) - (c) 2004-2022 F J Tilmann +This is LATEXDIFF 1.3.4 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) + (c) 2004-2024 F J Tilmann EOF # Hash with defaults for configuration variables. These marked undef have default values constructed from list defined in the DATA block @@ -904,9 +920,9 @@ my $DELCMDOPEN='%DIFDELCMD < '; # To mark begin of deleted commands (must begin my $DELCMDCLOSE="%%%\n"; # To mark end of deleted commands (must end with a new line) my $AUXCMD='%DIFAUXCMD' ; # follows auxiliary commands put in by latexdiff to make difference file legal # auxiliary commands must be on a line of their own - # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in + # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in # the same line as this would mean they are shown - # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line + # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line # is an auxiliary command # Similarly "%DIFAUXCMD LAST" would indicate the auxiliary command is in previous line (not currently used) my $DELCOMMENT='DIF < '; # To mark deleted comment line @@ -917,21 +933,21 @@ my @TEXTCMDLIST=(); # array containing patterns of commands with text arguments my @TEXTCMDEXCL=(); # array containing patterns of commands without text arguments (if a pattern # matches both TEXTCMDLIST and TEXTCMDEXCL it is excluded) my @CONTEXT1CMDLIST=(); # array containing patterns of commands with text arguments (subset of text commands), - # but which cause confusion if used out of context (e.g. \caption). + # but which cause confusion if used out of context (e.g. \caption). # In deleted passages, the command will be disabled but its argument is marked up - # Otherwise they behave exactly like TEXTCMD's + # Otherwise they behave exactly like TEXTCMD's my @CONTEXT1CMDEXCL=(); # exclude list for above, but always empty my @CONTEXT2CMDLIST=(); # array containing patterns of commands with text arguments, but which fail or cause confusion # if used out of context (e.g. \title). They and their arguments will be disabled in deleted # passages my @CONTEXT2CMDEXCL=(); # exclude list for above, but always empty my @MATHTEXTCMDLIST=(); # treat like textcmd. If a textcmd is in deleted or added block, just wrap the - # whole content with \DIFadd or \DIFdel irrespective of content. This functionality + # whole content with \DIFadd or \DIFdel irrespective of content. This functionality # is useful for pseudo commands \MATHBLOCK.. into which math environments are being - # transformed -my @MATHTEXTCMDEXCL=(); # + # transformed +my @MATHTEXTCMDEXCL=(); # -# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these +# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these our @SAFECMDLIST=(); # array containing patterns of safe commands (which do not break when in the argument of DIFadd or DIFDEL) our @SAFECMDEXCL=(); my @MBOXCMDLIST=(); # patterns for commands which are in principle safe but which need to be surrounded by an \mbox @@ -996,7 +1012,7 @@ $mathmarkup=COARSE; $verbose=0; $onlyadditions=0; # output debug and intermediate files, set to 0 in final distribution -$debug=0; +$debug=0; # insert preamble directly after documentclass - experimental feature, set to 0 in final distribution # Note that this failed with mini example (or other files, where packages used in latexdiff preamble # are called again with incompatible options in preamble of resulting file) @@ -1019,9 +1035,9 @@ END my %verbhash; Getopt::Long::Configure('bundling'); -GetOptions('type|t=s' => \$type, - 'subtype|s=s' => \$subtype, - 'floattype|f=s' => \$floattype, +GetOptions('type|t=s' => \$type, + 'subtype|s=s' => \$subtype, + 'floattype|f=s' => \$floattype, 'config|c=s' => \@configlist, 'add-to-config=s' => \@addtoconfiglist, 'preamble|p=s' => \$preamblefile, @@ -1070,11 +1086,11 @@ if ( $help ) { if ( $version ) { - print STDERR $versionstring ; + print STDERR $versionstring ; exit 0; } -print STDERR $versionstring if $verbose; +print STDERR $versionstring if $verbose; if (defined($showall)){ $showpreamble=$showsafe=$showtext=$showconfig=1; @@ -1092,7 +1108,7 @@ if (defined($mathmarkup)) { $mathmarkup=~tr/a-z/A-Z/; if ( $mathmarkup eq 'OFF' ){ $mathmarkup=OFF; - } elsif ( $mathmarkup eq 'WHOLE' ){ + } elsif ( $mathmarkup eq 'WHOLE' ){ $mathmarkup=WHOLE; } elsif ( $mathmarkup eq 'COARSE' ){ $mathmarkup=COARSE; @@ -1195,7 +1211,7 @@ foreach $config ( @configlist ) { } } foreach $assign ( @config ) { - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}=$2; } @@ -1232,7 +1248,7 @@ foreach $key ( keys(%CONFIG) ) { foreach $assign ( @addtoconfig ) { ###print STDERR "assign:|$assign|\n"; - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}.=";$2"; } @@ -1247,8 +1263,8 @@ foreach ( keys(%CONFIG) ) { elsif ( $_ eq "MATHENV" ) { $MATHENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "MATHREPL" ) { $MATHREPL = $CONFIG{$_} ; } elsif ( $_ eq "MATHARRENV" ) { $MATHARRENV = liststringtoregex($CONFIG{$_}) ; } - elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; - print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; + elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; + print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; } elsif ( $_ eq "ARRENV" ) { $ARRENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "VERBATIMENV" ) { $VERBATIMENV = liststringtoregex($CONFIG{$_}) ; } @@ -1275,11 +1291,11 @@ foreach $pkg ( @packagelist ) { if ($showconfig || $showtext || $showsafe || $showpreamble) { show_configuration(); - exit 0; + exit 0; } -if ( @ARGV != 2 ) { +if ( @ARGV != 2 ) { print STDERR "2 and only 2 non-option arguments required. Write latexdiff -h to get help\n"; exit(2); } @@ -1287,7 +1303,7 @@ if ( @ARGV != 2 ) { # Are extra spaces between command arguments permissible? my $extraspace; if ($allowspaces) { - $extraspace='\s*'; + $extraspace='\s*'; } else { $extraspace=''; } @@ -1310,14 +1326,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # 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.'\}|\\\\\{|\\\\\})*'; - # Actually within the text body, quoted braces are replaced in pre-processing. The only place where + # Actually within the text body, quoted braces are replaced in pre-processing. The only place where # the last part of the pattern matters is when processing the arguments of context2cmds in the preamble # and these contain a \{ or \} combination, probably rare. # It should thus be fine to use the simpler version below. ### $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; } - my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $brat_n = $brat0; for (my $i_pat = 0; $i_pat < 4; ++$i_pat){ $brat_n = '(?:[^\[\]]|\['.$brat_n.'\]|\\\[|\\\])*'; @@ -1334,7 +1350,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269) # English: i.e., e.g. Deutsch: z.B. my $abbreviation='(?:i\. ?e\.|e\. ?g\.|z\. ?B\.)' ; - my $number='-?\d*\.\d*'; + my $number='-?\d*\.\d*'; # word: sequence of letters or accents followed by letter my $word_cj='\p{Han}|\p{InHiragana}|\p{InKatakana}'; @@ -1362,7 +1378,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # inline math $....$ or \(..\) ### the commented out version is simpler but for some reason cannot cope with newline (in spite of s option) - need to include \newline explicitly ### my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(].*?\\\\[)]'; - my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; + my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ### test version (this seems to give the same results as version above) ## the current maths command cannot cope with newline within the math expression ### my $math='\$(?:[^$]|\\\$)*?\$|\\[(].*?\\[)]'; @@ -1380,7 +1396,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); -# now we are done setting up and can start working +# now we are done setting up and can start working my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { @@ -1408,7 +1424,7 @@ my ($oldtime,$newtime,$oldlabel,$newlabel); if (defined($labels[0])) { $oldlabel=$labels[0] ; } else { - $oldtime=localtime((stat($oldfile))[9]); + $oldtime=localtime((stat($oldfile))[9]); $oldlabel="$oldfile " . " "x($oldlabel_n_spaces) . $oldtime; } if (defined($labels[1])) { @@ -1421,6 +1437,7 @@ if (defined($labels[1])) { $encoding=guess_encoding($newfile) unless defined($encoding); $encoding = "utf8" if $encoding =~ m/^utf8/i ; +print STDERR "Encoding $encoding\n" if $verbose; if (lc($encoding) eq "utf8" ) { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -1504,7 +1521,7 @@ my @auxlines; my ($ulem)=0; if ( length $oldpreamble && length $newpreamble ) { - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) # and marking up content with latexdiff markup @auxlines=preprocess_preamble($oldpreamble,$newpreamble); @@ -1536,7 +1553,7 @@ if (defined($graphicsmarkup)) { } else { # Default: no explicit setting in menu if ( defined $packages{"graphicx"} or defined $packages{"graphics"} ) { - $graphicsmarkup=NEWONLY; + $graphicsmarkup=NEWONLY; } else { $graphicsmarkup=NONE; } @@ -1569,7 +1586,7 @@ if ($graphicsmarkup != NONE ) { @matches=( $latexdiffpreamble =~ m/command\{\\DIFaddbeginFL}\{($pat_n)}/sg ) ; # we look at the last one of the list to take into account possible redefinition but almost always matches should have exactly one element if ( $matches[$#matches] =~ m/\\DIFaddbegin/ ) { - die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; + die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; exit 10; } ###} @@ -1583,6 +1600,11 @@ if ($graphicsmarkup != NONE ) { $ulem = ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{ulem\}/ || defined $packages{"ulem"}); +# If amsmath is defined and $ulem is used for markup, redefine the \sout command to also work (mostly) in math mode +# See stack exchange https://tex.stackexchange.com/questions/20609/strikeout-in-math-mode/308647#308647 based on comment by Taylor Raine +if ( defined($packages{'amsmath'}) and $ulem ) { + $latexdiffpreamble .= join "\n",(extrapream('AMSMATHULEM'),""); +} # If listings is being used or can be found in the latexdiff search path, add to the preamble auxiliary code to enable line-by-line markup if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @@ -1592,7 +1614,7 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { } my @listingDIFcode=(); my $replaced; - # note that in case user supplies preamblefile the type might not reflect well the + # note that in case user supplies preamblefile the type might not reflect well the actual markup style @listingDIFcode=extrapream("-nofail","DIFCODE_" . $type) unless defined($preamblefile); if (!(@listingDIFcode)) { # if listingDIFcode is empty try to guess a suitable one from the preamble @@ -1606,13 +1628,17 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @listingDIFcode=extrapream("DIFCODE_BOLD"); } } - # now splice it in + # add configuration so that listings work with utf-8 + push @listingpreamble, '\lstset{extendedchars=\true,inputencoding='.$encoding."}\n"; + + + # now splice it in $replaced=0; ###print STDERR "DEBUG: listingDIFcode: ",join("\n",@listingDIFcode),"|||\n" if $debug; - @listingpreamble=grep { + @listingpreamble=grep { # only replace if this has not been done already (use short-circuit property of and) - if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { + if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { ###print STDERR "DEBUG: Replaced text $_\n" if $debug; $replaced=1; 1; @@ -1642,7 +1668,7 @@ if ( length $oldpreamble && length $newpreamble ) { unshift @oldpreamble,''; @diffpreamble = linediff(\@oldpreamble, \@newpreamble); # remove dummy line again - shift @diffpreamble; + shift @diffpreamble; # add filenames, modification time and latexdiff mark defined($nolabel) or splice @diffpreamble,1,0, "%DIF LATEXDIFF DIFFERENCE FILE", @@ -1691,8 +1717,8 @@ if (defined $packages{"siunitx"} ) { # protect SI command by surrounding them with an \mbox # this is done to get around an incompatibility between the ulem and siunitx package print STDERR "siunitx package detected.\n" if $verbose ; - my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange'; - init_regex_arr_list(\@SAFECMDLIST,'num,si'); + my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange,qty,qtylist,qtyproduct,qtyrange,complexqty'; + init_regex_arr_list(\@SAFECMDLIST,'num,si,numproduct,unit,complexnum'); if ( $enablecitmark || ( $ulem && ! $disablecitmark )) { init_regex_arr_list(\@MBOXCMDLIST,$mboxcmds); } else { @@ -1714,7 +1740,7 @@ if (defined $packages{"cleveref"} ) { if (defined $packages{"glossaries"} ) { # protect selected command by surrounding them with an \mbox - # this is done to get around an incompatibility between ulem and glossaries package + # this is done to get around an incompatibility between ulem and glossaries package print STDERR "glossaries package detected.\n" if $verbose ; my $mboxcmds='[gG][lL][sS](?:|pl|disp|link|first|firstplural|desc|user[iv][iv]?[iv]?),[aA][cC][rR](?:long|longpl|full|fullpl),[aA][cC][lfp]?[lfp]?'; init_regex_arr_list(\@SAFECMDLIST,'[gG][lL][sS](?:(?:entry)?(?:text|plural|name|symbol)|displaynumberlist|entryfirst|entryfirstplural|entrydesc|entrydescplural|entrysymbolplural|entryuser[iv][iv]?[iv]?|entrynumberlist|entrydisplaynumberlist|entrylong|entrylongpl|entryshort|entryshortpl|entryfull|entryfullpl),[gG]lossentry(?:name|desc|symbol),[aA][cC][rR](?:short|shortpl),[aA]csp?'); @@ -1743,6 +1769,10 @@ if (defined $packages{"mhchem"} ) { # push(@MATHTEXTCMDLIST,'cee'); } +if ( defined $packages{"tikz-dependency"} ) { + init_regex_arr_ext(\@SAFECMDEXCL, 'AMPERSAND'); +} + my ( $citpat); @@ -1830,7 +1860,7 @@ print STDERR "(",exetime()," s)\n","Done.\n" if $verbose; # liststringtoregex(liststring) -# expands string with semi-colon separated list into a regular expression corresponding +# expands string with semi-colon separated list into a regular expression corresponding # matching any of the elements sub liststringtoregex { my ($liststring)=@_; @@ -1843,7 +1873,7 @@ sub liststringtoregex { } # show_configuration -# note that this is not encapsulated but uses variables from the main program +# note that this is not encapsulated but uses variables from the main program # It is provided for convenience because in the future it is planned to allow output # to be modified based on what packages are read etc - this works only if the input files are actually read # whether or not additional files are provided @@ -1870,7 +1900,7 @@ sub show_configuration { print "\nContext1 commands (last argument textual, command will be disabled in deleted passages, last argument will be shown as plain text):\n"; print_regex_arr(@CONTEXT1CMDLIST); print "\nContext2 commands (last argument textual, command and its argument will be disabled in deleted passages):\n"; - print_regex_arr(@CONTEXT2CMDLIST); + print_regex_arr(@CONTEXT2CMDLIST); print "\nExclude list of Commands with last argument not textual (overrides patterns above):\n"; print_regex_arr(@TEXTCMDEXCL); } @@ -1978,7 +2008,7 @@ sub list_packages { my %packages=(); my $pkg; - # remove comments + # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat_n)\])?\{(.*?)\}/gs ) { @@ -2083,7 +2113,7 @@ sub flatten { my ($includeonly,$dirname,$fname,$newpage,$fullfile,$filecontent,$replacement,$begline,$inputcmd,$bblfile,$subfile,$command,$verbenv,$verboptions,$ignore,$fileonly); my ($subpreamble,$subbody,$subpost); my ($subdir,$subdirfull,$importfilepath); - require File::Basename ; + require File::Basename ; ### require File::Spec ; # now this is needed even if flatten option not given $filename = File::Spec->rel2abs( $filename ) ; ($ignore, $dirname, $fileonly) = File::Spec->splitpath($filename) ; @@ -2123,15 +2153,15 @@ sub flatten { $subdirfull = (defined($3) ? File::Spec->catdir($dirname,$subdir) : $subdir); $importfilepath = File::Spec->catfile($subdirfull, $fname); - + print STDERR "importing importfilepath:", $importfilepath,"\n" if $verbose; if ( -f $importfilepath ) { # If file exists, replace input or include command with expanded input #TODO: need remove_endinput & newpage similar to other replacements inside flatten - $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); + $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$importfilepath,". I will continue but not expand |$2|\n"; $replacement = $2; $replacement .= "{$subdir}{$fname} % Processed"; @@ -2140,13 +2170,13 @@ sub flatten { }/exgm; # recursively replace \\input and \\include files - $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ + $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ $begline=(defined($1)? $1 : "") ; $inputcmd=$2; $fname = $3 if defined($3) ; $fname = $4 if defined($4) ; $newpage=(defined($4)? " \\newpage " : "") ; - # # add tex extension unless there is a three or four letter extension already + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}$|; $fullfile = File::Spec->catfile($dirname,$fname); print STDERR "DEBUG Beg of line match |$1|\n" if defined($1) && $debug ; @@ -2155,12 +2185,12 @@ sub flatten { # content of file becomes replacement value (use recursion), add \newpage if the command was include if ( -f $fullfile ) { # If file exists, replace input or include command with expanded input - $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); - $replacement = remove_endinput($replacement); + $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); + $replacement = remove_endinput($replacement); # \include always starts a new page; use explicit \newpage command to simulate this } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$fullfile,". I will continue but not expand |$inputcmd|\n" unless $fname =~ m(#[0-9]) ; $replacement = $inputcmd ; # i.e. just the original command again -> make no change file does not exist $newpage=""; @@ -2169,7 +2199,7 @@ sub flatten { }/exgm; # replace bibliography with bbl file if it exists - $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ if ( -f $bblfile ){ $replacement=read_file_with_encoding(File::Spec->catfile($bblfile), $encoding); } else { @@ -2181,10 +2211,10 @@ sub flatten { }/exgm; # replace subfile with contents (subfile package) - $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; - $fname = $2; - # # add tex extension unless there is a three or four letter extension already + $fname = $2; + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}|; print STDERR "Include file as subfile $fname\n" if $verbose; # content of file becomes replacement value (use recursion) @@ -2195,10 +2225,10 @@ sub flatten { # if file exists, expand \subfile command by contents of file $subfile=read_file_with_encoding($fullfile,$encoding) or die "Could not open included subfile ",$fullfile,": $!"; ($subpreamble,$subbody,$subpost)=splitdoc($subfile,'\\\\begin\{document\}','\\\\end\{document\}'); - ### $subfile=~s|^.*\\begin{document}||s; + ### $subfile=~s|^.*\\begin{document}||s; ### $subfile=~s|\\end{document}.*$||s; $replacement=flatten($subbody, $preamble,$fullfile,$encoding); - ### $replacement = remove_endinput($replacement); + ### $replacement = remove_endinput($replacement); } else { # if file does not exist, do not expand subfile print STDERR "WARNING: Could not find subfile ",$fullfile,". I will continue but not expand |$2|\n" unless $fname =~ m(#[0-9]) ; @@ -2209,11 +2239,11 @@ sub flatten { }/exgm; # replace \verbatiminput and \lstlistinginput - $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; $command = $2 ; $fname = $4 ; - $verboptions = defined($3)? $3 : "" ; + $verboptions = defined($3)? $3 : "" ; if ($command eq 'verbatiminput' ) { $verbenv = "verbatim" ; } elsif ($command eq 'verbatiminput*' ) { @@ -2222,7 +2252,7 @@ sub flatten { $verbenv = "lstlisting" ; } else { die "Internal errorL Unexpected verbatim input type $command.\n"; - } + } print STDERR "DEBUG Beg of line match |$begline|\n" if $debug ; print STDERR "Include file $fname verbatim\n" if $verbose; print STDERR "DEBUG looking for file ",File::Spec->catfile($dirname,$fname), "\n" if $debug; @@ -2254,8 +2284,8 @@ sub print_regex_arr { # if $type is a filename, it will read the file instead of reading from the appendix # otherwise it will screen appendix for line "%DIF $TYPE" and copy everything up to line # '%DIF END $TYPE' (where $TYPE is upcased version of $type) -# extrapream('-nofail',$type) will---instead of failing---simply return nothing if -# it does not find the matching line in a appendix (do not use -nofail option with multiple types!) +# extrapream('-nofail',$type) will---instead of failing---simply return nothing if +# it does not find the matching line in appendix (do not use -nofail option with multiple types!) sub extrapream { my @types=@_; my ($type,$arg); @@ -2272,14 +2302,20 @@ sub extrapream { $type=$arg; $copy=0; if ( -f $type || lc $type eq '/dev/null' ) { - open (FILE,$type) or die "Cannot open preamble file $type: $!"; print STDERR "Reading preamble file $type\n" if $verbose ; + open (FILE,$type) or die "Cannot open preamble file $type: $!"; + if (defined($encoding)) { + binmode(FILE,":encoding($encoding)"); + } else { + require Encode::Locale; + binmode(FILE,":encoding(locale)"); + } while (<FILE>) { chomp ; if ( $_ =~ m/%DIF PREAMBLE/ ) { - push (@retval,"$_"); + push (@retval,"$_"); } else { - push (@retval,"$_ %DIF PREAMBLE"); + push (@retval,"$_ %DIF PREAMBLE"); } } } else { # not (-f $type) @@ -2291,9 +2327,9 @@ sub extrapream { my $data_start = tell DATA; while (<DATA>) { if ( m/^%DIF $type/ ) { - $copy=1; + $copy=1; } elsif ( m/^%DIF END $type/ ) { - last; + last; } chomp; push (@retval,"$_ %DIF PREAMBLE") if $copy; @@ -2333,7 +2369,7 @@ sub splitdoc { $pos=pos $rest; $part2=substr($rest,0,$pos-length($2)); $part3=substr($rest,$pos); - } + } else { die "$word1 and $word2 not in the correct order or not present as a pair." ; } @@ -2405,7 +2441,7 @@ sub splitlatex { my $leadin=$1; length($string)>0 or return ($leadin); - my @retval=($string =~ m/$pat/osg); + my @retval=($string =~ m/$pat/osg); if (length($string) != length(join("",@retval))) { print STDERR "\nWARNING: Inconsistency in length of input string and parsed string:\n This often indicates faulty or non-standard latex code.\n In many cases you can ignore this and the following warning messages.\n Note that character numbers in the following are counted beginning after \\begin{document} and are only approximate." unless $ignorewarnings; @@ -2449,17 +2485,17 @@ sub splitlatex { # pass1( \@seq1,\@seq2) # Look for differences between seq1 and seq2. -# Where an common-subsequence block is flanked by deleted or appended blocks, +# Where an common-subsequence block is flanked by deleted or appended blocks, # and is shorter than $MINWORDSBLOCK words it is appended -# to the last deleted or appended word. If the block contains tokens other than words +# to the last deleted or appended word. If the block contains tokens other than words # or punctuation it is not merged. # Deleted or appended block consisting of words and safe commands only are # also merged, to prevent break-up in pass2 (after previous isolated words have been removed) -# If there are commands with textual arguments (e.g. \caption) both in corresponding -# appended and deleted blocks split them such that the command and opening bracket -# are one token, then the rest is split up following standard rules, and the closing +# If there are commands with textual arguments (e.g. \caption) both in corresponding +# appended and deleted blocks split them such that the command and opening bracket +# are one token, then the rest is split up following standard rules, and the closing # bracket is a separate token, ie. turn -# "\caption{This is a textual argument}" into +# "\caption{This is a textual argument}" into # ("\caption{","This ","is ","a ","textual ","argument","}") # No return value. Destructively changes sequences sub pass1 { @@ -2488,15 +2524,15 @@ sub pass1 { my $adddiscard = sub { if ($cnt > 0 ) { $matblkcnt++; - # just after an unchanged block + # just after an unchanged block # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; - if ($cnt < $MINWORDSBLOCK + if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { - # merge identical blocks shorter than $MINWORDSBLOCK + # merge identical blocks shorter than $MINWORDSBLOCK # and only containing ordinary words # with preceding different word # We cannot carry out this merging immediately as this @@ -2504,23 +2540,23 @@ sub pass1 { # the algorithm, instead we store in @$todo where we have to merge push(@$todo, [ $last1,$last2,$cnt,@$block ]); } - $block = []; + $block = []; $cnt=0; $last1=-1; $last2=-1; } }; my $discard=sub { $deltokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$delblock,[ $seq1->[$_[0]],$_[0] ]); - $last1=$_[0] }; + $last1=$_[0] }; my $add = sub { $addtokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$addblock,[ $seq2->[$_[1]],$_[1] ]); - $last2=$_[1] }; + $last2=$_[1] }; my $match = sub { $mattokcnt++; if ($cnt==0) { # first word of matching sequence after changed sequence or at beginning of word sequence - $deltextblocks = extracttextblocks($delblock); + $deltextblocks = extracttextblocks($delblock); $delblkcnt++ if scalar @$delblock; $addtextblocks = extracttextblocks($addblock); $addblkcnt++ if scalar @$addblock; @@ -2536,7 +2572,7 @@ sub pass1 { ### Algorithm::Diff 1.19 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, 0, sub { $_[0]->[0] } ); } else { - ### Algorithm::Diff 1.15 + ### Algorithm::Diff 1.15 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, sub { $_[0]->[0] } ); } @@ -2567,11 +2603,11 @@ sub pass1 { my ($index,$block,$cnt)=@{ shift(@$addtextblocks) }; push(@$todo, [-1,$index,$cnt,@$block]); } - + $addblock=[]; $delblock=[]; } - push(@$block,$seq2->[$_[1]]); + push(@$block,$seq2->[$_[1]]); $cnt++ }; my $keyfunc = sub { join(" ",split(" ",shift())) }; @@ -2579,7 +2615,7 @@ sub pass1 { traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - # now carry out the merging/splitting. Refer to elements relative from + # now carry out the merging/splitting. Refer to elements relative from # the end (with negative indices) as these offsets don't change before the instruction is executed # cnt>0: merged small unchanged groups with previous changed blocks # cnt==-1: split textual commands into components @@ -2594,7 +2630,7 @@ sub pass1 { } } - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens in $matblkcnt blocks.\n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2604,10 +2640,10 @@ sub pass1 { # extracttextblocks(\@blockindex) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form # [[ $index, $textblock, $cnt ], .. # where $index index of block to be merged # $textblock contains all the words to be merged with the word at $index (but does not contain this word) @@ -2615,7 +2651,7 @@ sub pass1 { # # requires: iscmd # -sub extracttextblocks { +sub extracttextblocks { my $block=shift; my ($i,$token,$index); my $textblock=[]; @@ -2625,13 +2661,13 @@ sub extracttextblocks { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text if ($last<0) { @@ -2639,7 +2675,7 @@ sub extracttextblocks { $last=$index; } else { # add to pure-text block - push(@$textblock, $token); + push(@$textblock, $token); } } else { # it is not text @@ -2660,29 +2696,29 @@ sub extracttextblocks { # extractcommands( \@blockindex ) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form -# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. -# where index is just taken from input array -# command must have a textual argument as last argument -# -# requires: iscmd -# -sub extractcommands { +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form +# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. +# where index is just taken from input array +# command must have a textual argument as last argument +# +# requires: iscmd +# +sub extractcommands { my $block=shift; my ($i,$token,$index,$cmd,$open,$mid,$closing); my $retval=[]; # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: \cmd @@ -2690,7 +2726,7 @@ sub extractcommands { # $4: } + trailing spaces if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat_n\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { - print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; + print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; $closing =~ s/\}/\\RIGHTBRACE/ ; @@ -2701,7 +2737,7 @@ sub extractcommands { } # iscmd($cmd,\@regexarray,\@regexexcl) checks -# return 1 if $cmd matches any of the patterns in the +# return 1 if $cmd matches any of the patterns in the # array $@regexarray, and none of the patterns in \@regexexcl, otherwise return 0 sub iscmd { my ($cmd,$regexar,$regexexcl)=@_; @@ -2709,7 +2745,7 @@ sub iscmd { ### print STDERR "DEBUG: iscmd($cmd)=" if $debug; foreach $pat ( @$regexar ) { if ( $cmd =~ m/^${pat}$/ ) { - $ret=1 ; + $ret=1 ; last; } } @@ -2725,13 +2761,13 @@ sub iscmd { # pass2( \@seq1,\@seq2) -# Look for differences between seq1 and seq2. +# Look for differences between seq1 and seq2. # Mark begin and end of deleted and appended sequences with tags $DELOPEN and $DELCLOSE # and $ADDOPEN and $ADDCLOSE, respectively, however exclude { } & and all comands, unless # they match an element of the whitelist (SAFECMD) # For words in TEXTCMD but not in SAFECMD, enclose interior with $ADDOPEN and $ADDCLOSE brackets -# Deleted comment lines are marked with %DIF < -# Added comment lines are marked with %DIF > +# Deleted comment lines are marked with %DIF < +# Added comment lines are marked with %DIF > sub pass2 { my $seq1 = shift ; my $seq2 = shift ; @@ -2763,7 +2799,7 @@ sub pass2 { $addhunk = []; } push(@$retval,$seq2->[$_[1]]) }; - + my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); @@ -2772,7 +2808,7 @@ sub pass2 { push @$retval,marktags($ADDMARKOPEN,$ADDMARKCLOSE,$ADDOPEN,$ADDCLOSE,"","",$ADDCOMMENT,$addhunk) if scalar @$addhunk; - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens. \n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2794,7 +2830,7 @@ sub marktags { my (@argtext); my $retval=[]; my $noncomment=0; - my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word + my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word # 1: last token written is a command # for keeping track whether we are just in a command sequence or in a word sequence my $cmdcomment= ($opencmd =~ m/^%/); # Flag to indicate whether opencmd is a comment (i.e. if we intend to simply comment out changed commands) @@ -2810,31 +2846,31 @@ sub marktags { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace_mt='\s*'; + my $extraspace_mt='\s*'; foreach (@$block) { - $word=$_; + $word=$_; if ( $word =~ s/^%/%$comment/ ) { # a comment if ($cmd==1) { push (@$retval,$closecmd) ; $cmd=-1; } - push (@$retval,$word); + push (@$retval,$word); next; } if ( $word =~ m/^\s*$/ ) { ### print STDERR "DEBUG MARKTAGS: whitespace detected |$word| cmdcom |$cmdcomment| |$opencmd|\n" if $debug; # a sequence of white-space characters - this should only ever happen for the first element of block. - # in deleted block, omit, otherwise just copy it in + # in deleted block, omit, otherwise just copy it in if ( ! $cmdcomment) { # ignore in deleted blocks push(@$retval,$word); } next; } if (! $noncomment) { - push (@$retval,$openmark); + push (@$retval,$openmark); $noncomment=1; } # negative lookahead pattern (?!) in second clause is put in to avoid matching \( .. \) patterns @@ -2844,7 +2880,7 @@ sub marktags { # word is a command or other significant token (not in SAFECMDLIST) ## same conditions as in subroutine extractcommand: # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: cmd @@ -2861,11 +2897,11 @@ sub marktags { # Condition 3: But if we are in a deleted block ($cmdcomment=1) and # $2 (the command) is in context2, just treat it as an ordinary command (i.e. comment it open with $opencmd) # Because we do not want to disable this command - # here we do not use $opencmd and $closecmd($opencmd is empty) + # here we do not use $opencmd and $closecmd($opencmd is empty) print STDERR "DEBUG: Detected text |$word| but not safe command \$2: $2 \$3: $3\n." if $debug; if ($cmd==1) { push (@$retval,$closecmd) ; - } elsif ($cmd==0) { + } elsif ($cmd==0) { push (@$retval,$close) ; } $command=$1; $commandword=$2; $closingbracket=$4; @@ -2881,16 +2917,16 @@ sub marktags { # for latexrevise push (@$retval,$command,"%\n{$AUXCMD\n",marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } elsif ( iscmd($commandword,,\@MATHTEXTCMDLIST, \@MATHTEXTCMDEXCL) ) { - # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) - # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to + # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) + # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to # "" - local @SAFECMDLIST=(".*"); + local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { # normal textcmd or context1cmd in an added block - push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); + push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } push (@$retval,$AUXCMD,"\n") if $cmdcomment ; $cmd=-1 ; @@ -2976,10 +3012,10 @@ sub take_comments_and_newline_from_frac() { # names or labels but it does not matter because they are converted back in the postprocessing step # Returns: leading white space removed in step 1 sub preprocess { - for (@_) { + for (@_) { - # change in \verb and similar commands - note that I introduce an extra space here so that the + # change in \verb and similar commands - note that I introduce an extra space here so that the # already hashed variants do not trigger again # transform \lstinline{...} # s/\\lstinline(\[$brat0\])?(\{(?:.*?)\})/"\\DIFlstinline". $1 ."{". tohash(\%verbhash,"$2") ."}"/esg; @@ -3009,7 +3045,7 @@ sub preprocess { 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$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 ; @@ -3029,16 +3065,16 @@ sub preprocess { if ( $mathmarkup != FINE ) { # DIFANCHORARRB and DIFANCHORARRE, DIFANCHORMATHB and DIFANCHORMATHE markers are inserted here to encourage the matching algorithm # to always match up the closing brace. Otherwise sometimes one ends up with a situation where - # the closing brace is deleted and added at another point. The deleted closing brace is then + # the closing brace is deleted and added at another point. The deleted closing brace is then # prevented by a %DIFDELCMD, leading to material leaking in or out of the math environment. # The anchors are removed in post-processing again. (note that they are simple text to cause least amount of complications - # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to + # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to # resort to WHOLE or FINE, or NONE math mode processing. s/\\begin\{($ARRENV)}(.*?)\\end\{\1}/\\ARRAYBLOCK$1\{$2\\DIFANCHORARRB \}\\DIFANCHORARRE /sg; take_comments_and_newline_from_frac(); - # Convert Math environments with arguments + # Convert Math environments with arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}((?:\[$brat_n\])|(?:\{$pat_n\}))+(.*?)\\end\{\1\}/\\MATHBLOCK$1\[$2\]\{$3\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; # Convert Math environments without arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\end\{\1\}/\\MATHBLOCK$1\{$2\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; @@ -3052,7 +3088,7 @@ sub preprocess { # $expanded=linecomment($string) #preface all lines with verbatim marker (usually DIFVRB) -sub linecomment { +sub linecomment { my @verbatimlines=split("\n",$_[0]); # the first line needs special treatment - we do want to retain optional arguments as is but wrap the remainder also with VERBCOMMENT ### print STDERR "DEBUG: before verbatimlines[0] = ",$verbatimlines[0],"\n"; @@ -3062,7 +3098,7 @@ sub linecomment { } # $simple=reverselinecomment($env $string) -# remove DIFVRB comments but leave changed lines marked +# remove DIFVRB comments but leave changed lines marked sub reverselinecomment { my ($environment, $verbatimtext)=@_; ### print STDERR "DEBUG REVERSELINECOMMENT input: $environment,|$verbatimtext|\n" if $debug; @@ -3077,7 +3113,7 @@ sub reverselinecomment { $verbatimtext =~ s/\\DIFdelend //g; $verbatimtext =~ s/$DELCMDOPEN.*//g; - # remove DIFVRB mark + # remove DIFVRB mark $verbatimtext=~ s/%$VERBCOMMENT//g; # remove part of the markup in changed lines @@ -3168,7 +3204,7 @@ sub writedebugfile { # * Remove STOP token from the end # * Replace \RIGHTBRACE by } # * If option --no-del is set delete all deleted blocks -# 1. Check all deleted blocks: +# 1. Check all deleted blocks: # a.where a deleted block contains a matching \begin and # \end environment (these will be disabled by a %DIFDELCMD statements), for selected environments enable # these commands again (such that for example displayed math in a deleted equation @@ -3189,14 +3225,14 @@ sub writedebugfile { # For added blocks: # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es # d. place \cite commands in mbox'es (for UNDERLINE style) -# +# # 2. If math-mode COARSE,WHOLE or NONE option set: Convert \MATHBLOCKmath{..} commands back to environments # # Convert all PICTUREblock{..} commands back to the appropriate environments # 3. Convert DIFadd, DIFdel, DIFaddbegin , ... into FL varieties # within floats (currently recognised float environments: plate,table,figure # plus starred varieties). -# 4. Remove empty %DIFDELCMD < lines +# 4. Remove empty %DIFDELCMD < lines # 4. Convert \begin{SQUAREBRACKET} \end{SQUAREBRACKET} into \[ \] # Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} @@ -3209,7 +3245,7 @@ sub writedebugfile { # 4, undo renaming of the \begin, \end,{,} in comments # Change \QLEFTBRACE, \QRIGHTBRACE,\AMPERSAND to \{,\},\& # -# Note have to manually synchronize substitution commands below and +# Note have to manually synchronize substitution commands below and # DIF.. command names in the header sub postprocess { my ($begin,$len,$float,$delblock,$addblock); ### $cnt @@ -3221,7 +3257,7 @@ sub postprocess { my (@itemargs, $itemarg); - for (@_) { + for (@_) { # change $'s in comments to something harmless 1 while s/(%.*)\$/$1DOLLARDIF/mg ; @@ -3231,7 +3267,7 @@ sub postprocess { # the only way to get these is as %DIFDELCMD < \RIGHTBRACE construction # This essentially marks closing right braces of MATHBLOCK environments, which did not get matched # up. This case should be rare, so I just leave this in the diff file output. Not really elegant - # but can still be dealt with later if it results in problems. + # but can still be dealt with later if it results in problems. s/%DIFDELCMD < \\RIGHTBRACE/%DIFDELCMD < \\MBLOCKRIGHTBRACE/g ; # Replace \RIGHTBRACE by } s/\\RIGHTBRACE/}/g; @@ -3259,7 +3295,7 @@ sub postprocess { $len=length($&); $begin=pos($_) - $len; $delblock=$&; - ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following + ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following ### this strategy: ### 1. a Insert aux commands \begin{MATHMODE} or \end{MATHMODE} for all deleted commands opening or closing displayed math mode ### b Insert aux commands \begin{MATHARRMODE} or \end{MATHARRMODE} for all deleted commands opening or closing math array mode @@ -3285,14 +3321,14 @@ sub postprocess { ###0.5: $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end\{MATHMODE\}$AUXCMD\n$1$3\n\\begin\{MATHMODE\}$AUXCMD\n$4/sg; - # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\begin{$MATHREPL}$AUXCMD\n/sg ) { ### print STDERR "BINGO: begin block: \nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug ; $delblock =~ s/(\\DIFdelend$)/\\end{$MATHREPL}$AUXCMD\n$1/s ; ### print STDERR "After: |" . $delblock . "|\n\n" if $debug ; } - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end\{MATHMODE\}$AUXCMD\n/sg ) { ### print STDERR "BINGO: end block:\nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug; @@ -3315,15 +3351,15 @@ sub postprocess { $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; ### print STDERR "STEP1: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{($MATHARRENV)\}(.*?)(?:$DELCMDCLOSE|\n))/$1\\begin{$2*}$3$AUXCMD\n/sg ) { $arrenv=$2; - $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}}$AUXCMD\n$1/s ; + $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}$AUXCMD\n$1/s ; } ### print STDERR "STEP2: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end{MATHMODE}$AUXCMD\n/sg ) { $delblock =~ s/(\\DIFdelend$)/\\begin{MATHMODE}$AUXCMD\n$1/s ; @@ -3341,7 +3377,7 @@ sub postprocess { ### $eqarrayblock=~ s/(\%DIFDELCMD < \s*(\&|\\\\)\s*?(?:$DELCMDCLOSE|\n))/$1$2$AUXCMD\n/sg ; $eqarrayblock =~ s/(\%DIFDELCMD < (.*?(?:\&|\\\\).*)(?:$DELCMDCLOSE|\n))/ # The pattern captures comments with at least one of & or \\ - @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence + @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence @symbols= grep ( m@&|\\\\\s*@, @symbols); # select & and \\ (and subsequent spaces) "$1@symbols$AUXCMD\n" /eg ; @@ -3354,7 +3390,7 @@ sub postprocess { } elsif ( $mathmarkup == COARSE || $mathmarkup == WHOLE ) { # 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 their starred variety + # will be replaced by their starred variety $delblock=~ s/\\MATHBLOCK($MATHENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$MATHREPL$2\{$3\}/sg; $delblock=~ s/\\MATHBLOCK($MATHARRENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$1\*$2\{$3\}/sg; } @@ -3368,10 +3404,10 @@ sub postprocess { print STDERR "DELBLOCK after maths processing: |" . $delblock . "|\n\n" if $debug ; - # Reinstate completely deleted list environments. note that items within the + # 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 + ### # 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; @@ -3405,7 +3441,7 @@ sub postprocess { ### if ($CITE2CMD) { ###### ${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})) .*?%%%\n ### $delblock=~s/($DELCMDOPEN\s*\\($CITE2CMD)(.*)$DELCMDCLOSE)/ - ### # Replacement code + ### # Replacement code ### {my ($aux,$all); ### $aux=$all=$1; ### $aux=~s#\n?($DELCMDOPEN|$DELCMDCLOSE)##g; @@ -3415,7 +3451,7 @@ sub postprocess { ### if ($CITECMD) { ###### $delblock=~s/(\\($CITECMD)${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; ### $delblock=~s/(\\($CITECMD)${extraspace}(?:<$abrat0>${extraspace})?(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; - ### } + ### } # if MBOXINLINEMATH is set, protect inlined math environments with an extra mbox @@ -3423,7 +3459,7 @@ sub postprocess { # note additional \newline after command is omitted from output if right at the end of deleted block (otherwise a spurious empty line is generated) $delblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { ### # change included verbatim environments ### $delblock =~ s/\\DIFverb\{/\\DIFDIFdelverb\{/g; ### $delblock =~ s/\\DIFlstinline/\\DIFDIFdellstinline/g; @@ -3465,7 +3501,7 @@ sub postprocess { ##$addblock=~s/($math)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; $addblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { # mark added verbatim commands $addblock =~ s/\\DIFverb/\\DIFDIFaddverb/g; $addblock =~ s/\\DIFlstinline/\\DIFDIFaddlstinline/g; @@ -3483,11 +3519,11 @@ 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. + # 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\})/ ; + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; @liststack=(); - @newtextparts=map { + @newtextparts=map { ### print STDERR ":::::::: $_\n"; if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; @@ -3503,7 +3539,7 @@ sub postprocess { } 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 + # 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 @@ -3516,17 +3552,17 @@ sub postprocess { # Replace MATHMODE environments from step 1a above by the correct Math environment and remove unncessary pairings - + if ( $mathmarkup == FINE ) { # look for AUXCMD math-mode pairs which have only comments (or empty lines between them), and remove the added commands # \begin{..} ... \end{..} pairs - s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; + s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; # \end{..} .... \begin{..} pairs - s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; + s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; writedebugfile($_,'postprocess15'); # The next line is complicated. The negative look-ahead insertion makes sure that no \end{$MATHENV} (or other mathematical - # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching + # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching # is not globally minimal but only 'locally' (matching is beginning from the left side of the string) # [NB: Do not be tempted to prettify the expression with /x modified. It seems this is applied after strings are expanded so will ignore spaces in strings 1 while s/(?<!$DELCMDOPEN)\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:${DELCMDOPEN}[^\n]*|.(?!(?:\\end\{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin\{MATHMODE})))*?)\\end\{MATHMODE}/\\begin{$1}$2\\end{$1}/s; @@ -3601,7 +3637,7 @@ sub postprocess { # remove empty DIFCMD < lines s/^\Q${DELCMDOPEN}\E\n//msg; - # Expand hashes of verb and verbatim environments + # Expand hashes of verb and verbatim environments s/${DELCMDOPEN}\\($VERBATIMENV)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg; # revert changes to verbatim environments for line diffs (and add code to mark up changes) (note negative look behind assertions to not leak out of DIFDELCMD comments) # Example: @@ -3627,8 +3663,8 @@ sub postprocess { ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E[^\n]*?\n)*) # Deleted \end command of verbatim environment. Note that the type is forced to match the opening. Captures: $5: Whole deleted environment (previous way this line was written: (\Q$DELCMDOPEN\E\\end\{\2\}(?:\n|\s|\Q$DELCMDOPEN\E)*\Q$DELCMDCLOSE\E) (\Q$DELCMDOPEN\E\\end\{\2\}) - / # Substitution part - $1 # Leave expression as is + / # Substitution part + $1 # Leave expression as is . "$AUXCMD NEXT\n" # Mark the following line as an auxiliary command . "" # reinstate the original environment without options . reverselinecomment($2, "$3$4") # modify the body to change the markup; reverselinecomment parses for options @@ -3637,7 +3673,7 @@ sub postprocess { /esgx; # Modifiers of substitution command writedebugfile($_,'postprocess2'); # where changes have occurred in verbatim environment, change verbatim to DIFverbatim to allow mark-up - # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim + # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim # environment does not take optional arguments) s/(?<!$DELCMDOPEN)\\begin\{(verbatim[*]?)\}(\[$brat_n\].*?)\\end\{\1\}/\\begin{DIF$1}$2\\end{DIF$1}/sg; @@ -3651,7 +3687,7 @@ sub postprocess { # convert remaining PAR commands (which are preceded by non-white space characters, usually "}" ($ADDCLOSE) s/\\PAR\n/\n\n/sg; - # package specific processing: + # package specific processing: if ( defined($packages{"endfloat"})) { #endfloat: make sure \begin{figure} and \end{figure} are always # on a line by themselves, similarly for table environment @@ -3664,12 +3700,16 @@ sub postprocess { s/^((?:[^%]+)\\(?:begin|end)\{(?:figure|table)\}(?:\[[a-zA-Z]+\])?)(.+)((?:%.*)?)$/$1\n$2$3/mg; } - # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated + # Remove empty auxiliary LISTENV (sometmes these are generated if list environment occurs within the argument of a deleted comment) + # (slightly hacky but I could not see an easy way to see if in argument of another command when this extra markup is added) + s/\\begin\{($LISTENV)\}$AUXCMD\n((?:\s*\%[^\n]*\n)*\n?)\\end\{\1\}$AUXCMD\n/$2\n/msg ; + + # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated s/\\PERCENTAGE ?/\\%/g; - # Convert '\DOLLAR ' back into '\$' + # Convert '\DOLLAR ' back into '\$' s/\\DOLLAR /\\\$/g; - # undo renaming of the \begin and \end,{,} and dollars in comments + # undo renaming of the \begin and \end,{,} and dollars in comments # although we only renamed $ in comments to DOLLARDIFF, we might have lost the % in unchanged verbatim blocks, so rename all s/DOLLARDIF/\$/g; @@ -3687,7 +3727,7 @@ sub postprocess { # 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/(%.*)\\CFRAC (.*)$/$1\\frac$2/mg ; 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -3698,7 +3738,7 @@ sub postprocess { s/\\QRIGHTBRACE /\\\}/sg; s/\\AMPERSAND /\\&/sg; # Highlight added inline verbatim commands if possible - if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { + if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { # wrap added verb commands with color commands s/\\DIFDIFadd((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*)/\{\\color{blue}$AUXCMD\n\\DIF$1%\n\}$AUXCMD\n/sg; s/\\DIFDIFdel((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*$AUXCMD)/\{\\color{red}${AUXCMD}\n\\DIF$1\n\}${AUXCMD}/sg; @@ -3713,8 +3753,8 @@ sub postprocess { # finally add the comment to the ones not having an optional argument before ###s/\\DIFaddlstinline(?!\[)/\\lstinline\n[basicstyle=\\color{blue}]$AUXCMD\n/g; - return; } + return; } # $out = restore_item_commands($listenviron) @@ -3738,13 +3778,13 @@ sub restore_item_commands { # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) - # the list of commands is defined in CONTEXT2CMD - # if found then use a bodydiff to mark up content, and replace the corresponding commands + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # the list of commands is defined in CONTEXT2CMD + # if found then use a bodydiff to mark up content, and replace the corresponding commands # in both preambles by marked up version to 'fool' the linediff (such that only body is marked up). # A special case are e.g. author commands being added (or removed) # 1. If commands are added, then the entire content is marked up as new, but also the lines are marked as new in the linediff - # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns + # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns # with $auxlines a text to be appended at the end of the preamble, which shows the respective fields as deleted sub preprocess_preamble { my ($oldpreambleref,$newpreambleref)=(\$_[0],\$_[1]) ; @@ -3766,7 +3806,7 @@ EOF $titlecmd = "(?:".join("|",@CONTEXT2CMDLIST).")"; # as context2cmdlist is stored as regex, e.g. ((?-xism:^title$), we need to remove ^- fo # resue in a more complex regex - $titlecmd =~ s/[\$\^]//g; + $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat_n)\])?(?:\{($pat_n)\}))/ms; ###print STDERR "DEBUG:",$titlecmdpat,"\n"; @@ -3792,7 +3832,7 @@ EOF $cmd=shift @newtitlecommands; $optarg=shift @newtitlecommands; $arg=shift @newtitlecommands; - + if ( defined($newhash{$cmd})) { warn "$cmd is used twice in preamble of new file. Reverting to pure line diff mode for preamble.\n"; print STDERR $warnmsgdetail; @@ -3819,7 +3859,7 @@ EOF } $argnew=$newhash{$cmd}->[2]; $argdiff="{" . join("",bodydiff($argold,$argnew)) ."}"; - # Replace \RIGHTBRACE by } + # Replace \RIGHTBRACE by } $argdiff =~ s/\\RIGHTBRACE/}/g; if ( length $optargnew ) { @@ -3834,7 +3874,7 @@ EOF $optargdiff=""; } ### print STDERR "DEBUG s/\\Q$newhash{$cmd}->[0]\\E/\\$cmd$optargdiff$argdiff/s\n"; - # Note: \Q and \E force literal interpretation of what it between them but allow + # Note: \Q and \E force literal interpretation of what it between them but allow # variable interpolation, such that e.g. \title matches just that and not TAB-itle $$newpreambleref=~s/\Q$newhash{$cmd}->[0]\E/\\$cmd$optargdiff$argdiff/s; # replace this in old preamble if necessary @@ -3874,7 +3914,7 @@ EOF #%< old deleted line(s) #%DIF ------- #%DIF mmann-nn -#new appended line %< +#new appended line %< #%DIF ------- # Future extension: mark change explicitly # Assumes: traverse_sequence traverses deletions before insertions in changed sequences @@ -3886,9 +3926,9 @@ sub linediff { my $block = []; my $retseq = []; my @begin=('','',''); # dummy initialisation - my $instring ; + my $instring ; - my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; + my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; push(@$block, "%DIF < " . $seq1->[$_[0]]) }; my $add = sub { if (! scalar @$block) { @begin=('a',$_[0],$_[1]) ;} @@ -3903,12 +3943,12 @@ sub linediff { $instring = sprintf "%%DIF %da%d-%d",$begin[1],$begin[2],$_[1]-1; } elsif ( $begin[0] eq 'c' ) { $instring = sprintf "%%DIF %sc%s", - ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , + ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , ($begin[2]==$_[1]-1) ? "$begin[2]" : $begin[2]."-".($_[1]-1) ; } else { $instring = sprintf "%%DIF %d%s%d",$begin[1],$begin[0],$begin[2]; } - push @$retseq, $instring,@$block, "%DIF -------" ; - $block = []; + push @$retseq, $instring,@$block, "%DIF -------" ; + $block = []; } push @$retseq, $seq2->[$_[1]] }; @@ -3916,7 +3956,7 @@ sub linediff { my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - push @$retseq, @$block if scalar @$block; + push @$retseq, @$block if scalar @$block; return wantarray ? @$retseq : $retseq ; } @@ -3926,23 +3966,23 @@ sub linediff { # init_regex_arr_data(\@array,"TOKEN INIT") # scans DATA file handel for line "%% TOKEN INIT" line # then appends each line not beginning with % into array (as a quoted regex) -# This is used for command lists and configuration variables, but the processing is slightly -# different: +# This is used for command lists and configuration variables, but the processing is slightly +# different: # For lists, the regular expression is extended to include beginning (^) and end ($) markers, to require full-string matching # For configuration variables (and all others), simply an unadorned list is copied sub init_regex_arr_data { my ($arr,$token)=@_; my $copy=0; my ($mode); - if ($token =~ m/COMMANDS/ ) { - $mode=0; # Reading command list + if ($token =~ m/COMMANDS/ ) { + $mode=0; # Reading command list } else { $mode=1; # Reading configuration variables } while (<DATA>) { if ( m/^%%BEGIN $token\s*$/ ) { - $copy=1; + $copy=1; next; } elsif ( m/^%%END $token\s*$/ ) { last; } @@ -4023,17 +4063,18 @@ sub exetime { sub usage { - print STDERR <<"EOF"; + print STDERR <<"EOF"; Usage: $0 [options] old.tex new.tex > diff.tex -Compares two latex files and writes tex code to stdout, which has the same format as new.tex but +Compares two latex files and writes tex code to stdout, which has the same format as new.tex but has all changes relative to old.tex marked up or commented. Note that old.tex and new.tex need to -be real files (not pipes or similar) as they are opened twice. +be real files (not pipes or similar) as they are opened twice. --type=markupstyle -t markupstyle Add code to preamble for selected markup style - Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE + Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT + LUAUNDERLINE [ Default: UNDERLINE ] --subtype=markstyle @@ -4044,7 +4085,7 @@ be real files (not pipes or similar) as they are opened twice. * LABEL subtype is deprecated --floattype=markstyle --f markstyle Add code to preamble for selected style which +-f markstyle Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats so marginal marking can be disabled thus) @@ -4053,11 +4094,11 @@ be real files (not pipes or similar) as they are opened twice. --encoding=enc -e enc Specify encoding of old.tex and new.tex. Typical encodings are - ascii, utf8, latin1, latin9. A list of available encodings can be - obtained by executing + ascii, utf8, latin1, latin9. A list of available encodings can be + obtained by executing perl -MEncode -e 'print join ("\\n",Encode->encodings( ":all" )) ;' [Default encoding is utf8 unless the first few lines of the preamble contain - an invocation "\\usepackage[..]{inputenc} in which case the + an invocation "\\usepackage[..]{inputenc} in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -4074,22 +4115,22 @@ be real files (not pipes or similar) as they are opened twice. --exclude-safecmd=exclude-file --exclude-safecmd="cmd1,cmd2,..." --A exclude-file +-A exclude-file --replace-safecmd=replace-file --append-safecmd=append-file --append-safecmd="cmd1,cmd2,..." -a append-file Exclude from, replace or append to the list of regex - matching commands which are safe to use within the + matching commands which are safe to use within the scope of a \\DIFadd or \\DIFdel command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are ignored). A literal comma within the comma-separated list must be - escaped thus "\\,", Note that the RegEx needs to match the whole of + escaped thus "\\,", Note that the RegEx needs to match the whole of the token, i.e., /^regex\$/ is implied and that the initial "\\" of the command is not included. The --exclude-safecmd - and --append-safecmd options can be combined with the --replace-safecmd + and --append-safecmd options can be combined with the --replace-safecmd option and can be used repeatedly to add cumulatively to the lists. ---exclude-textcmd=exclude-file +--exclude-textcmd=exclude-file --exclude-textcmd="cmd1,cmd2,..." -X exclude-file --replace-textcmd=replace-file @@ -4105,7 +4146,7 @@ be real files (not pipes or similar) as they are opened twice. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. \\caption will only work within a figure - or table. These commands behave like text commands, except when + or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. @@ -4115,7 +4156,7 @@ be real files (not pipes or similar) as they are opened twice. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. - context2 commands are also the only commands in the preamble, whose argument will + context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). @@ -4124,15 +4165,15 @@ be real files (not pipes or similar) as they are opened twice. --append-mboxsafecmd=append-file --append-mboxsafecmd="cmd1,cmd2,..." Define safe commands, which additionally need to be protected by encapsulating - in an \\mbox{..}. This is sometimes needed to get around incompatibilities + in an \\mbox{..}. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE - + --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. --c configfile Available variables: +-c configfile Available variables: ARRENV (RegEx) COUNTERCMD (RegEx) FLOATENV (RegEx) @@ -4151,15 +4192,15 @@ be real files (not pipes or similar) as they are opened twice. --add-to-config varenv1=pattern1,varenv2=pattern2 For configuration variables containing a regular expression (essentially those ending - in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration + in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. varenv must be one of the variables listed above that take a regular - expression as argument, and pattern is any regular expression (which might need to be + expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. --add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote" --packages=pkg1,pkg2,.. - Tell latexdiff that .tex file is processed with the packages in list + Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the preamble, as the preamble is automatically scanned for \\usepackage commands. Use of the --packages option disables automatic scanning, so if for any @@ -4180,57 +4221,57 @@ be real files (not pipes or similar) as they are opened twice. --show-all Show all of the above - NB For all --show commands, no old.tex or new.tex file needs to be given, and no + NB For all --show commands, no old.tex or new.tex file needs to be given, and no differencing takes place. Other configuration options: --allow-spaces Allow spaces between bracketed or braced arguments to commands - [Default requires arguments to directly follow each other without + [Default requires arguments to directly follow each other without intervening spaces] --math-markup=level Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): - off or 0: suppress markup for math environments. Deleted equations will not - appear in diff file. This mode can be used if all the other modes + off or 0: suppress markup for math environments. Deleted equations will not + appear in diff file. This mode can be used if all the other modes cause invalid latex code. whole or 1: Differencing on the level of whole equations. Even trivial changes - to equations cause the whole equation to be marked changed. This - mode can be used if processing in coarse or fine mode results in + to equations cause the whole equation to be marked changed. This + mode can be used if processing in coarse or fine mode results in invalid latex code. coarse or 2: Detect changes within equations marked up with a coarse - granularity; changes in equation type (e.g.displaymath to equation) + granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] fine or 3: Detect small change in equations and mark up and fine granularity. This mode is most suitable, if only minor changes to equations are - expected, e.g. correction of typos. + expected, e.g. correction of typos. --graphics-markup=level Change highlight style for graphics embedded with \\includegraphics commands Possible values for level: none,off or 0: no highlighting for figures new-only or 1: surround newly added or changed figures with a blue frame [Default] - both or 2: highlight new figures with a blue frame and show deleted figures + both or 2: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. - Note that changes to the optional parameters will make the figure appear as changed + Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \\noalign" errors can occur if there are certain types - of changes in tables. In this case please use option --graphics-markup=none as a - work-around. + of changes in tables. In this case please use option --graphics-markup=none as a + work-around. ---no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, +--no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, but the deleted text ist not just invisible in the output, it is also not included in the - diff text file. This can be more robust than just making it invisible. + diff text file. This can be more robust than just making it invisible. ---disable-citation-markup ---disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles +--disable-citation-markup +--disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) --enable-citation-markup ---enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections +--enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections with \\mbox command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4246,14 +4287,14 @@ Miscellaneous options --no-label Suppress inclusion of old and new file names as comment in output file ---visible-label Include old and new filenames (or labels set with --label option) as +--visible-label Include old and new filenames (or labels set with --label option) as visible output --flatten Replace \\input and \\include commands within body by the content of the files in their argument. If \\includeonly is present in the - preamble, only those files are expanded into the document. However, - no recursion is done, i.e. \\input and \\include commands within - included sections are not expanded. The included files are assumed to + preamble, only those files are expanded into the document. However, + no recursion is done, i.e. \\input and \\include commands within + included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further @@ -4276,7 +4317,7 @@ Miscellaneous options -h Show this help text. --ignore-warnings Suppress warnings about inconsistencies in length between input - and parsed strings and missing characters. + and parsed strings and missing characters. --verbose -V Output various status information to stderr during processing. @@ -4288,10 +4329,10 @@ Internal options: These options are mostly for automated use by latexdiff-vc. They can be used directly, but the API should be considered less stable than for the other options. ---no-links Suppress generation of hyperreferences, used for minimal diffs +--no-links Suppress generation of hyperreferences, used for minimal diffs (option --only-changes of latexdiff-vc). EOF - exit 0; + exit 0; } =head1 NAME @@ -4317,8 +4358,8 @@ be real files (not pipes or similar) as they are opened twice (unless C<--encodi The program treats the preamble differently from the main document. Differences between the preambles are found using line-based differencing (similarly to the Unix diff command, but ignoring white -spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a -line present in C<new.tex> but not in C<old.tex>. Discarded lines +spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a +line present in C<new.tex> but not in C<old.tex>. Discarded lines are deactivated by prepending "S<C<%DIF E<lt>>>". Changed blocks are preceded by comment lines giving information about line numbers in the original files. Where there are insignificant differences, the resulting file C<diff.tex> will be similar to @@ -4371,7 +4412,7 @@ curly braces immediately following a command (i.e. a sequence of letters beginning with a backslash) are arguments for that command. As a restriction to condition 1 above it is thus necessary to surround all arguments with curly braces, and to not insert -extraneous spaces. For example, write +extraneous spaces. For example, write \section{\textem{This is an emphasized section title}} @@ -4403,7 +4444,7 @@ but the choice is yours. Any markup within the environment will be removed, and generally everything within the environment will just be taken from the new file. -It is also possible to difference files which do not have a preamble. +It is also possible to difference files which do not have a preamble. In this case, the file is processed in the main document mode, but the definitions of the markup commands are not inserted. @@ -4421,7 +4462,7 @@ the scope of C<\DIFadd>. Added comments are marked by prepending Within deleted blocks text is highlighted with C<\DIFdel>. Deleted comments are marked by prepending "S<C<%DIF E<lt> >>". Non-safe command -and curly braces within deleted blocks are commented out with +and curly braces within deleted blocks are commented out with "S<C<%DIFDELCMD E<lt> >>". @@ -4431,7 +4472,7 @@ and curly braces within deleted blocks are commented out with =head2 Preamble The following options determine the visual markup style by adding the appropriate -command definitions to the preamble. See the end of this section for a description of +command definitions to the preamble. See the end of this section for a description of available styles. =over 4 @@ -4441,15 +4482,16 @@ B<-t markupstyle> Add code to preamble for selected markup style. This option defines C<\DIFadd> and C<\DIFdel> commands. -Available styles: +Available styles: -C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE -CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT> +C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE +CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT +LUAUNDERLINE> [ Default: C<UNDERLINE> ] =item B<--subtype=markstyle> or -B<-s markstyle> +B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines @@ -4462,27 +4504,27 @@ Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> =item B<--floattype=markstyle> or B<-f markstyle> -Add code to preamble for selected style which +Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats -so marginal marking can be disabled thus). This option defines all +so marginal marking can be disabled thus). This option defines all C<\DIF...FL> commands. Available styles: C<FLOATSAFE TRADITIONALSAFE IDENTICAL> [ Default: C<FLOATSAFE> ] -=item B<--encoding=enc> or +=item B<--encoding=enc> or B<-e enc> Specify encoding of old.tex and new.tex. Typical encodings are -C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be -obtained by executing +C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be +obtained by executing C<perl -MEncode -e 'print join ("\n",Encode->encodings( ":all" )) ;' > If this option is used, then old.tex, new.tex are only opened once. [Default encoding is utf8 unless the first few lines of the preamble contain -an invocation C<\usepackage[..]{inputenc}> in which case the +an invocation C<\usepackage[..]{inputenc}> in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -4499,7 +4541,7 @@ C<\DIFaddbeginFL, \DIFaddendFL, \DIFaddFL{..}, (If this option is set B<-t>, B<-s>, and B<-f> options are ignored.) -=item B<--packages=pkg1,pkg2,..> +=item B<--packages=pkg1,pkg2,..> Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the @@ -4510,13 +4552,13 @@ The following packages trigger special behaviour: =over 8 -=item C<endfloat> +=item C<endfloat> Ensure that C<\begin{figure}> and C<\end{figure}> always appear by themselves on a line. =item C<hyperref> -Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and +Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and define new C<\DIFadd> and C<\DIFdel> commands, which provide a wrapper for these commands, using them for the text but not for the link defining command (where any markup would cause errors). @@ -4568,17 +4610,17 @@ B<-A exclude-file> or B<--exclude-safecmd="cmd1,cmd2,..."> =item B<--replace-safecmd=replace-file> -=item B<--append-safecmd=append-file> or +=item B<--append-safecmd=append-file> or B<-a append-file> or B<--append-safecmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions (RegEx) -matching commands which are safe to use within the +matching commands which are safe to use within the scope of a C<\DIFadd> or C<\DIFdel> command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are -ignored). Note that the RegEx needs to match the whole of +ignored). Note that the RegEx needs to match the whole of the token, i.e., /^regex$/ is implied and that the initial -"\" of the command is not included. -The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> +"\" of the command is not included. +The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> option and can be used repeatedly to add cumulatively to the lists. B<--exclude-safecmd> and B<--append-safecmd> can also take a comma separated list as input. If a @@ -4591,7 +4633,7 @@ B<-X exclude-file> or B<--exclude-textcmd="cmd1,cmd2,..."> =item B<--replace-textcmd=replace-file> -=item B<--append-textcmd=append-file> or +=item B<--append-textcmd=append-file> or B<-x append-file> or B<--append-textcmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions @@ -4599,7 +4641,7 @@ matching commands whose last argument is text. See entry for B<--exclude-safecmd> directly above for further details. -=item B<--replace-context1cmd=replace-file> +=item B<--replace-context1cmd=replace-file> =item B<--append-context1cmd=append-file> or @@ -4608,11 +4650,11 @@ entry for B<--exclude-safecmd> directly above for further details. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. C<\caption> will only work within a figure -or table. These commands behave like text commands, except when +or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. -=item B<--replace-context2cmd=replace-file> +=item B<--replace-context2cmd=replace-file> =item B<--append-context2cmd=append-file> or @@ -4622,9 +4664,9 @@ As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. -context2 commands are also the only commands in the preamble, whose argument will be processed in +context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). The algorithm currently cannot cope with repeated context2 commands in the preamble, as they occur e.g. for the C<\author> argument in some journal styles (not in the standard styles, though -If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. +If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. @@ -4633,7 +4675,7 @@ If such a repetition is detected, the whole preamble will be processed in line-b =item B<--append-mboxsafecmd=append-file> or B<--append-mboxsafecmd="cmd1,cmd2,..."> Define safe commands, which additionally need to be protected by encapsulating -in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities +in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE @@ -4647,7 +4689,7 @@ in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE 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): +Available variables (see below for further explanations): C<ARRENV> (RegEx) @@ -4677,10 +4719,10 @@ C<SCALEDELGRAPHICS> (Float) =item B<--add-to-config varenv1=pattern1,varenv2=pattern2,...> For configuration variables, which are a regular expression (essentially those ending -in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration +in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. C<varenv> must be one of the variables listed above that take a regular -expression as argument, and pattern is any regular expression (which might need to be +expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. C<--add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote"> @@ -4700,7 +4742,7 @@ Show values of configuration variables. Combine all --show commands. -NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no +NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no differencing takes place. =back @@ -4717,29 +4759,29 @@ might get lumpeded with preceding commands) so should only be used if the default produces erroneous results. (Default requires arguments to directly follow each other without intervening spaces). -=item B<--math-markup=level> +=item B<--math-markup=level> -Determine granularity of markup in displayed math environments: +Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): -C<off> or C<0>: suppress markup for math environments. Deleted equations will not -appear in diff file. This mode can be used if all the other modes +C<off> or C<0>: suppress markup for math environments. Deleted equations will not +appear in diff file. This mode can be used if all the other modes cause invalid latex code. C<whole> or C<1>: Differencing on the level of whole equations. Even trivial changes -to equations cause the whole equation to be marked changed. This -mode can be used if processing in coarse or fine mode results in +to equations cause the whole equation to be marked changed. This +mode can be used if processing in coarse or fine mode results in invalid latex code. C<coarse> or C<2>: Detect changes within equations marked up with a coarse -granularity; changes in equation type (e.g.displaymath to equation) +granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] C<fine> or C<3>: Detect small change in equations and mark up at fine granularity. This mode is most suitable, if only minor changes to equations are -expected, e.g. correction of typos. +expected, e.g. correction of typos. =item B<--graphics-markup=level> @@ -4751,33 +4793,33 @@ C<none>, C<off> or C<0>: no highlighting for figures C<new-only> or C<1>: surround newly added or changed figures with a blue frame [Default if graphicx package loaded] -C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced +C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. -Note that changes to the optional parameters will make the figure appear as changed +Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \noalign" error can occur if there are certain types -of changes in tables. In this case please use C<--graphics-markup=none> as a -work-around. +of changes in tables. In this case please use C<--graphics-markup=none> as a +work-around. -=item B<--no-del> +=item B<--no-del> -Suppress deleted text from the diff. It is similar in effect to the BOLD style, -but the deleted text ist not just invisible in the output, it is also not included in the diff text file. -This can be more robust than just making it invisible. +Suppress deleted text from the diff. It is similar in effect to the BOLD style, +but the deleted text ist not just invisible in the output, it is also not included in the diff text file. +This can be more robust than just making it invisible. =item B<--disable-citation-markup> or B<--disable-auto-mbox> -Suppress citation markup and markup of other vulnerable commands in styles +Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) =item B<--enable-citation-markup> or B<--enforce-auto-mbox> -Protect citation commands and other vulnerable commands in changed sections +Protect citation commands and other vulnerable commands in changed sections with C<\mbox> command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4823,18 +4865,18 @@ Suppress inclusion of old and new file names as comment in output file =item B<--visible-label> -Include old and new filenames (or labels set with C<--label> option) as +Include old and new filenames (or labels set with C<--label> option) as visible output. =item B<--flatten> Replace C<\input> and C<\include> commands within body by the content of the files in their argument. If C<\includeonly> is present in the -preamble, only those files are expanded into the document. However, -no recursion is done, i.e. C<\input> and C<\include> commands within -included sections are not expanded. The included files are assumed to +preamble, only those files are expanded into the document. However, +no recursion is done, i.e. C<\input> and C<\include> commands within +included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, -respectively, making it possible to organise files into old and new directories. +respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further C<\input> statements. Also handles files included by the import package (C<\import> and C<\subimport>), and C<\subfile> command. @@ -4881,7 +4923,7 @@ Suppress generation of hyperreferences, used for minimal diffs (option --only-ch =back -=head2 Predefined styles +=head2 Predefined styles =head2 Major types @@ -4894,9 +4936,14 @@ The major type determine the markup of plain text and some selected latex comman Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package). +=item C<LUAUNDERLINE> + +Added text is underlined and blue, discarded text is struck out and red +(Requires lua-ul package + LuaLaTeX). + =item C<CTRADITIONAL> -Added text is blue and set in sans-serif, and a red footnote is created for each discarded +Added text is blue and set in sans-serif, and a red footnote is created for each discarded piece of text. (Requires color package) =item C<TRADITIONAL> @@ -4937,13 +4984,13 @@ Added text is set in bold face, discarded is not shown. (also see --no-del optio =item C<PDFCOMMENT> -The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. +The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. =back =head2 Subtypes -The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) +The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) =over 10 @@ -4961,7 +5008,7 @@ from the intended position. An alternative way of marking added passages in blue, and deleted ones in red. (It is recommeneded to use instead the main types to effect colored markup, -although in some cases coloring with dvipscol can be more complete, for example +although in some cases coloring with dvipscol can be more complete, for example with citation commands). =item C<DVIPSCOL> @@ -4976,12 +5023,12 @@ although in some cases coloring with dvipscol can be more complete). can be used to highlight only changed pages, but requires post-processing. It is recommend to not call this option manually but use C<latexdiff-vc> with C<--only-changes> option. Alternatively, use the script given within preamble of diff files made using this style. -=item C<ONLYCHANGEDPAGE> +=item C<ONLYCHANGEDPAGE> also highlights changed pages, without the need for post-processing, but might not work reliably if there is floating material (figures, tables). -=item C<LABEL> +=item C<LABEL> is similar to C<ZLABEL>, but does not need the zref package and works less reliably (deprecated). @@ -4989,7 +5036,7 @@ is similar to C<ZLABEL>, but does not need the zref package and works less relia =head2 Float Types -Some of the markup used in the main text might cause problems when used within +Some of the markup used in the main text might cause problems when used within floats (e.g. figures or tables). For this reason alternative versions of all markup commands are used within floats. The float type defines these alternative commands. @@ -5016,7 +5063,7 @@ Make no difference between the main text and floats. =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 +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: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > @@ -5036,9 +5083,9 @@ C<|subsubsection|paragraph|subparagraph)> ] This option is for advanced users and allows definition of special versions of commands, which do not work as safe commands. Commands in C<CUSTOMDIFCMD> that occur in added or deleted blocks will be given an ADD or DEL prefix. -The prefixed versions of the command must be defined in the preamble, either by putting them +The prefixed versions of the command must be defined in the preamble, either by putting them in the preamble of at least the new file, or by creating a custom preamble file (Option --preamble). -For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that +For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that for the standard markup type, it is not satisfactory to define it as a safe command. Instead, a customised versions without underlining can be defined in the preamble: @@ -5052,7 +5099,7 @@ and then latexdiff should be invoked with the option C<-c CUSTOMDIFCMD=blindtext =item C<FLOATENV> -Environments whose name matches the regular expression in C<FLOATENV> are +Environments whose name matches the regular expression in C<FLOATENV> are considered floats. Within these environments, the I<latexdiff> markup commands are replaced by their FL variaties. @@ -5101,17 +5148,17 @@ If C<--graphics-markup=both> is chosen, C<SCALEDELGRAPHICS> is the factor, by wh =item C<VERBATIMENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: deleted content is commented out, new content is not marked up [ Default: S<C<comment> > ] =item C<VERBATIMLINEENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in line mode, and changes are marked up using the listings package. The markup style is set based on the chosen mains markup type (Option -t), or on an analysis of the preamble. -Note that "listings.sty" must be installed. If this file is not found the fallback solution is to +Note that "listings.sty" must be installed. If this file is not found the fallback solution is to treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV environments. [ Default: S<C<(?:verbatim[*]?|lstlisting> > ] @@ -5122,30 +5169,40 @@ treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV e =over 10 -=item Citations result in overfull boxes +=item Changed citations result in overfull boxes There is an incompatibility between the C<ulem> package, which C<latexdiff> uses for underlining and striking out in the UNDERLINE style, -the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> -command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have two possibilities. +the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> +command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have several possibilities. 1. Use C<CFONT> type markup (option C<-t CFONT>): If this markup is chosen, then changed citations are no longer marked up -with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. +with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. 2. Choose option C<--disable-citation-markup> which turns off the marking up of citations: deleted citations are no longer shown, and -added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older) - +added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older). For custom packages you can define the commands which need to be protected by C<\mbox> with C<--append-mboxsafecmd> and C<--excludemboxsafecmd> options (submit your lists of command as feature request at github page to set the default behaviour of future versions, see section 6) -=item Changes in complicated mathematical equations result in latex processing errors +3. If you are using luatex >= 1.12.0 you can use option LUAUNDERLINE that uses lua-ul instead of ulem for underlining, which does not have this problem (experimental feature). + +=item Changes in complicated mathematical equations result in latex processing errors. + +Try option C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. +=item Deleted parts in equations are not struck out but underlined. -=item How can I just show the pages where changes had been made +This is a limitation of the ulem package that implements the strike-out. If you use the amsmath package, then the strike-out command is redefined in such a way that deleted passages are wrapped with C<\text> command; adding C<\usepackage{amsmath}> to your preamble will trigger this behaviour. (If amsmath is not included directly, but imported by another package, latexdiff will not be able to detect its availability; in this case you can give latexdiff a hint with option C<--packages=amsmath>. -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 + +=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 package to be installed). +=item The character encoding breaks when running latexdiff from powershell. + +This problem is not limited to C<latexdiff> and has to do with the default settings of C<powershell> in Windows. It is recommended to use C<cmd> instead. + =back =head1 BUGS @@ -5158,13 +5215,13 @@ 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>, +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 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 latex, please send me those files, ideally edited to only contain the -offending passage as long as that still reproduces the problem. If your +offending passage as long as that still reproduces the problem. If your file relies on non-standard class files, you must include those. I will not look at examples where I have trouble to latex the original files. @@ -5175,24 +5232,24 @@ L<latexrevise>, L<latexdiff-vc> =head1 PORTABILITY I<latexdiff> does not make use of external commands and thus should run -on any platform supporting Perl 5.6 or higher. If files with encodings +on any platform supporting Perl 5.6 or higher. If files with encodings other than ASCII or UTF-8 are processed, Perl 5.8 or higher is required. The standard version of I<latexdiff> requires installation of the Perl package -C<Algorithm::Diff> (available from I<www.cpan.org> - +C<Algorithm::Diff> (available from I<www.cpan.org> - I<http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15>) but a stand-alone version, I<latexdiff-so>, which has this package inlined, is available, too. I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.3.3 -Copyright (C) 2004-2022 Frederik Tilmann +Version 1.3.4 +Copyright (C) 2004-2024 Frederik Tilmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 -Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, +Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, T. Connors, Sebastian Gouezel and many others. Thanks to the many people who sent in bug reports, feature suggestions, and other feedback. @@ -5463,13 +5520,14 @@ value underline sqrt (SUPER|SUB)SCRIPT -%%END TEXT COMMANDS +%%END TEXT COMMANDS %%BEGIN CONTEXT1 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. These commands behave like text commands, except when they occur in a deleted section, where they are disabled, but their argument is shown as deleted text. caption subcaption -%%END CONTEXT1 COMMANDS +multicolumn +%%END CONTEXT1 COMMANDS %%BEGIN CONTEXT2 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. @@ -5477,7 +5535,7 @@ title author date institute -%%END CONTEXT2 COMMANDS +%%END CONTEXT2 COMMANDS %% CONFIGURATION variabe defaults %%BEGIN LISTENV CONFIG @@ -5555,9 +5613,16 @@ verbatim[*]? \RequirePackage[normalem]{ulem} \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} -\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF END UNDERLINE PREAMBLE +%DIF LUAUNDERLINE PREAMBLE +\RequirePackage{lua-ul} +\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} +\providecommand{\DIFadd}[1]{{\protect\color{blue}\underLine{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\strikeThrough{#1}}} +%DIF END LUAUNDERLINE PREAMBLE + %DIF CTRADITIONAL PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \RequirePackage[stable]{footmisc} @@ -5729,7 +5794,7 @@ verbatim[*]? % To show only pages with changes (dvips/dvipdf) % latex diff.tex % latex diff.tex -% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi +% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi \typeout{Check comments in preamble of output for instructions how to show only pages where changes have been made} \usepackage[user,abspage]{zref} \newcount\DIFcounterb @@ -5749,10 +5814,10 @@ verbatim[*]? \RequirePackage{etoolbox} \RequirePackage{zref} % redefine label command to write immediately to aux file - page references will be lost -\makeatletter \let\oldlabel\label% Store \label -\renewcommand{\label}[1]{% Update \label to write to the .aux immediately -\zref@wrapper@immediate{\oldlabel{#1}}} -\makeatother +\makeatletter \let\oldlabel\label% Store \label +\renewcommand{\label}[1]{% Update \label to write to the .aux immediately +\zref@wrapper@immediate{\oldlabel{#1}}} +\makeatother \newbool{DIFkeeppage} \newbool{DIFchange} \boolfalse{DIFkeeppage} @@ -5770,7 +5835,7 @@ verbatim[*]? \providecommand{\DIFmodend}{\global\booltrue{DIFkeeppage}\global\boolfalse{DIFchange}} %DIF END ONLYCHANGEDPAGE PREAMBLE -%% FLOAT TYPES +%% FLOAT TYPES %DIF FLOATSAFE PREAMBLE \providecommand{\DIFaddFL}[1]{\DIFadd{#1}} @@ -5802,7 +5867,7 @@ verbatim[*]? %DIF END TRADITIONALSAFE PREAMBLE % see: -% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself +% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself %DIF HIGHLIGHTGRAPHICS PREAMBLE \RequirePackage{settobox} @@ -5848,6 +5913,15 @@ verbatim[*]? %% SPECIAL PACKAGE PREAMBLE COMMANDS +%% Redefine strike out command to wrap in text box if amsmath is used and markup style with ulem is used +%DIF AMSMATHULEM PREAMBLE +\makeatletter +\let\sout@orig\sout +\renewcommand{\sout}[1]{\ifmmode\text{\sout@orig{\ensuremath{#1}}}\else\sout@orig{#1}\fi} +\makeatother +%DIF END AMSMATHULEM PREAMBLE + + % Standard \DIFadd and \DIFdel are redefined as \DIFaddtex and \DIFdeltex % when hyperref package is included. %DIF HYPERREF PREAMBLE @@ -5950,7 +6024,7 @@ verbatim[*]? %DIF END DIFCODE_BOLD %DIF DIFCODE_PDFCOMMENT - + moredelim=[il][\color{white}\tiny]{\%DIF\ <\ }, moredelim=[il][\sffamily\bfseries]{\%DIF\ >\ } %DIF END DIFCODE_PDFCOMMENT diff --git a/support/latexdiff/latexdiff-so b/support/latexdiff/latexdiff-so index b3571d27b2..9ab8e4169b 100755 --- a/support/latexdiff/latexdiff-so +++ b/support/latexdiff/latexdiff-so @@ -25,6 +25,21 @@ # # Note references to issue numbers are for the github repository of latexdiff: https://github.com/ftilmann/latexdiff # +# Version 1.3.4: +# New features: +# - Option to use lua-ul instead of ulem (for use with LuaLaTeX) (fix #17, #60, #188, #255, #270) +# Enhancement +# - If amsmath is detected as one of the included (based on idea in PR #263 contributed by github user xlucn +# Bug fix +# - sometimes the introduction of aux commands to show deleted lists or descriptions leaves in place empty auxiliary +# list environments, which would cause error messages (though skipping messages would result in a correct output pdf). +# These are now removed. +# - add more mboxsafecmd and safecmd commands for SIunitx to stay compatible with newer versionsof SIunitx (PR #283, fixing issue #282, contributed by github user joe6302413) +# - File added via --preamble option is no longer assumed to be ASCII, but read either with encoding as defined by --encoding option or using the encoding of the LOCALE (fixes issue #285 ) +# - multicolumn argument is now treated as text +# - when tikz-dependency package is used, \& is no longer a safe command as it has special meaning inside dependency environment. The fix is a little of a hack as really it should only be considered unsafe within dependency environment (fixes (mostly) issue #303 ) +# - listings package had trouble with non-ASCII chars. The encoding is now set (thanks to github user anka-213 for finding this). Fixes #304 +# # Version 1.3.3: # New features: # - Option --no-del to remove all deleted text (merge contributed by github user tdegeus PR #252, fixing issue #66 @@ -33,22 +48,22 @@ # - Abbreviations involving punctuations within them. They need special treatment because otherwise in some # circumstances the gnoring of white space differences in conjunction with merging according to MINWORDSBLOCK rule # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269). A few abbreviations -# are now hard-coded and treated as atomic: +# are now hard-coded and treated as atomic: # English: i.e., e.g. Deutsch: z.B. # (fixes issue #269) # - In WHOLE and COARSE math modes, now properly treat math environments with arguments such as \alignat. Fixes #251 -# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes -# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result -# in errors. (Partially) fixes issues #235 and #244. -# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a -# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which +# - For FINE math mode, multiple improvments to the processing work flow yield more robust outcomes. In particular, changes +# to the equation type, e.g. \begin{displaymath} -> \begin{equation} without modifications now usually no longer result +# in errors. (Partially) fixes issues #235 and #244. +# - When encountering deleted math array environments such as align or eqnarray, rather than replacing them with a +# fixed replacement environment (e.g. align* or eqnarray*), an asterisk is now added to the original command, which # in amsmath (and with eqnarray) will result in the same environment but without line numbers. Config variable MATHARRREPL # is therefore (nearly) redundant, and a depracation warning is given when it is set. Reference to MATHARRREPL are have # been removed from the manual (there is one exception, when it's still being used: sometimes latexdiff can figure out # that there is a deleted array environment, but does not know which one. In this case, MATHARRREPL is still being used -# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). +# to encapsulate these parts of the source, and therefore it is still set internally. But this is a quite rare situation). # Fixes issue #216 -# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. +# - Unlike 'array' environment, 'split' (amsmath) does not work in argument of \DIFadd or \DIFdl in UNDERLINE modes; therefore remove it from ARRENV configuration variable. # Exclude \begin and \end in math environments in COARSE and WHOLE modes. Fixes #258. Fixes #109 # - --flatten now works for empty files. Fixes issue #242 # - improved processing of Chinese and Japanese texts in that splitting is done based on characters. Thanks to LuXu (Oliver Lew) in git for working this out. Fixes #229, fixes #145 @@ -65,7 +80,7 @@ # Bug fixes: # - fix issue #206 affecting proper markup of text commands which are not also safe cmd's and have multiple arguments # - fix issue #210 by adding \eqref (amsmath package) to the list of safe commands -# - fix bug reported in issue #168 mangled verbatim line environment +# - fix bug reported in issue #168 mangled verbatim line environment # - fix bug reported in issue #218 by replacing \hspace{0pt} after \mbox{..} auxiliary commands with \hskip0pt. # - more ways to process \frac correctly with atomic arguments (committed by julianuu PR #246 # - fix a bug in biblatex mode, which prevented proper processing of modified \textcite (see: https://tex.stackexchange.com/questions/555157/latexdiff-and-biblatex-citation-commands) @@ -74,10 +89,10 @@ # Version 1.3.1.1 # - remove spurious \n to fix error: Unknown regexp modifier "/n" at .../latexdiff line 1974, near "=~ " (see github issue #201) # -# Version 1.3.1 +# Version 1.3.1 # Bug fixes: # - remove some uninitialised variable $2 warnings in string substitution in flatten function in case included file is not found -# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) +# - add minimal postprocessing to diff processing of preamble commands (replace \RIGHTBRACE by \} ) # - pre-processing: replace (contributed) routine take_comments_and_enter_from_frac() with take_comments_and_newline_from_frac(), which does the same thing # (remove whitespace characters and comments between the argument of \frac commands) in an easier and more robust way. In addition, it # will replace commands like \frac12 with \frac{1}{2} as pre-processing step. Fixes issue #184 @@ -95,15 +110,15 @@ # Version 1.3.0 (7 October 2018): # - treat options to \documentclass as potential package names (some packages allow implicit loading of or imply selected packages # - improved pattern matching: now allows nested angular brackets, and is no longer confused by escaped curly braces -# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . +# - improved pattern matching in COARSE mode: occasionally, the closing bracket or some other elements would be matched in an 'unnatural' way due to another sequence being more minimal in the computational sense, sometimes even causing errors due to tokens moving in or out of the scope of math environments. This is now discouraged by adding internal \DIFANCHOR commands (which are removed again in post-processing) (fixes issues reported via email by li_ruomeng . # - verbatim and lstlisting environments are marked-up with line-by-line in a similar style to non-verbatim text (requires the listing package to be installed) # (see new configuration variable VERBATIMLINEENV) (several issues and pull requests by jprotze) -# - --flatten: now supports \verbatiminput and \lstlistinput +# - --flatten: now supports \verbatiminput and \lstlistinput # - --flatten: if file is not found, do not fail, simply warn and leave command unexpanded (inspired by issue #112). Don't warn if file name contains #[0-9] as it is then most likely an argument within a command definition rather than an actual file (applies to \input, \subfile, \include commands) # - added to textcmds: \intertext # - new config variable CUSTOMDIFCMD to allow defining special versions of commands in added or deleted blocks (Pull request by github user jprotze) # - added option -no-links (mostly for use by latexdiff-vc in only-changes modes) (Pull request by github user jprotze) -# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) +# - new option --filter-script to run both input through a pre-processing script (PR jasonmccsmith #167) # new option --no-filter-stderr to hide stderr output from filter-script (potentially dangerous, as this might hide malfunctioning of filter scripts) # - --flatten now can deal with imports made using the import package {PR jasonmccsmith #173) # Bug fixes: @@ -122,12 +137,12 @@ # make environments that are treated like verbatim environments configurable (config variable VERBATIMENV) # treat lstinlne as equivalent to verb command # partially addresses issue #38 -# - refactoring: set default configuration variables in a hash, and those that correspond to lists +# - refactoring: set default configuration variables in a hash, and those that correspond to lists # - feature: option --add-to-config used to amend configuration variables, which are regex pattern lists # - bug fix: deleted figures when endfloat package is activated # - bug fix: alignat environment now always processed correctly (fix issues #65) # - bug fix: avoid processing of commands as potential files in routine init_regex_arr (fix issue #70 ) -# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be +# - minimal feature enhancement: treat '@' as allowed character in commands (strictly speaking requires prior \makeatletter statement, but always assuming it to be # @ a letter if it is part of a command name will usually lead to the correct behaviour (see http://tex.stackexchange.com/questions/346651/latexdiff-and-let) # - new feature/bug fix: --flatten option \endinput in included files now respected but only if \endinput stands right at the beginning of the line (issue #77) # - bug fix: flatten would incorrectly attempt to process commented out \include commands (from discussion in issue #77 ) @@ -165,7 +180,7 @@ # - introduce list UNSAFEMATHCMD, which holds list of commands which cannot be marked up with \DIFadd or \DIFdel commands (only relevant for WHOLE and COARSE math markup modes) # - new subtype LABEL which gives each change a label. This can later be used to only display pages where changes # have been made (instructions for that are put as comments into the diff'ed file) inspired by answer on http://tex.stackexchange.com/questions/166049/invisible-markers-in-pdfs-using-pdflatex -# - Configuration variables take into accout some commands from additional packages: +# - Configuration variables take into accout some commands from additional packages: # tikzpicture environment now treated as PICTUREENV, and \smallmatrix in ARRENV (amsmath) # - --flatten: support for \subfile command (subfiles package) (in response to http://tex.stackexchange.com/questions/167620/latexdiff-with-subfiles ) # - --flatten: \bibliography commands expand if corresponding bbl file present @@ -179,11 +194,11 @@ # - \% in one-letter sub/Superscripts was not converted correctly # # Version 1.0.3 -# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator +# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator # command in preamble # - \(..\) inline math expressions were not parsed correctly, if they contained a linebreak # - applied patch contributed by tomflannaghan via Berlios: [ Patch #3431 ] Adds correct handling of \left< and \right> -# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug +# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug # and sketching out the solution) # - \^ and \_ are correctly interpreted as accent and underlined space, respectively, not as superscript of subscript # (thanks to Wail Yahyaoui for pointing out this bug) @@ -191,19 +206,19 @@ # Version 1.0.1 - treat \big,\bigg etc. equivalently to \left and # \right - include starred version in MATHENV - apply # - flatten recursively and --flatten expansion is now -# aware of comments (thanks to Tim Connors for patch) +# aware of comments (thanks to Tim Connors for patch) # - Change to post-processing for more reliability for # deleted math environments -# - On linux systems, recognise and remove DOS style newlines +# - On linux systems, recognise and remove DOS style newlines # - Provide markup for some special preamble commands (\title, -# \author,\date, -# - configurable by setting context2cmd +# \author,\date, +# - configurable by setting context2cmd # - for styles using ulem package, remove \emph and \text.. from list of # safe commands in order to allow linebreaks within the -# highlighted sections. -# - for ulem style, now show citations by enclosing them in \mbox commands. -# This unfortunately implies linebreaks within citations no longer function, -# so this functionality can be turned off (Option --disable-citation-markup). +# highlighted sections. +# - for ulem style, now show citations by enclosing them in \mbox commands. +# This unfortunately implies linebreaks within citations no longer function, +# so this functionality can be turned off (Option --disable-citation-markup). # With --enable-citation-markup, the mbox markup is forced for other styles) # - new substyle COLOR. This is particularly useful for marking up citations # and some special post-processing is implemented to retain cite @@ -211,11 +226,11 @@ # - four different levels of math-markup # - Option --driver for choosing driver for modes employing changebar package # - accept \\* as valid command (and other commands of form \.*). Also accept -# \<nl> (backslashed newline) +# \<nl> (backslashed newline) # - some typo fixes, include commands defined in preamble as safe commands -# (Sebastian Gouezel) +# (Sebastian Gouezel) # - include compared filenames as comments as line 2 and 3 of -# the preamble (can be modified with option --label, and suppressed with +# the preamble (can be modified with option --label, and suppressed with # --no-label), option --visible-label to show files in generated pdf or dvi # at the beginning of main document # @@ -231,7 +246,7 @@ # # Version 0.4 March 06 option for fast differencing using UNIX diff command, several minor bug fixes (\par bug, improved highlighting of textcmds) # -# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces +# Version 0.3 August 05 improved parsing of displayed math, --allow-spaces # option, several minor bug fixes # # Version 0.25 October 04 Fix bug with deleted equations, add math mode commands to safecmd, add | to allowed interpunctuation signs @@ -704,12 +719,13 @@ use utf8 ; use File::Spec ; + my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.3.3 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) - (c) 2004-2022 F J Tilmann +This is LATEXDIFF 1.3.4 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) + (c) 2004-2024 F J Tilmann EOF # Hash with defaults for configuration variables. These marked undef have default values constructed from list defined in the DATA block @@ -800,9 +816,9 @@ my $DELCMDOPEN='%DIFDELCMD < '; # To mark begin of deleted commands (must begin my $DELCMDCLOSE="%%%\n"; # To mark end of deleted commands (must end with a new line) my $AUXCMD='%DIFAUXCMD' ; # follows auxiliary commands put in by latexdiff to make difference file legal # auxiliary commands must be on a line of their own - # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in + # Note that for verbatim environment openings the %DIFAUXCMD cannot be placed in # the same line as this would mean they are shown - # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line + # so the special form "%DIFAUXCMD NEXT" is used to indicate that the next line # is an auxiliary command # Similarly "%DIFAUXCMD LAST" would indicate the auxiliary command is in previous line (not currently used) my $DELCOMMENT='DIF < '; # To mark deleted comment line @@ -813,21 +829,21 @@ my @TEXTCMDLIST=(); # array containing patterns of commands with text arguments my @TEXTCMDEXCL=(); # array containing patterns of commands without text arguments (if a pattern # matches both TEXTCMDLIST and TEXTCMDEXCL it is excluded) my @CONTEXT1CMDLIST=(); # array containing patterns of commands with text arguments (subset of text commands), - # but which cause confusion if used out of context (e.g. \caption). + # but which cause confusion if used out of context (e.g. \caption). # In deleted passages, the command will be disabled but its argument is marked up - # Otherwise they behave exactly like TEXTCMD's + # Otherwise they behave exactly like TEXTCMD's my @CONTEXT1CMDEXCL=(); # exclude list for above, but always empty my @CONTEXT2CMDLIST=(); # array containing patterns of commands with text arguments, but which fail or cause confusion # if used out of context (e.g. \title). They and their arguments will be disabled in deleted # passages my @CONTEXT2CMDEXCL=(); # exclude list for above, but always empty my @MATHTEXTCMDLIST=(); # treat like textcmd. If a textcmd is in deleted or added block, just wrap the - # whole content with \DIFadd or \DIFdel irrespective of content. This functionality + # whole content with \DIFadd or \DIFdel irrespective of content. This functionality # is useful for pseudo commands \MATHBLOCK.. into which math environments are being - # transformed -my @MATHTEXTCMDEXCL=(); # + # transformed +my @MATHTEXTCMDEXCL=(); # -# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these +# Note I need to declare this with "our" instead of "my" because later in the code I have to "local"ise these our @SAFECMDLIST=(); # array containing patterns of safe commands (which do not break when in the argument of DIFadd or DIFDEL) our @SAFECMDEXCL=(); my @MBOXCMDLIST=(); # patterns for commands which are in principle safe but which need to be surrounded by an \mbox @@ -892,7 +908,7 @@ $mathmarkup=COARSE; $verbose=0; $onlyadditions=0; # output debug and intermediate files, set to 0 in final distribution -$debug=0; +$debug=0; # insert preamble directly after documentclass - experimental feature, set to 0 in final distribution # Note that this failed with mini example (or other files, where packages used in latexdiff preamble # are called again with incompatible options in preamble of resulting file) @@ -915,9 +931,9 @@ END my %verbhash; Getopt::Long::Configure('bundling'); -GetOptions('type|t=s' => \$type, - 'subtype|s=s' => \$subtype, - 'floattype|f=s' => \$floattype, +GetOptions('type|t=s' => \$type, + 'subtype|s=s' => \$subtype, + 'floattype|f=s' => \$floattype, 'config|c=s' => \@configlist, 'add-to-config=s' => \@addtoconfiglist, 'preamble|p=s' => \$preamblefile, @@ -966,11 +982,11 @@ if ( $help ) { if ( $version ) { - print STDERR $versionstring ; + print STDERR $versionstring ; exit 0; } -print STDERR $versionstring if $verbose; +print STDERR $versionstring if $verbose; if (defined($showall)){ $showpreamble=$showsafe=$showtext=$showconfig=1; @@ -988,7 +1004,7 @@ if (defined($mathmarkup)) { $mathmarkup=~tr/a-z/A-Z/; if ( $mathmarkup eq 'OFF' ){ $mathmarkup=OFF; - } elsif ( $mathmarkup eq 'WHOLE' ){ + } elsif ( $mathmarkup eq 'WHOLE' ){ $mathmarkup=WHOLE; } elsif ( $mathmarkup eq 'COARSE' ){ $mathmarkup=COARSE; @@ -1091,7 +1107,7 @@ foreach $config ( @configlist ) { } } foreach $assign ( @config ) { - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}=$2; } @@ -1128,7 +1144,7 @@ foreach $key ( keys(%CONFIG) ) { foreach $assign ( @addtoconfig ) { ###print STDERR "assign:|$assign|\n"; - $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; + $assign=~ m/\s*(\w*)\s*=\s*(\S*)\s*$/ or die "Illegal assignment $assign in configuration list (must be variable=value)"; exists $CONFIG{$1} or die "Unknown configuration variable $1."; $CONFIG{$1}.=";$2"; } @@ -1143,8 +1159,8 @@ foreach ( keys(%CONFIG) ) { elsif ( $_ eq "MATHENV" ) { $MATHENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "MATHREPL" ) { $MATHREPL = $CONFIG{$_} ; } elsif ( $_ eq "MATHARRENV" ) { $MATHARRENV = liststringtoregex($CONFIG{$_}) ; } - elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; - print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; + elsif ( $_ eq "MATHARRREPL" ) { $MATHARRREPL = $CONFIG{$_} ; + print STDERR "WARNING: Setting MATHARRREPL is depracated. Generally deleted math array environments will be set to their starred varieties and the setting of MATHARREPL is ignored.\n\n" unless $MATHARRREPL =~ /eqnarray\*/ ; } elsif ( $_ eq "ARRENV" ) { $ARRENV = liststringtoregex($CONFIG{$_}) ; } elsif ( $_ eq "VERBATIMENV" ) { $VERBATIMENV = liststringtoregex($CONFIG{$_}) ; } @@ -1171,11 +1187,11 @@ foreach $pkg ( @packagelist ) { if ($showconfig || $showtext || $showsafe || $showpreamble) { show_configuration(); - exit 0; + exit 0; } -if ( @ARGV != 2 ) { +if ( @ARGV != 2 ) { print STDERR "2 and only 2 non-option arguments required. Write latexdiff -h to get help\n"; exit(2); } @@ -1183,7 +1199,7 @@ if ( @ARGV != 2 ) { # Are extra spaces between command arguments permissible? my $extraspace; if ($allowspaces) { - $extraspace='\s*'; + $extraspace='\s*'; } else { $extraspace=''; } @@ -1206,14 +1222,14 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # 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.'\}|\\\\\{|\\\\\})*'; - # Actually within the text body, quoted braces are replaced in pre-processing. The only place where + # Actually within the text body, quoted braces are replaced in pre-processing. The only place where # the last part of the pattern matters is when processing the arguments of context2cmds in the preamble # and these contain a \{ or \} combination, probably rare. # It should thus be fine to use the simpler version below. ### $pat_n = '(?:[^{}]|\{'.$pat_n.'\})*'; } - my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; + my $brat0 = '(?:[^\[\]]|\\\[|\\\])*'; my $brat_n = $brat0; for (my $i_pat = 0; $i_pat < 4; ++$i_pat){ $brat_n = '(?:[^\[\]]|\['.$brat_n.'\]|\\\[|\\\])*'; @@ -1230,7 +1246,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # could turn 'i.e.' into 'i.\PAR e.' (see https://github.com/ftilmann/latexdiff/issues/269) # English: i.e., e.g. Deutsch: z.B. my $abbreviation='(?:i\. ?e\.|e\. ?g\.|z\. ?B\.)' ; - my $number='-?\d*\.\d*'; + my $number='-?\d*\.\d*'; # word: sequence of letters or accents followed by letter my $word_cj='\p{Han}|\p{InHiragana}|\p{InKatakana}'; @@ -1258,7 +1274,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); # inline math $....$ or \(..\) ### the commented out version is simpler but for some reason cannot cope with newline (in spite of s option) - need to include \newline explicitly ### my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(].*?\\\\[)]'; - my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; + my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ### test version (this seems to give the same results as version above) ## the current maths command cannot cope with newline within the math expression ### my $math='\$(?:[^$]|\\\$)*?\$|\\[(].*?\\[)]'; @@ -1276,7 +1292,7 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); -# now we are done setting up and can start working +# now we are done setting up and can start working my ($oldfile, $newfile) = @ARGV; # check for existence of input files if ( ! -e $oldfile ) { @@ -1304,7 +1320,7 @@ my ($oldtime,$newtime,$oldlabel,$newlabel); if (defined($labels[0])) { $oldlabel=$labels[0] ; } else { - $oldtime=localtime((stat($oldfile))[9]); + $oldtime=localtime((stat($oldfile))[9]); $oldlabel="$oldfile " . " "x($oldlabel_n_spaces) . $oldtime; } if (defined($labels[1])) { @@ -1317,6 +1333,7 @@ if (defined($labels[1])) { $encoding=guess_encoding($newfile) unless defined($encoding); $encoding = "utf8" if $encoding =~ m/^utf8/i ; +print STDERR "Encoding $encoding\n" if $verbose; if (lc($encoding) eq "utf8" ) { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); @@ -1400,7 +1417,7 @@ my @auxlines; my ($ulem)=0; if ( length $oldpreamble && length $newpreamble ) { - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) # and marking up content with latexdiff markup @auxlines=preprocess_preamble($oldpreamble,$newpreamble); @@ -1432,7 +1449,7 @@ if (defined($graphicsmarkup)) { } else { # Default: no explicit setting in menu if ( defined $packages{"graphicx"} or defined $packages{"graphics"} ) { - $graphicsmarkup=NEWONLY; + $graphicsmarkup=NEWONLY; } else { $graphicsmarkup=NONE; } @@ -1465,7 +1482,7 @@ if ($graphicsmarkup != NONE ) { @matches=( $latexdiffpreamble =~ m/command\{\\DIFaddbeginFL}\{($pat_n)}/sg ) ; # we look at the last one of the list to take into account possible redefinition but almost always matches should have exactly one element if ( $matches[$#matches] =~ m/\\DIFaddbegin/ ) { - die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; + die "Cannot combine graphics markup with float styles defining \\DIFaddbeginFL in terms of \\DIFaddbegin. Use --graphics-markup=none option or choose a different float style."; exit 10; } ###} @@ -1479,6 +1496,11 @@ if ($graphicsmarkup != NONE ) { $ulem = ($latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{ulem\}/ || defined $packages{"ulem"}); +# If amsmath is defined and $ulem is used for markup, redefine the \sout command to also work (mostly) in math mode +# See stack exchange https://tex.stackexchange.com/questions/20609/strikeout-in-math-mode/308647#308647 based on comment by Taylor Raine +if ( defined($packages{'amsmath'}) and $ulem ) { + $latexdiffpreamble .= join "\n",(extrapream('AMSMATHULEM'),""); +} # If listings is being used or can be found in the latexdiff search path, add to the preamble auxiliary code to enable line-by-line markup if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @@ -1488,7 +1510,7 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { } my @listingDIFcode=(); my $replaced; - # note that in case user supplies preamblefile the type might not reflect well the + # note that in case user supplies preamblefile the type might not reflect well the actual markup style @listingDIFcode=extrapream("-nofail","DIFCODE_" . $type) unless defined($preamblefile); if (!(@listingDIFcode)) { # if listingDIFcode is empty try to guess a suitable one from the preamble @@ -1502,13 +1524,17 @@ if ( defined($packages{"listings"}) or `kpsewhich listings.sty` ne "" ) { @listingDIFcode=extrapream("DIFCODE_BOLD"); } } - # now splice it in + # add configuration so that listings work with utf-8 + push @listingpreamble, '\lstset{extendedchars=\true,inputencoding='.$encoding."}\n"; + + + # now splice it in $replaced=0; ###print STDERR "DEBUG: listingDIFcode: ",join("\n",@listingDIFcode),"|||\n" if $debug; - @listingpreamble=grep { + @listingpreamble=grep { # only replace if this has not been done already (use short-circuit property of and) - if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { + if (!$replaced and $_ =~ s/^.*%DIFCODE TEMPLATE.*$/join("\n",@listingDIFcode)/e ) { ###print STDERR "DEBUG: Replaced text $_\n" if $debug; $replaced=1; 1; @@ -1538,7 +1564,7 @@ if ( length $oldpreamble && length $newpreamble ) { unshift @oldpreamble,''; @diffpreamble = linediff(\@oldpreamble, \@newpreamble); # remove dummy line again - shift @diffpreamble; + shift @diffpreamble; # add filenames, modification time and latexdiff mark defined($nolabel) or splice @diffpreamble,1,0, "%DIF LATEXDIFF DIFFERENCE FILE", @@ -1587,8 +1613,8 @@ if (defined $packages{"siunitx"} ) { # protect SI command by surrounding them with an \mbox # this is done to get around an incompatibility between the ulem and siunitx package print STDERR "siunitx package detected.\n" if $verbose ; - my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange'; - init_regex_arr_list(\@SAFECMDLIST,'num,si'); + my $mboxcmds='SI,ang,numlist,numrange,SIlist,SIrange,qty,qtylist,qtyproduct,qtyrange,complexqty'; + init_regex_arr_list(\@SAFECMDLIST,'num,si,numproduct,unit,complexnum'); if ( $enablecitmark || ( $ulem && ! $disablecitmark )) { init_regex_arr_list(\@MBOXCMDLIST,$mboxcmds); } else { @@ -1610,7 +1636,7 @@ if (defined $packages{"cleveref"} ) { if (defined $packages{"glossaries"} ) { # protect selected command by surrounding them with an \mbox - # this is done to get around an incompatibility between ulem and glossaries package + # this is done to get around an incompatibility between ulem and glossaries package print STDERR "glossaries package detected.\n" if $verbose ; my $mboxcmds='[gG][lL][sS](?:|pl|disp|link|first|firstplural|desc|user[iv][iv]?[iv]?),[aA][cC][rR](?:long|longpl|full|fullpl),[aA][cC][lfp]?[lfp]?'; init_regex_arr_list(\@SAFECMDLIST,'[gG][lL][sS](?:(?:entry)?(?:text|plural|name|symbol)|displaynumberlist|entryfirst|entryfirstplural|entrydesc|entrydescplural|entrysymbolplural|entryuser[iv][iv]?[iv]?|entrynumberlist|entrydisplaynumberlist|entrylong|entrylongpl|entryshort|entryshortpl|entryfull|entryfullpl),[gG]lossentry(?:name|desc|symbol),[aA][cC][rR](?:short|shortpl),[aA]csp?'); @@ -1639,6 +1665,10 @@ if (defined $packages{"mhchem"} ) { # push(@MATHTEXTCMDLIST,'cee'); } +if ( defined $packages{"tikz-dependency"} ) { + init_regex_arr_ext(\@SAFECMDEXCL, 'AMPERSAND'); +} + my ( $citpat); @@ -1726,7 +1756,7 @@ print STDERR "(",exetime()," s)\n","Done.\n" if $verbose; # liststringtoregex(liststring) -# expands string with semi-colon separated list into a regular expression corresponding +# expands string with semi-colon separated list into a regular expression corresponding # matching any of the elements sub liststringtoregex { my ($liststring)=@_; @@ -1739,7 +1769,7 @@ sub liststringtoregex { } # show_configuration -# note that this is not encapsulated but uses variables from the main program +# note that this is not encapsulated but uses variables from the main program # It is provided for convenience because in the future it is planned to allow output # to be modified based on what packages are read etc - this works only if the input files are actually read # whether or not additional files are provided @@ -1766,7 +1796,7 @@ sub show_configuration { print "\nContext1 commands (last argument textual, command will be disabled in deleted passages, last argument will be shown as plain text):\n"; print_regex_arr(@CONTEXT1CMDLIST); print "\nContext2 commands (last argument textual, command and its argument will be disabled in deleted passages):\n"; - print_regex_arr(@CONTEXT2CMDLIST); + print_regex_arr(@CONTEXT2CMDLIST); print "\nExclude list of Commands with last argument not textual (overrides patterns above):\n"; print_regex_arr(@TEXTCMDEXCL); } @@ -1874,7 +1904,7 @@ sub list_packages { my %packages=(); my $pkg; - # remove comments + # remove comments $preamble=~s/(?<!\\)%.*$//mg ; while ( $preamble =~ m/\\(?:documentclass|usepackage|RequirePackage)(?:\[($brat_n)\])?\{(.*?)\}/gs ) { @@ -1979,7 +2009,7 @@ sub flatten { my ($includeonly,$dirname,$fname,$newpage,$fullfile,$filecontent,$replacement,$begline,$inputcmd,$bblfile,$subfile,$command,$verbenv,$verboptions,$ignore,$fileonly); my ($subpreamble,$subbody,$subpost); my ($subdir,$subdirfull,$importfilepath); - require File::Basename ; + require File::Basename ; ### require File::Spec ; # now this is needed even if flatten option not given $filename = File::Spec->rel2abs( $filename ) ; ($ignore, $dirname, $fileonly) = File::Spec->splitpath($filename) ; @@ -2019,15 +2049,15 @@ sub flatten { $subdirfull = (defined($3) ? File::Spec->catdir($dirname,$subdir) : $subdir); $importfilepath = File::Spec->catfile($subdirfull, $fname); - + print STDERR "importing importfilepath:", $importfilepath,"\n" if $verbose; if ( -f $importfilepath ) { # If file exists, replace input or include command with expanded input #TODO: need remove_endinput & newpage similar to other replacements inside flatten - $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); + $replacement=flatten(read_file_with_encoding($importfilepath, $encoding), $preamble,$importfilepath,$encoding); } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$importfilepath,". I will continue but not expand |$2|\n"; $replacement = $2; $replacement .= "{$subdir}{$fname} % Processed"; @@ -2036,13 +2066,13 @@ sub flatten { }/exgm; # recursively replace \\input and \\include files - $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ + $text =~ s/(^(?:[^%\n]|\\%)*)(\\input\{(.*?)\}|\\include\{(${includeonly}(?:\.tex)?)\})/{ $begline=(defined($1)? $1 : "") ; $inputcmd=$2; $fname = $3 if defined($3) ; $fname = $4 if defined($4) ; $newpage=(defined($4)? " \\newpage " : "") ; - # # add tex extension unless there is a three or four letter extension already + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}$|; $fullfile = File::Spec->catfile($dirname,$fname); print STDERR "DEBUG Beg of line match |$1|\n" if defined($1) && $debug ; @@ -2051,12 +2081,12 @@ sub flatten { # content of file becomes replacement value (use recursion), add \newpage if the command was include if ( -f $fullfile ) { # If file exists, replace input or include command with expanded input - $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); - $replacement = remove_endinput($replacement); + $replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding); + $replacement = remove_endinput($replacement); # \include always starts a new page; use explicit \newpage command to simulate this } else { # if file does not exist, do not expand include or input command (do not warn if fname contains #[0-9] as it is then likely part of a command definition - # and is not meant to be expanded directly + # and is not meant to be expanded directly print STDERR "WARNING: Could not find included file ",$fullfile,". I will continue but not expand |$inputcmd|\n" unless $fname =~ m(#[0-9]) ; $replacement = $inputcmd ; # i.e. just the original command again -> make no change file does not exist $newpage=""; @@ -2065,7 +2095,7 @@ sub flatten { }/exgm; # replace bibliography with bbl file if it exists - $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ if ( -f $bblfile ){ $replacement=read_file_with_encoding(File::Spec->catfile($bblfile), $encoding); } else { @@ -2077,10 +2107,10 @@ sub flatten { }/exgm; # replace subfile with contents (subfile package) - $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; - $fname = $2; - # # add tex extension unless there is a three or four letter extension already + $fname = $2; + # # add tex extension unless there is a three or four letter extension already $fname .= ".tex" unless $fname =~ m|\.\w{3,4}|; print STDERR "Include file as subfile $fname\n" if $verbose; # content of file becomes replacement value (use recursion) @@ -2091,10 +2121,10 @@ sub flatten { # if file exists, expand \subfile command by contents of file $subfile=read_file_with_encoding($fullfile,$encoding) or die "Could not open included subfile ",$fullfile,": $!"; ($subpreamble,$subbody,$subpost)=splitdoc($subfile,'\\\\begin\{document\}','\\\\end\{document\}'); - ### $subfile=~s|^.*\\begin{document}||s; + ### $subfile=~s|^.*\\begin{document}||s; ### $subfile=~s|\\end{document}.*$||s; $replacement=flatten($subbody, $preamble,$fullfile,$encoding); - ### $replacement = remove_endinput($replacement); + ### $replacement = remove_endinput($replacement); } else { # if file does not exist, do not expand subfile print STDERR "WARNING: Could not find subfile ",$fullfile,". I will continue but not expand |$2|\n" unless $fname =~ m(#[0-9]) ; @@ -2105,11 +2135,11 @@ sub flatten { }/exgm; # replace \verbatiminput and \lstlistinginput - $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ + $text=~s/(^(?:[^%\n]|\\%)*)\\(verbatiminput\*?|lstinputlisting)$extraspace(\[$brat_n\])?$extraspace\{(.*?)\}/{ $begline=(defined($1)? $1 : "") ; $command = $2 ; $fname = $4 ; - $verboptions = defined($3)? $3 : "" ; + $verboptions = defined($3)? $3 : "" ; if ($command eq 'verbatiminput' ) { $verbenv = "verbatim" ; } elsif ($command eq 'verbatiminput*' ) { @@ -2118,7 +2148,7 @@ sub flatten { $verbenv = "lstlisting" ; } else { die "Internal errorL Unexpected verbatim input type $command.\n"; - } + } print STDERR "DEBUG Beg of line match |$begline|\n" if $debug ; print STDERR "Include file $fname verbatim\n" if $verbose; print STDERR "DEBUG looking for file ",File::Spec->catfile($dirname,$fname), "\n" if $debug; @@ -2150,8 +2180,8 @@ sub print_regex_arr { # if $type is a filename, it will read the file instead of reading from the appendix # otherwise it will screen appendix for line "%DIF $TYPE" and copy everything up to line # '%DIF END $TYPE' (where $TYPE is upcased version of $type) -# extrapream('-nofail',$type) will---instead of failing---simply return nothing if -# it does not find the matching line in a appendix (do not use -nofail option with multiple types!) +# extrapream('-nofail',$type) will---instead of failing---simply return nothing if +# it does not find the matching line in appendix (do not use -nofail option with multiple types!) sub extrapream { my @types=@_; my ($type,$arg); @@ -2168,14 +2198,20 @@ sub extrapream { $type=$arg; $copy=0; if ( -f $type || lc $type eq '/dev/null' ) { - open (FILE,$type) or die "Cannot open preamble file $type: $!"; print STDERR "Reading preamble file $type\n" if $verbose ; + open (FILE,$type) or die "Cannot open preamble file $type: $!"; + if (defined($encoding)) { + binmode(FILE,":encoding($encoding)"); + } else { + require Encode::Locale; + binmode(FILE,":encoding(locale)"); + } while (<FILE>) { chomp ; if ( $_ =~ m/%DIF PREAMBLE/ ) { - push (@retval,"$_"); + push (@retval,"$_"); } else { - push (@retval,"$_ %DIF PREAMBLE"); + push (@retval,"$_ %DIF PREAMBLE"); } } } else { # not (-f $type) @@ -2187,9 +2223,9 @@ sub extrapream { my $data_start = tell DATA; while (<DATA>) { if ( m/^%DIF $type/ ) { - $copy=1; + $copy=1; } elsif ( m/^%DIF END $type/ ) { - last; + last; } chomp; push (@retval,"$_ %DIF PREAMBLE") if $copy; @@ -2229,7 +2265,7 @@ sub splitdoc { $pos=pos $rest; $part2=substr($rest,0,$pos-length($2)); $part3=substr($rest,$pos); - } + } else { die "$word1 and $word2 not in the correct order or not present as a pair." ; } @@ -2301,7 +2337,7 @@ sub splitlatex { my $leadin=$1; length($string)>0 or return ($leadin); - my @retval=($string =~ m/$pat/osg); + my @retval=($string =~ m/$pat/osg); if (length($string) != length(join("",@retval))) { print STDERR "\nWARNING: Inconsistency in length of input string and parsed string:\n This often indicates faulty or non-standard latex code.\n In many cases you can ignore this and the following warning messages.\n Note that character numbers in the following are counted beginning after \\begin{document} and are only approximate." unless $ignorewarnings; @@ -2345,17 +2381,17 @@ sub splitlatex { # pass1( \@seq1,\@seq2) # Look for differences between seq1 and seq2. -# Where an common-subsequence block is flanked by deleted or appended blocks, +# Where an common-subsequence block is flanked by deleted or appended blocks, # and is shorter than $MINWORDSBLOCK words it is appended -# to the last deleted or appended word. If the block contains tokens other than words +# to the last deleted or appended word. If the block contains tokens other than words # or punctuation it is not merged. # Deleted or appended block consisting of words and safe commands only are # also merged, to prevent break-up in pass2 (after previous isolated words have been removed) -# If there are commands with textual arguments (e.g. \caption) both in corresponding -# appended and deleted blocks split them such that the command and opening bracket -# are one token, then the rest is split up following standard rules, and the closing +# If there are commands with textual arguments (e.g. \caption) both in corresponding +# appended and deleted blocks split them such that the command and opening bracket +# are one token, then the rest is split up following standard rules, and the closing # bracket is a separate token, ie. turn -# "\caption{This is a textual argument}" into +# "\caption{This is a textual argument}" into # ("\caption{","This ","is ","a ","textual ","argument","}") # No return value. Destructively changes sequences sub pass1 { @@ -2384,15 +2420,15 @@ sub pass1 { my $adddiscard = sub { if ($cnt > 0 ) { $matblkcnt++; - # just after an unchanged block + # just after an unchanged block # print STDERR "Unchanged block $cnt, $last1,$last2 \n"; - if ($cnt < $MINWORDSBLOCK + if ($cnt < $MINWORDSBLOCK && $cnt==scalar ( - grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + grep { /^$wpat/ || ( /^\\((?:[`'^"~=.]|[\w\d@*]+))((?:\[$brat_n\]|\{$pat_n\})*)/o + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && scalar(@dummy=split(" ",$2))<3 ) } @$block) ) { - # merge identical blocks shorter than $MINWORDSBLOCK + # merge identical blocks shorter than $MINWORDSBLOCK # and only containing ordinary words # with preceding different word # We cannot carry out this merging immediately as this @@ -2400,23 +2436,23 @@ sub pass1 { # the algorithm, instead we store in @$todo where we have to merge push(@$todo, [ $last1,$last2,$cnt,@$block ]); } - $block = []; + $block = []; $cnt=0; $last1=-1; $last2=-1; } }; my $discard=sub { $deltokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$delblock,[ $seq1->[$_[0]],$_[0] ]); - $last1=$_[0] }; + $last1=$_[0] }; my $add = sub { $addtokcnt++; &$adddiscard; #($_[0],$_[1]); push(@$addblock,[ $seq2->[$_[1]],$_[1] ]); - $last2=$_[1] }; + $last2=$_[1] }; my $match = sub { $mattokcnt++; if ($cnt==0) { # first word of matching sequence after changed sequence or at beginning of word sequence - $deltextblocks = extracttextblocks($delblock); + $deltextblocks = extracttextblocks($delblock); $delblkcnt++ if scalar @$delblock; $addtextblocks = extracttextblocks($addblock); $addblkcnt++ if scalar @$addblock; @@ -2432,7 +2468,7 @@ sub pass1 { ### Algorithm::Diff 1.19 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, 0, sub { $_[0]->[0] } ); } else { - ### Algorithm::Diff 1.15 + ### Algorithm::Diff 1.15 $matchindex=Algorithm::Diff::_longestCommonSubsequence($delcmds,$addcmds, sub { $_[0]->[0] } ); } @@ -2463,11 +2499,11 @@ sub pass1 { my ($index,$block,$cnt)=@{ shift(@$addtextblocks) }; push(@$todo, [-1,$index,$cnt,@$block]); } - + $addblock=[]; $delblock=[]; } - push(@$block,$seq2->[$_[1]]); + push(@$block,$seq2->[$_[1]]); $cnt++ }; my $keyfunc = sub { join(" ",split(" ",shift())) }; @@ -2475,7 +2511,7 @@ sub pass1 { traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - # now carry out the merging/splitting. Refer to elements relative from + # now carry out the merging/splitting. Refer to elements relative from # the end (with negative indices) as these offsets don't change before the instruction is executed # cnt>0: merged small unchanged groups with previous changed blocks # cnt==-1: split textual commands into components @@ -2490,7 +2526,7 @@ sub pass1 { } } - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens in $matblkcnt blocks.\n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2500,10 +2536,10 @@ sub pass1 { # extracttextblocks(\@blockindex) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form # [[ $index, $textblock, $cnt ], .. # where $index index of block to be merged # $textblock contains all the words to be merged with the word at $index (but does not contain this word) @@ -2511,7 +2547,7 @@ sub pass1 { # # requires: iscmd # -sub extracttextblocks { +sub extracttextblocks { my $block=shift; my ($i,$token,$index); my $textblock=[]; @@ -2521,13 +2557,13 @@ sub extracttextblocks { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # store pure text blocks - if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ - && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) + if ($token =~ /$wpat/ || ( $token =~/^\\((?:[`'^"~=.]|[\w\d@\*]+))((?:${extraspace}\[$brat_n\]${extraspace}|${extraspace}\{$pat_n\})*)/ + && iscmd($1,\@SAFECMDLIST,\@SAFECMDEXCL) && !iscmd($1,\@TEXTCMDLIST,\@TEXTCMDEXCL))) { # we have text or a command which can be treated as text if ($last<0) { @@ -2535,7 +2571,7 @@ sub extracttextblocks { $last=$index; } else { # add to pure-text block - push(@$textblock, $token); + push(@$textblock, $token); } } else { # it is not text @@ -2556,29 +2592,29 @@ sub extracttextblocks { # extractcommands( \@blockindex ) -# $blockindex has the following format -# [ [ token1, index1 ], [token2, index2],.. ] -# where index refers to the index in the original old or new word sequence -# Returns: reference to an array of the form -# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. -# where index is just taken from input array -# command must have a textual argument as last argument -# -# requires: iscmd -# -sub extractcommands { +# $blockindex has the following format +# [ [ token1, index1 ], [token2, index2],.. ] +# where index refers to the index in the original old or new word sequence +# Returns: reference to an array of the form +# [ [ "\cmd1", index, "\cmd1[optarg]{arg1}{", "arg2" ,"} " ],.. +# where index is just taken from input array +# command must have a textual argument as last argument +# +# requires: iscmd +# +sub extractcommands { my $block=shift; my ($i,$token,$index,$cmd,$open,$mid,$closing); my $retval=[]; # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace='\s*'; + my $extraspace='\s*'; for ($i=0;$i< scalar @$block;$i++) { ($token,$index)=@{ $block->[$i] }; # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: \cmd @@ -2586,7 +2622,7 @@ sub extractcommands { # $4: } + trailing spaces if ( ( $token =~ m/^(\\([\w\d\*]+)(?:${extraspace}\[$brat_n\]|${extraspace}\{$pat_n\})*${extraspace}\{)($pat_n)(\}\s*)$/so ) && iscmd($2,\@TEXTCMDLIST,\@TEXTCMDEXCL) ) { - print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; + print STDERR "DEBUG EXTRACTCOMMANDS Match |$1|$2|$3|$4|$index \n" if $debug; # push(@$retval,[ $2,$index,$1,$3,$4 ]); ($cmd,$open,$mid,$closing) = ($2,$1,$3,$4) ; $closing =~ s/\}/\\RIGHTBRACE/ ; @@ -2597,7 +2633,7 @@ sub extractcommands { } # iscmd($cmd,\@regexarray,\@regexexcl) checks -# return 1 if $cmd matches any of the patterns in the +# return 1 if $cmd matches any of the patterns in the # array $@regexarray, and none of the patterns in \@regexexcl, otherwise return 0 sub iscmd { my ($cmd,$regexar,$regexexcl)=@_; @@ -2605,7 +2641,7 @@ sub iscmd { ### print STDERR "DEBUG: iscmd($cmd)=" if $debug; foreach $pat ( @$regexar ) { if ( $cmd =~ m/^${pat}$/ ) { - $ret=1 ; + $ret=1 ; last; } } @@ -2621,13 +2657,13 @@ sub iscmd { # pass2( \@seq1,\@seq2) -# Look for differences between seq1 and seq2. +# Look for differences between seq1 and seq2. # Mark begin and end of deleted and appended sequences with tags $DELOPEN and $DELCLOSE # and $ADDOPEN and $ADDCLOSE, respectively, however exclude { } & and all comands, unless # they match an element of the whitelist (SAFECMD) # For words in TEXTCMD but not in SAFECMD, enclose interior with $ADDOPEN and $ADDCLOSE brackets -# Deleted comment lines are marked with %DIF < -# Added comment lines are marked with %DIF > +# Deleted comment lines are marked with %DIF < +# Added comment lines are marked with %DIF > sub pass2 { my $seq1 = shift ; my $seq2 = shift ; @@ -2659,7 +2695,7 @@ sub pass2 { $addhunk = []; } push(@$retval,$seq2->[$_[1]]) }; - + my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); @@ -2668,7 +2704,7 @@ sub pass2 { push @$retval,marktags($ADDMARKOPEN,$ADDMARKCLOSE,$ADDOPEN,$ADDCLOSE,"","",$ADDCOMMENT,$addhunk) if scalar @$addhunk; - if ($verbose) { + if ($verbose) { print STDERR "\n"; print STDERR " $mattokcnt matching tokens. \n"; print STDERR " $deltokcnt discarded tokens in $delblkcnt blocks.\n"; @@ -2690,7 +2726,7 @@ sub marktags { my (@argtext); my $retval=[]; my $noncomment=0; - my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word + my $cmd=-1; # -1 at beginning 0: last token written is a ordinary word # 1: last token written is a command # for keeping track whether we are just in a command sequence or in a word sequence my $cmdcomment= ($opencmd =~ m/^%/); # Flag to indicate whether opencmd is a comment (i.e. if we intend to simply comment out changed commands) @@ -2706,31 +2742,31 @@ sub marktags { # we redefine locally $extraspace (shadowing the global definition) to capture command sequences with intervening spaces no matter what the global setting # this is done so we can capture those commands with a predefined number of arguments without having to introduce them again explicitly here - my $extraspace_mt='\s*'; + my $extraspace_mt='\s*'; foreach (@$block) { - $word=$_; + $word=$_; if ( $word =~ s/^%/%$comment/ ) { # a comment if ($cmd==1) { push (@$retval,$closecmd) ; $cmd=-1; } - push (@$retval,$word); + push (@$retval,$word); next; } if ( $word =~ m/^\s*$/ ) { ### print STDERR "DEBUG MARKTAGS: whitespace detected |$word| cmdcom |$cmdcomment| |$opencmd|\n" if $debug; # a sequence of white-space characters - this should only ever happen for the first element of block. - # in deleted block, omit, otherwise just copy it in + # in deleted block, omit, otherwise just copy it in if ( ! $cmdcomment) { # ignore in deleted blocks push(@$retval,$word); } next; } if (! $noncomment) { - push (@$retval,$openmark); + push (@$retval,$openmark); $noncomment=1; } # negative lookahead pattern (?!) in second clause is put in to avoid matching \( .. \) patterns @@ -2740,7 +2776,7 @@ sub marktags { # word is a command or other significant token (not in SAFECMDLIST) ## same conditions as in subroutine extractcommand: # check if token is an alphanumeric command sequence with at least one non-optional argument - # \cmd[...]{...}{last argument} + # \cmd[...]{...}{last argument} # Capturing in the following results in these associations # $1: \cmd[...]{...}{ # $2: cmd @@ -2757,11 +2793,11 @@ sub marktags { # Condition 3: But if we are in a deleted block ($cmdcomment=1) and # $2 (the command) is in context2, just treat it as an ordinary command (i.e. comment it open with $opencmd) # Because we do not want to disable this command - # here we do not use $opencmd and $closecmd($opencmd is empty) + # here we do not use $opencmd and $closecmd($opencmd is empty) print STDERR "DEBUG: Detected text |$word| but not safe command \$2: $2 \$3: $3\n." if $debug; if ($cmd==1) { push (@$retval,$closecmd) ; - } elsif ($cmd==0) { + } elsif ($cmd==0) { push (@$retval,$close) ; } $command=$1; $commandword=$2; $closingbracket=$4; @@ -2777,16 +2813,16 @@ sub marktags { # for latexrevise push (@$retval,$command,"%\n{$AUXCMD\n",marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } elsif ( iscmd($commandword,,\@MATHTEXTCMDLIST, \@MATHTEXTCMDEXCL) ) { - # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) - # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to + # MATHBLOCK pseudo command: consider all commands safe, except & and \\, \begin and \end and a few package sprcific one (look at UNSAFEMATHCMD definition) + # Keep these commands even in deleted blocks, hence set $opencmd and $closecmd (5th and 6th argument of marktags) to # "" - local @SAFECMDLIST=(".*"); + local @SAFECMDLIST=(".*"); local @SAFECMDEXCL=('\\','\\\\',@UNSAFEMATHCMD); push(@$retval,$command,marktags("","",$open,$close,"","",$comment,\@argtext)#@argtext ,$closingbracket); } else { # normal textcmd or context1cmd in an added block - push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); + push (@$retval,$command,marktags("","",$open,$close,$opencmd,$closecmd,$comment,\@argtext),$closingbracket); } push (@$retval,$AUXCMD,"\n") if $cmdcomment ; $cmd=-1 ; @@ -2872,10 +2908,10 @@ sub take_comments_and_newline_from_frac() { # names or labels but it does not matter because they are converted back in the postprocessing step # Returns: leading white space removed in step 1 sub preprocess { - for (@_) { + for (@_) { - # change in \verb and similar commands - note that I introduce an extra space here so that the + # change in \verb and similar commands - note that I introduce an extra space here so that the # already hashed variants do not trigger again # transform \lstinline{...} # s/\\lstinline(\[$brat0\])?(\{(?:.*?)\})/"\\DIFlstinline". $1 ."{". tohash(\%verbhash,"$2") ."}"/esg; @@ -2905,7 +2941,7 @@ sub preprocess { 1 while s/(?<!\\)_(\s*{($pat_n)})/\\SUBSCRIPT$1/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} 1 while s/(?<!\\)\^(\s*([^{\\\s]|\\\w+))/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/(?<!\\)\^(\s*{($pat_n)})/\\SUPERSCRIPT$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 ; @@ -2925,16 +2961,16 @@ sub preprocess { if ( $mathmarkup != FINE ) { # DIFANCHORARRB and DIFANCHORARRE, DIFANCHORMATHB and DIFANCHORMATHE markers are inserted here to encourage the matching algorithm # to always match up the closing brace. Otherwise sometimes one ends up with a situation where - # the closing brace is deleted and added at another point. The deleted closing brace is then + # the closing brace is deleted and added at another point. The deleted closing brace is then # prevented by a %DIFDELCMD, leading to material leaking in or out of the math environment. # The anchors are removed in post-processing again. (note that they are simple text to cause least amount of complications - # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to + # Admittedly, this is something of a hack and will not always work. If it does not, then one needs to # resort to WHOLE or FINE, or NONE math mode processing. s/\\begin\{($ARRENV)}(.*?)\\end\{\1}/\\ARRAYBLOCK$1\{$2\\DIFANCHORARRB \}\\DIFANCHORARRE /sg; take_comments_and_newline_from_frac(); - # Convert Math environments with arguments + # Convert Math environments with arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}((?:\[$brat_n\])|(?:\{$pat_n\}))+(.*?)\\end\{\1\}/\\MATHBLOCK$1\[$2\]\{$3\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; # Convert Math environments without arguments s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\end\{\1\}/\\MATHBLOCK$1\{$2\\DIFANCHORMATHB \}\\DIFANCHORMATHE /sg; @@ -2948,7 +2984,7 @@ sub preprocess { # $expanded=linecomment($string) #preface all lines with verbatim marker (usually DIFVRB) -sub linecomment { +sub linecomment { my @verbatimlines=split("\n",$_[0]); # the first line needs special treatment - we do want to retain optional arguments as is but wrap the remainder also with VERBCOMMENT ### print STDERR "DEBUG: before verbatimlines[0] = ",$verbatimlines[0],"\n"; @@ -2958,7 +2994,7 @@ sub linecomment { } # $simple=reverselinecomment($env $string) -# remove DIFVRB comments but leave changed lines marked +# remove DIFVRB comments but leave changed lines marked sub reverselinecomment { my ($environment, $verbatimtext)=@_; ### print STDERR "DEBUG REVERSELINECOMMENT input: $environment,|$verbatimtext|\n" if $debug; @@ -2973,7 +3009,7 @@ sub reverselinecomment { $verbatimtext =~ s/\\DIFdelend //g; $verbatimtext =~ s/$DELCMDOPEN.*//g; - # remove DIFVRB mark + # remove DIFVRB mark $verbatimtext=~ s/%$VERBCOMMENT//g; # remove part of the markup in changed lines @@ -3064,7 +3100,7 @@ sub writedebugfile { # * Remove STOP token from the end # * Replace \RIGHTBRACE by } # * If option --no-del is set delete all deleted blocks -# 1. Check all deleted blocks: +# 1. Check all deleted blocks: # a.where a deleted block contains a matching \begin and # \end environment (these will be disabled by a %DIFDELCMD statements), for selected environments enable # these commands again (such that for example displayed math in a deleted equation @@ -3085,14 +3121,14 @@ sub writedebugfile { # For added blocks: # c. If in-line math mode contains array environment, enclose the whole environment in \mbox'es # d. place \cite commands in mbox'es (for UNDERLINE style) -# +# # 2. If math-mode COARSE,WHOLE or NONE option set: Convert \MATHBLOCKmath{..} commands back to environments # # Convert all PICTUREblock{..} commands back to the appropriate environments # 3. Convert DIFadd, DIFdel, DIFaddbegin , ... into FL varieties # within floats (currently recognised float environments: plate,table,figure # plus starred varieties). -# 4. Remove empty %DIFDELCMD < lines +# 4. Remove empty %DIFDELCMD < lines # 4. Convert \begin{SQUAREBRACKET} \end{SQUAREBRACKET} into \[ \] # Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$ # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} @@ -3105,7 +3141,7 @@ sub writedebugfile { # 4, undo renaming of the \begin, \end,{,} in comments # Change \QLEFTBRACE, \QRIGHTBRACE,\AMPERSAND to \{,\},\& # -# Note have to manually synchronize substitution commands below and +# Note have to manually synchronize substitution commands below and # DIF.. command names in the header sub postprocess { my ($begin,$len,$float,$delblock,$addblock); ### $cnt @@ -3117,7 +3153,7 @@ sub postprocess { my (@itemargs, $itemarg); - for (@_) { + for (@_) { # change $'s in comments to something harmless 1 while s/(%.*)\$/$1DOLLARDIF/mg ; @@ -3127,7 +3163,7 @@ sub postprocess { # the only way to get these is as %DIFDELCMD < \RIGHTBRACE construction # This essentially marks closing right braces of MATHBLOCK environments, which did not get matched # up. This case should be rare, so I just leave this in the diff file output. Not really elegant - # but can still be dealt with later if it results in problems. + # but can still be dealt with later if it results in problems. s/%DIFDELCMD < \\RIGHTBRACE/%DIFDELCMD < \\MBLOCKRIGHTBRACE/g ; # Replace \RIGHTBRACE by } s/\\RIGHTBRACE/}/g; @@ -3155,7 +3191,7 @@ sub postprocess { $len=length($&); $begin=pos($_) - $len; $delblock=$&; - ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following + ### A much simpler method for math replacement might follow this strategy (can recycle part of the commands below for following ### this strategy: ### 1. a Insert aux commands \begin{MATHMODE} or \end{MATHMODE} for all deleted commands opening or closing displayed math mode ### b Insert aux commands \begin{MATHARRMODE} or \end{MATHARRMODE} for all deleted commands opening or closing math array mode @@ -3181,14 +3217,14 @@ sub postprocess { ###0.5: $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end\{MATHMODE\}$AUXCMD\n$1$3\n\\begin\{MATHMODE\}$AUXCMD\n$4/sg; - # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\begin{$MATHREPL}$AUXCMD\n/sg ) { ### print STDERR "BINGO: begin block: \nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug ; $delblock =~ s/(\\DIFdelend$)/\\end{$MATHREPL}$AUXCMD\n$1/s ; ### print STDERR "After: |" . $delblock . "|\n\n" if $debug ; } - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end\{MATHMODE\}$AUXCMD\n/sg ) { ### print STDERR "BINGO: end block:\nBefore: |" . substr($_,$begin,$len) . "|\n" if $debug; @@ -3211,15 +3247,15 @@ sub postprocess { $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg; ### print STDERR "STEP1: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} + # now look for unpaired %DIFDELCMD < \begin{MATHARRENV}; if found add \begin{$MATHARRREPL} and insert \end{$MATHARRREPL} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\begin\{($MATHARRENV)\}(.*?)(?:$DELCMDCLOSE|\n))/$1\\begin{$2*}$3$AUXCMD\n/sg ) { $arrenv=$2; - $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}}$AUXCMD\n$1/s ; + $delblock =~ s/(\\DIFdelend$)/\\end{$arrenv*}$AUXCMD\n$1/s ; } ### print STDERR "STEP2: |" . $delblock . "|\n\n" if $debug ; - # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} + # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \h*\\end\{($MATHARRENV)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end{MATHMODE}$AUXCMD\n/sg ) { $delblock =~ s/(\\DIFdelend$)/\\begin{MATHMODE}$AUXCMD\n$1/s ; @@ -3237,7 +3273,7 @@ sub postprocess { ### $eqarrayblock=~ s/(\%DIFDELCMD < \s*(\&|\\\\)\s*?(?:$DELCMDCLOSE|\n))/$1$2$AUXCMD\n/sg ; $eqarrayblock =~ s/(\%DIFDELCMD < (.*?(?:\&|\\\\).*)(?:$DELCMDCLOSE|\n))/ # The pattern captures comments with at least one of & or \\ - @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence + @symbols= split(m@((?:&|\\\\)\s*)@,$2); # extract & and \\ and other material from sequence @symbols= grep ( m@&|\\\\\s*@, @symbols); # select & and \\ (and subsequent spaces) "$1@symbols$AUXCMD\n" /eg ; @@ -3250,7 +3286,7 @@ sub postprocess { } elsif ( $mathmarkup == COARSE || $mathmarkup == WHOLE ) { # 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 their starred variety + # will be replaced by their starred variety $delblock=~ s/\\MATHBLOCK($MATHENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$MATHREPL$2\{$3\}/sg; $delblock=~ s/\\MATHBLOCK($MATHARRENV)((?:\[$brat_n\])?)\{($pat_n)\}/\\MATHBLOCK$1\*$2\{$3\}/sg; } @@ -3264,10 +3300,10 @@ sub postprocess { print STDERR "DELBLOCK after maths processing: |" . $delblock . "|\n\n" if $debug ; - # Reinstate completely deleted list environments. note that items within the + # 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 + ### # 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; @@ -3301,7 +3337,7 @@ sub postprocess { ### if ($CITE2CMD) { ###### ${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})) .*?%%%\n ### $delblock=~s/($DELCMDOPEN\s*\\($CITE2CMD)(.*)$DELCMDCLOSE)/ - ### # Replacement code + ### # Replacement code ### {my ($aux,$all); ### $aux=$all=$1; ### $aux=~s#\n?($DELCMDOPEN|$DELCMDCLOSE)##g; @@ -3311,7 +3347,7 @@ sub postprocess { ### if ($CITECMD) { ###### $delblock=~s/(\\($CITECMD)${extraspace}(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; ### $delblock=~s/(\\($CITECMD)${extraspace}(?:<$abrat0>${extraspace})?(?:\[$brat0\]${extraspace}){0,2}\{$pat_n\})(\s*)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/msg ; - ### } + ### } # if MBOXINLINEMATH is set, protect inlined math environments with an extra mbox @@ -3319,7 +3355,7 @@ sub postprocess { # note additional \newline after command is omitted from output if right at the end of deleted block (otherwise a spurious empty line is generated) $delblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/)) { ### # change included verbatim environments ### $delblock =~ s/\\DIFverb\{/\\DIFDIFdelverb\{/g; ### $delblock =~ s/\\DIFlstinline/\\DIFDIFdellstinline/g; @@ -3361,7 +3397,7 @@ sub postprocess { ##$addblock=~s/($math)/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; $addblock=~s/($math)(?:[\s\n]*)?/\\mbox{$AUXCMD\n$1\n}$AUXCMD\n/sg; } - ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { + ###if ( defined($packages{"listings"} and $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat0\])?\{color\}/)) { # mark added verbatim commands $addblock =~ s/\\DIFverb/\\DIFDIFaddverb/g; $addblock =~ s/\\DIFlstinline/\\DIFDIFaddlstinline/g; @@ -3379,11 +3415,11 @@ 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. + # 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\})/ ; + @textparts=split /(?<!$DELCMDOPEN)(\\(?:begin|end)\{$LISTENV\})/ ; @liststack=(); - @newtextparts=map { + @newtextparts=map { ### print STDERR ":::::::: $_\n"; if ( ($listtype) = m/^\\begin\{($LISTENV)\}$/ ) { print STDERR "DEBUG: postprocess \\begin{$listtype}\n" if $debug; @@ -3399,7 +3435,7 @@ sub postprocess { } 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 + # 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 @@ -3412,17 +3448,17 @@ sub postprocess { # Replace MATHMODE environments from step 1a above by the correct Math environment and remove unncessary pairings - + if ( $mathmarkup == FINE ) { # look for AUXCMD math-mode pairs which have only comments (or empty lines between them), and remove the added commands # \begin{..} ... \end{..} pairs - s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; + s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end\{\1\}$AUXCMD\n/$2/sg; # \end{..} .... \begin{..} pairs - s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; + s/\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET|MATHMODE)\}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\begin\{\1\}$AUXCMD\n/$2/sg; writedebugfile($_,'postprocess15'); # The next line is complicated. The negative look-ahead insertion makes sure that no \end{$MATHENV} (or other mathematical - # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching + # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching # is not globally minimal but only 'locally' (matching is beginning from the left side of the string) # [NB: Do not be tempted to prettify the expression with /x modified. It seems this is applied after strings are expanded so will ignore spaces in strings 1 while s/(?<!$DELCMDOPEN)\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:${DELCMDOPEN}[^\n]*|.(?!(?:\\end\{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin\{MATHMODE})))*?)\\end\{MATHMODE}/\\begin{$1}$2\\end{$1}/s; @@ -3497,7 +3533,7 @@ sub postprocess { # remove empty DIFCMD < lines s/^\Q${DELCMDOPEN}\E\n//msg; - # Expand hashes of verb and verbatim environments + # Expand hashes of verb and verbatim environments s/${DELCMDOPEN}\\($VERBATIMENV)\{([-\d]*?)\}/"${DELCMDOPEN}\\begin{${1}}".fromhash(\%verbhash,$2,$DELCMDOPEN)."${DELCMDOPEN}\\end{${1}}"/esg; # revert changes to verbatim environments for line diffs (and add code to mark up changes) (note negative look behind assertions to not leak out of DIFDELCMD comments) # Example: @@ -3523,8 +3559,8 @@ sub postprocess { ((?:\%\Q$DELCOMMENT$VERBCOMMENT\E[^\n]*?\n)*) # Deleted \end command of verbatim environment. Note that the type is forced to match the opening. Captures: $5: Whole deleted environment (previous way this line was written: (\Q$DELCMDOPEN\E\\end\{\2\}(?:\n|\s|\Q$DELCMDOPEN\E)*\Q$DELCMDCLOSE\E) (\Q$DELCMDOPEN\E\\end\{\2\}) - / # Substitution part - $1 # Leave expression as is + / # Substitution part + $1 # Leave expression as is . "$AUXCMD NEXT\n" # Mark the following line as an auxiliary command . "" # reinstate the original environment without options . reverselinecomment($2, "$3$4") # modify the body to change the markup; reverselinecomment parses for options @@ -3533,7 +3569,7 @@ sub postprocess { /esgx; # Modifiers of substitution command writedebugfile($_,'postprocess2'); # where changes have occurred in verbatim environment, change verbatim to DIFverbatim to allow mark-up - # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim + # (I use the presence of optional paramater to verbatim environment as the marker - normal verbatim # environment does not take optional arguments) s/(?<!$DELCMDOPEN)\\begin\{(verbatim[*]?)\}(\[$brat_n\].*?)\\end\{\1\}/\\begin{DIF$1}$2\\end{DIF$1}/sg; @@ -3547,7 +3583,7 @@ sub postprocess { # convert remaining PAR commands (which are preceded by non-white space characters, usually "}" ($ADDCLOSE) s/\\PAR\n/\n\n/sg; - # package specific processing: + # package specific processing: if ( defined($packages{"endfloat"})) { #endfloat: make sure \begin{figure} and \end{figure} are always # on a line by themselves, similarly for table environment @@ -3560,12 +3596,16 @@ sub postprocess { s/^((?:[^%]+)\\(?:begin|end)\{(?:figure|table)\}(?:\[[a-zA-Z]+\])?)(.+)((?:%.*)?)$/$1\n$2$3/mg; } - # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated + # Remove empty auxiliary LISTENV (sometmes these are generated if list environment occurs within the argument of a deleted comment) + # (slightly hacky but I could not see an easy way to see if in argument of another command when this extra markup is added) + s/\\begin\{($LISTENV)\}$AUXCMD\n((?:\s*\%[^\n]*\n)*\n?)\\end\{\1\}$AUXCMD\n/$2\n/msg ; + + # Convert '\PERCENTAGE ' back into '\%' (the final question mark catches a special situation where due to a latter pre-processing step the ' ' becomes separated s/\\PERCENTAGE ?/\\%/g; - # Convert '\DOLLAR ' back into '\$' + # Convert '\DOLLAR ' back into '\$' s/\\DOLLAR /\\\$/g; - # undo renaming of the \begin and \end,{,} and dollars in comments + # undo renaming of the \begin and \end,{,} and dollars in comments # although we only renamed $ in comments to DOLLARDIFF, we might have lost the % in unchanged verbatim blocks, so rename all s/DOLLARDIF/\$/g; @@ -3583,7 +3623,7 @@ sub postprocess { # 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/(%.*)\\CFRAC (.*)$/$1\\frac$2/mg ; 1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ; 1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ; @@ -3594,7 +3634,7 @@ sub postprocess { s/\\QRIGHTBRACE /\\\}/sg; s/\\AMPERSAND /\\&/sg; # Highlight added inline verbatim commands if possible - if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { + if ( $latexdiffpreamble =~ /\\RequirePackage(?:\[$brat_n\])?\{color\}/ ) { # wrap added verb commands with color commands s/\\DIFDIFadd((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*)/\{\\color{blue}$AUXCMD\n\\DIF$1%\n\}$AUXCMD\n/sg; s/\\DIFDIFdel((?:verb\*?|lstinline(?:\[$brat_n\])?)\{[-\d]*?\}[\s\n]*$AUXCMD)/\{\\color{red}${AUXCMD}\n\\DIF$1\n\}${AUXCMD}/sg; @@ -3609,8 +3649,8 @@ sub postprocess { # finally add the comment to the ones not having an optional argument before ###s/\\DIFaddlstinline(?!\[)/\\lstinline\n[basicstyle=\\color{blue}]$AUXCMD\n/g; - return; } + return; } # $out = restore_item_commands($listenviron) @@ -3634,13 +3674,13 @@ sub restore_item_commands { # @auxlines=preprocess_preamble($oldpreamble,$newpreamble); - # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) - # the list of commands is defined in CONTEXT2CMD - # if found then use a bodydiff to mark up content, and replace the corresponding commands + # pre-process preamble by looking for commands used in \maketitle (title, author, date etc commands) + # the list of commands is defined in CONTEXT2CMD + # if found then use a bodydiff to mark up content, and replace the corresponding commands # in both preambles by marked up version to 'fool' the linediff (such that only body is marked up). # A special case are e.g. author commands being added (or removed) # 1. If commands are added, then the entire content is marked up as new, but also the lines are marked as new in the linediff - # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns + # 2. If commands are removed, then the linediff will mark the line as deleted. The program returns # with $auxlines a text to be appended at the end of the preamble, which shows the respective fields as deleted sub preprocess_preamble { my ($oldpreambleref,$newpreambleref)=(\$_[0],\$_[1]) ; @@ -3662,7 +3702,7 @@ EOF $titlecmd = "(?:".join("|",@CONTEXT2CMDLIST).")"; # as context2cmdlist is stored as regex, e.g. ((?-xism:^title$), we need to remove ^- fo # resue in a more complex regex - $titlecmd =~ s/[\$\^]//g; + $titlecmd =~ s/[\$\^]//g; # make sure to not match on comment lines: $titlecmdpat=qr/^(?:[^%\n]|\\%)*(\\($titlecmd)$extraspace(?:\[($brat_n)\])?(?:\{($pat_n)\}))/ms; ###print STDERR "DEBUG:",$titlecmdpat,"\n"; @@ -3688,7 +3728,7 @@ EOF $cmd=shift @newtitlecommands; $optarg=shift @newtitlecommands; $arg=shift @newtitlecommands; - + if ( defined($newhash{$cmd})) { warn "$cmd is used twice in preamble of new file. Reverting to pure line diff mode for preamble.\n"; print STDERR $warnmsgdetail; @@ -3715,7 +3755,7 @@ EOF } $argnew=$newhash{$cmd}->[2]; $argdiff="{" . join("",bodydiff($argold,$argnew)) ."}"; - # Replace \RIGHTBRACE by } + # Replace \RIGHTBRACE by } $argdiff =~ s/\\RIGHTBRACE/}/g; if ( length $optargnew ) { @@ -3730,7 +3770,7 @@ EOF $optargdiff=""; } ### print STDERR "DEBUG s/\\Q$newhash{$cmd}->[0]\\E/\\$cmd$optargdiff$argdiff/s\n"; - # Note: \Q and \E force literal interpretation of what it between them but allow + # Note: \Q and \E force literal interpretation of what it between them but allow # variable interpolation, such that e.g. \title matches just that and not TAB-itle $$newpreambleref=~s/\Q$newhash{$cmd}->[0]\E/\\$cmd$optargdiff$argdiff/s; # replace this in old preamble if necessary @@ -3770,7 +3810,7 @@ EOF #%< old deleted line(s) #%DIF ------- #%DIF mmann-nn -#new appended line %< +#new appended line %< #%DIF ------- # Future extension: mark change explicitly # Assumes: traverse_sequence traverses deletions before insertions in changed sequences @@ -3782,9 +3822,9 @@ sub linediff { my $block = []; my $retseq = []; my @begin=('','',''); # dummy initialisation - my $instring ; + my $instring ; - my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; + my $discard = sub { @begin=('d',$_[0],$_[1]) unless scalar @$block ; push(@$block, "%DIF < " . $seq1->[$_[0]]) }; my $add = sub { if (! scalar @$block) { @begin=('a',$_[0],$_[1]) ;} @@ -3799,12 +3839,12 @@ sub linediff { $instring = sprintf "%%DIF %da%d-%d",$begin[1],$begin[2],$_[1]-1; } elsif ( $begin[0] eq 'c' ) { $instring = sprintf "%%DIF %sc%s", - ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , + ($begin[1]==$_[0]-1) ? "$begin[1]" : $begin[1]."-".($_[0]-1) , ($begin[2]==$_[1]-1) ? "$begin[2]" : $begin[2]."-".($_[1]-1) ; } else { $instring = sprintf "%%DIF %d%s%d",$begin[1],$begin[0],$begin[2]; } - push @$retseq, $instring,@$block, "%DIF -------" ; - $block = []; + push @$retseq, $instring,@$block, "%DIF -------" ; + $block = []; } push @$retseq, $seq2->[$_[1]] }; @@ -3812,7 +3852,7 @@ sub linediff { my $keyfunc = sub { join(" ",split(" ",shift())) }; traverse_sequences($seq1,$seq2, { MATCH=>$match, DISCARD_A=>$discard, DISCARD_B=>$add }, $keyfunc ); - push @$retseq, @$block if scalar @$block; + push @$retseq, @$block if scalar @$block; return wantarray ? @$retseq : $retseq ; } @@ -3822,23 +3862,23 @@ sub linediff { # init_regex_arr_data(\@array,"TOKEN INIT") # scans DATA file handel for line "%% TOKEN INIT" line # then appends each line not beginning with % into array (as a quoted regex) -# This is used for command lists and configuration variables, but the processing is slightly -# different: +# This is used for command lists and configuration variables, but the processing is slightly +# different: # For lists, the regular expression is extended to include beginning (^) and end ($) markers, to require full-string matching # For configuration variables (and all others), simply an unadorned list is copied sub init_regex_arr_data { my ($arr,$token)=@_; my $copy=0; my ($mode); - if ($token =~ m/COMMANDS/ ) { - $mode=0; # Reading command list + if ($token =~ m/COMMANDS/ ) { + $mode=0; # Reading command list } else { $mode=1; # Reading configuration variables } while (<DATA>) { if ( m/^%%BEGIN $token\s*$/ ) { - $copy=1; + $copy=1; next; } elsif ( m/^%%END $token\s*$/ ) { last; } @@ -3919,17 +3959,18 @@ sub exetime { sub usage { - print STDERR <<"EOF"; + print STDERR <<"EOF"; Usage: $0 [options] old.tex new.tex > diff.tex -Compares two latex files and writes tex code to stdout, which has the same format as new.tex but +Compares two latex files and writes tex code to stdout, which has the same format as new.tex but has all changes relative to old.tex marked up or commented. Note that old.tex and new.tex need to -be real files (not pipes or similar) as they are opened twice. +be real files (not pipes or similar) as they are opened twice. --type=markupstyle -t markupstyle Add code to preamble for selected markup style - Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE + Available styles: UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT + LUAUNDERLINE [ Default: UNDERLINE ] --subtype=markstyle @@ -3940,7 +3981,7 @@ be real files (not pipes or similar) as they are opened twice. * LABEL subtype is deprecated --floattype=markstyle --f markstyle Add code to preamble for selected style which +-f markstyle Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats so marginal marking can be disabled thus) @@ -3949,11 +3990,11 @@ be real files (not pipes or similar) as they are opened twice. --encoding=enc -e enc Specify encoding of old.tex and new.tex. Typical encodings are - ascii, utf8, latin1, latin9. A list of available encodings can be - obtained by executing + ascii, utf8, latin1, latin9. A list of available encodings can be + obtained by executing perl -MEncode -e 'print join ("\\n",Encode->encodings( ":all" )) ;' [Default encoding is utf8 unless the first few lines of the preamble contain - an invocation "\\usepackage[..]{inputenc} in which case the + an invocation "\\usepackage[..]{inputenc} in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -3970,22 +4011,22 @@ be real files (not pipes or similar) as they are opened twice. --exclude-safecmd=exclude-file --exclude-safecmd="cmd1,cmd2,..." --A exclude-file +-A exclude-file --replace-safecmd=replace-file --append-safecmd=append-file --append-safecmd="cmd1,cmd2,..." -a append-file Exclude from, replace or append to the list of regex - matching commands which are safe to use within the + matching commands which are safe to use within the scope of a \\DIFadd or \\DIFdel command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are ignored). A literal comma within the comma-separated list must be - escaped thus "\\,", Note that the RegEx needs to match the whole of + escaped thus "\\,", Note that the RegEx needs to match the whole of the token, i.e., /^regex\$/ is implied and that the initial "\\" of the command is not included. The --exclude-safecmd - and --append-safecmd options can be combined with the --replace-safecmd + and --append-safecmd options can be combined with the --replace-safecmd option and can be used repeatedly to add cumulatively to the lists. ---exclude-textcmd=exclude-file +--exclude-textcmd=exclude-file --exclude-textcmd="cmd1,cmd2,..." -X exclude-file --replace-textcmd=replace-file @@ -4001,7 +4042,7 @@ be real files (not pipes or similar) as they are opened twice. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. \\caption will only work within a figure - or table. These commands behave like text commands, except when + or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. @@ -4011,7 +4052,7 @@ be real files (not pipes or similar) as they are opened twice. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. - context2 commands are also the only commands in the preamble, whose argument will + context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). @@ -4020,15 +4061,15 @@ be real files (not pipes or similar) as they are opened twice. --append-mboxsafecmd=append-file --append-mboxsafecmd="cmd1,cmd2,..." Define safe commands, which additionally need to be protected by encapsulating - in an \\mbox{..}. This is sometimes needed to get around incompatibilities + in an \\mbox{..}. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE - + --config var1=val1,var2=val2,... -c var1=val1,.. Set configuration variables. --c configfile Available variables: +-c configfile Available variables: ARRENV (RegEx) COUNTERCMD (RegEx) FLOATENV (RegEx) @@ -4047,15 +4088,15 @@ be real files (not pipes or similar) as they are opened twice. --add-to-config varenv1=pattern1,varenv2=pattern2 For configuration variables containing a regular expression (essentially those ending - in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration + in ENV, and COUNTERCMD) this provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. varenv must be one of the variables listed above that take a regular - expression as argument, and pattern is any regular expression (which might need to be + expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. --add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote" --packages=pkg1,pkg2,.. - Tell latexdiff that .tex file is processed with the packages in list + Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the preamble, as the preamble is automatically scanned for \\usepackage commands. Use of the --packages option disables automatic scanning, so if for any @@ -4076,57 +4117,57 @@ be real files (not pipes or similar) as they are opened twice. --show-all Show all of the above - NB For all --show commands, no old.tex or new.tex file needs to be given, and no + NB For all --show commands, no old.tex or new.tex file needs to be given, and no differencing takes place. Other configuration options: --allow-spaces Allow spaces between bracketed or braced arguments to commands - [Default requires arguments to directly follow each other without + [Default requires arguments to directly follow each other without intervening spaces] --math-markup=level Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): - off or 0: suppress markup for math environments. Deleted equations will not - appear in diff file. This mode can be used if all the other modes + off or 0: suppress markup for math environments. Deleted equations will not + appear in diff file. This mode can be used if all the other modes cause invalid latex code. whole or 1: Differencing on the level of whole equations. Even trivial changes - to equations cause the whole equation to be marked changed. This - mode can be used if processing in coarse or fine mode results in + to equations cause the whole equation to be marked changed. This + mode can be used if processing in coarse or fine mode results in invalid latex code. coarse or 2: Detect changes within equations marked up with a coarse - granularity; changes in equation type (e.g.displaymath to equation) + granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] fine or 3: Detect small change in equations and mark up and fine granularity. This mode is most suitable, if only minor changes to equations are - expected, e.g. correction of typos. + expected, e.g. correction of typos. --graphics-markup=level Change highlight style for graphics embedded with \\includegraphics commands Possible values for level: none,off or 0: no highlighting for figures new-only or 1: surround newly added or changed figures with a blue frame [Default] - both or 2: highlight new figures with a blue frame and show deleted figures + both or 2: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. - Note that changes to the optional parameters will make the figure appear as changed + Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \\noalign" errors can occur if there are certain types - of changes in tables. In this case please use option --graphics-markup=none as a - work-around. + of changes in tables. In this case please use option --graphics-markup=none as a + work-around. ---no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, +--no-del Suppress deleted text from the diff. It is similar in effect to the BOLD style, but the deleted text ist not just invisible in the output, it is also not included in the - diff text file. This can be more robust than just making it invisible. + diff text file. This can be more robust than just making it invisible. ---disable-citation-markup ---disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles +--disable-citation-markup +--disable-auto-mbox Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) --enable-citation-markup ---enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections +--enforce-auto-mbox Protect citation commands and other vulnerable commands in changed sections with \\mbox command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4142,14 +4183,14 @@ Miscellaneous options --no-label Suppress inclusion of old and new file names as comment in output file ---visible-label Include old and new filenames (or labels set with --label option) as +--visible-label Include old and new filenames (or labels set with --label option) as visible output --flatten Replace \\input and \\include commands within body by the content of the files in their argument. If \\includeonly is present in the - preamble, only those files are expanded into the document. However, - no recursion is done, i.e. \\input and \\include commands within - included sections are not expanded. The included files are assumed to + preamble, only those files are expanded into the document. However, + no recursion is done, i.e. \\input and \\include commands within + included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further @@ -4172,7 +4213,7 @@ Miscellaneous options -h Show this help text. --ignore-warnings Suppress warnings about inconsistencies in length between input - and parsed strings and missing characters. + and parsed strings and missing characters. --verbose -V Output various status information to stderr during processing. @@ -4184,10 +4225,10 @@ Internal options: These options are mostly for automated use by latexdiff-vc. They can be used directly, but the API should be considered less stable than for the other options. ---no-links Suppress generation of hyperreferences, used for minimal diffs +--no-links Suppress generation of hyperreferences, used for minimal diffs (option --only-changes of latexdiff-vc). EOF - exit 0; + exit 0; } =head1 NAME @@ -4213,8 +4254,8 @@ be real files (not pipes or similar) as they are opened twice (unless C<--encodi The program treats the preamble differently from the main document. Differences between the preambles are found using line-based differencing (similarly to the Unix diff command, but ignoring white -spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a -line present in C<new.tex> but not in C<old.tex>. Discarded lines +spaces). A comment, "S<C<%DIF E<gt>>>" is appended to each added line, i.e. a +line present in C<new.tex> but not in C<old.tex>. Discarded lines are deactivated by prepending "S<C<%DIF E<lt>>>". Changed blocks are preceded by comment lines giving information about line numbers in the original files. Where there are insignificant differences, the resulting file C<diff.tex> will be similar to @@ -4267,7 +4308,7 @@ curly braces immediately following a command (i.e. a sequence of letters beginning with a backslash) are arguments for that command. As a restriction to condition 1 above it is thus necessary to surround all arguments with curly braces, and to not insert -extraneous spaces. For example, write +extraneous spaces. For example, write \section{\textem{This is an emphasized section title}} @@ -4299,7 +4340,7 @@ but the choice is yours. Any markup within the environment will be removed, and generally everything within the environment will just be taken from the new file. -It is also possible to difference files which do not have a preamble. +It is also possible to difference files which do not have a preamble. In this case, the file is processed in the main document mode, but the definitions of the markup commands are not inserted. @@ -4317,7 +4358,7 @@ the scope of C<\DIFadd>. Added comments are marked by prepending Within deleted blocks text is highlighted with C<\DIFdel>. Deleted comments are marked by prepending "S<C<%DIF E<lt> >>". Non-safe command -and curly braces within deleted blocks are commented out with +and curly braces within deleted blocks are commented out with "S<C<%DIFDELCMD E<lt> >>". @@ -4327,7 +4368,7 @@ and curly braces within deleted blocks are commented out with =head2 Preamble The following options determine the visual markup style by adding the appropriate -command definitions to the preamble. See the end of this section for a description of +command definitions to the preamble. See the end of this section for a description of available styles. =over 4 @@ -4337,15 +4378,16 @@ B<-t markupstyle> Add code to preamble for selected markup style. This option defines C<\DIFadd> and C<\DIFdel> commands. -Available styles: +Available styles: -C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE -CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT> +C<UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE +CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT +LUAUNDERLINE> [ Default: C<UNDERLINE> ] =item B<--subtype=markstyle> or -B<-s markstyle> +B<-s markstyle> Add code to preamble for selected style for bracketing commands (e.g. to mark changes in margin). This option defines @@ -4358,27 +4400,27 @@ Available styles: C<SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE (LABEL)*> =item B<--floattype=markstyle> or B<-f markstyle> -Add code to preamble for selected style which +Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats -so marginal marking can be disabled thus). This option defines all +so marginal marking can be disabled thus). This option defines all C<\DIF...FL> commands. Available styles: C<FLOATSAFE TRADITIONALSAFE IDENTICAL> [ Default: C<FLOATSAFE> ] -=item B<--encoding=enc> or +=item B<--encoding=enc> or B<-e enc> Specify encoding of old.tex and new.tex. Typical encodings are -C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be -obtained by executing +C<ascii>, C<utf8>, C<latin1>, C<latin9>. A list of available encodings can be +obtained by executing C<perl -MEncode -e 'print join ("\n",Encode->encodings( ":all" )) ;' > If this option is used, then old.tex, new.tex are only opened once. [Default encoding is utf8 unless the first few lines of the preamble contain -an invocation C<\usepackage[..]{inputenc}> in which case the +an invocation C<\usepackage[..]{inputenc}> in which case the encoding chosen by this command is asssumed. Note that ASCII (standard latex) is a subset of utf8] @@ -4395,7 +4437,7 @@ C<\DIFaddbeginFL, \DIFaddendFL, \DIFaddFL{..}, (If this option is set B<-t>, B<-s>, and B<-f> options are ignored.) -=item B<--packages=pkg1,pkg2,..> +=item B<--packages=pkg1,pkg2,..> Tell latexdiff that .tex file is processed with the packages in list loaded. This is normally not necessary if the .tex file includes the @@ -4406,13 +4448,13 @@ The following packages trigger special behaviour: =over 8 -=item C<endfloat> +=item C<endfloat> Ensure that C<\begin{figure}> and C<\end{figure}> always appear by themselves on a line. =item C<hyperref> -Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and +Change name of C<\DIFadd> and C<\DIFdel> commands to C<\DIFaddtex> and C<\DIFdeltex> and define new C<\DIFadd> and C<\DIFdel> commands, which provide a wrapper for these commands, using them for the text but not for the link defining command (where any markup would cause errors). @@ -4464,17 +4506,17 @@ B<-A exclude-file> or B<--exclude-safecmd="cmd1,cmd2,..."> =item B<--replace-safecmd=replace-file> -=item B<--append-safecmd=append-file> or +=item B<--append-safecmd=append-file> or B<-a append-file> or B<--append-safecmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions (RegEx) -matching commands which are safe to use within the +matching commands which are safe to use within the scope of a C<\DIFadd> or C<\DIFdel> command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are -ignored). Note that the RegEx needs to match the whole of +ignored). Note that the RegEx needs to match the whole of the token, i.e., /^regex$/ is implied and that the initial -"\" of the command is not included. -The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> +"\" of the command is not included. +The B<--exclude-safecmd> and B<--append-safecmd> options can be combined with the -B<--replace-safecmd> option and can be used repeatedly to add cumulatively to the lists. B<--exclude-safecmd> and B<--append-safecmd> can also take a comma separated list as input. If a @@ -4487,7 +4529,7 @@ B<-X exclude-file> or B<--exclude-textcmd="cmd1,cmd2,..."> =item B<--replace-textcmd=replace-file> -=item B<--append-textcmd=append-file> or +=item B<--append-textcmd=append-file> or B<-x append-file> or B<--append-textcmd="cmd1,cmd2,..."> Exclude from, replace or append to the list of regular expressions @@ -4495,7 +4537,7 @@ matching commands whose last argument is text. See entry for B<--exclude-safecmd> directly above for further details. -=item B<--replace-context1cmd=replace-file> +=item B<--replace-context1cmd=replace-file> =item B<--append-context1cmd=append-file> or @@ -4504,11 +4546,11 @@ entry for B<--exclude-safecmd> directly above for further details. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. C<\caption> will only work within a figure -or table. These commands behave like text commands, except when +or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. -=item B<--replace-context2cmd=replace-file> +=item B<--replace-context2cmd=replace-file> =item B<--append-context2cmd=append-file> or @@ -4518,9 +4560,9 @@ As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. -context2 commands are also the only commands in the preamble, whose argument will be processed in +context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). The algorithm currently cannot cope with repeated context2 commands in the preamble, as they occur e.g. for the C<\author> argument in some journal styles (not in the standard styles, though -If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. +If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use C<--replace-context2cmd> option to just select the commands, which should be processed and are not used repeatedly in the preamble. @@ -4529,7 +4571,7 @@ If such a repetition is detected, the whole preamble will be processed in line-b =item B<--append-mboxsafecmd=append-file> or B<--append-mboxsafecmd="cmd1,cmd2,..."> Define safe commands, which additionally need to be protected by encapsulating -in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities +in an C<\mbox{..}>. This is sometimes needed to get around incompatibilities between external packages and the ulem package, which is used for highlighting in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE @@ -4543,7 +4585,7 @@ in the default style UNDERLINE as well as CULINECHBAR CFONTSTRIKE 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): +Available variables (see below for further explanations): C<ARRENV> (RegEx) @@ -4573,10 +4615,10 @@ C<SCALEDELGRAPHICS> (Float) =item B<--add-to-config varenv1=pattern1,varenv2=pattern2,...> For configuration variables, which are a regular expression (essentially those ending -in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration +in ENV, COUNTERCMD and CUSTOMDIFCMD, see list above) this option provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. C<varenv> must be one of the variables listed above that take a regular -expression as argument, and pattern is any regular expression (which might need to be +expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. C<--add-to-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote"> @@ -4596,7 +4638,7 @@ Show values of configuration variables. Combine all --show commands. -NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no +NB For all --show commands, no C<old.tex> or C<new.tex> file needs to be specified, and no differencing takes place. =back @@ -4613,29 +4655,29 @@ might get lumpeded with preceding commands) so should only be used if the default produces erroneous results. (Default requires arguments to directly follow each other without intervening spaces). -=item B<--math-markup=level> +=item B<--math-markup=level> -Determine granularity of markup in displayed math environments: +Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): -C<off> or C<0>: suppress markup for math environments. Deleted equations will not -appear in diff file. This mode can be used if all the other modes +C<off> or C<0>: suppress markup for math environments. Deleted equations will not +appear in diff file. This mode can be used if all the other modes cause invalid latex code. C<whole> or C<1>: Differencing on the level of whole equations. Even trivial changes -to equations cause the whole equation to be marked changed. This -mode can be used if processing in coarse or fine mode results in +to equations cause the whole equation to be marked changed. This +mode can be used if processing in coarse or fine mode results in invalid latex code. C<coarse> or C<2>: Detect changes within equations marked up with a coarse -granularity; changes in equation type (e.g.displaymath to equation) +granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] C<fine> or C<3>: Detect small change in equations and mark up at fine granularity. This mode is most suitable, if only minor changes to equations are -expected, e.g. correction of typos. +expected, e.g. correction of typos. =item B<--graphics-markup=level> @@ -4647,33 +4689,33 @@ C<none>, C<off> or C<0>: no highlighting for figures C<new-only> or C<1>: surround newly added or changed figures with a blue frame [Default if graphicx package loaded] -C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced +C<both> or C<2>: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable SCALEDELGRAPHICS to set size of deleted figures. -Note that changes to the optional parameters will make the figure appear as changed +Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. In some circumstances "Misplaced \noalign" error can occur if there are certain types -of changes in tables. In this case please use C<--graphics-markup=none> as a -work-around. +of changes in tables. In this case please use C<--graphics-markup=none> as a +work-around. -=item B<--no-del> +=item B<--no-del> -Suppress deleted text from the diff. It is similar in effect to the BOLD style, -but the deleted text ist not just invisible in the output, it is also not included in the diff text file. -This can be more robust than just making it invisible. +Suppress deleted text from the diff. It is similar in effect to the BOLD style, +but the deleted text ist not just invisible in the output, it is also not included in the diff text file. +This can be more robust than just making it invisible. =item B<--disable-citation-markup> or B<--disable-auto-mbox> -Suppress citation markup and markup of other vulnerable commands in styles +Suppress citation markup and markup of other vulnerable commands in styles using ulem (UNDERLINE,FONTSTRIKE, CULINECHBAR) (the two options are identical and are simply aliases) =item B<--enable-citation-markup> or B<--enforce-auto-mbox> -Protect citation commands and other vulnerable commands in changed sections +Protect citation commands and other vulnerable commands in changed sections with C<\mbox> command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) @@ -4719,18 +4761,18 @@ Suppress inclusion of old and new file names as comment in output file =item B<--visible-label> -Include old and new filenames (or labels set with C<--label> option) as +Include old and new filenames (or labels set with C<--label> option) as visible output. =item B<--flatten> Replace C<\input> and C<\include> commands within body by the content of the files in their argument. If C<\includeonly> is present in the -preamble, only those files are expanded into the document. However, -no recursion is done, i.e. C<\input> and C<\include> commands within -included sections are not expanded. The included files are assumed to +preamble, only those files are expanded into the document. However, +no recursion is done, i.e. C<\input> and C<\include> commands within +included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, -respectively, making it possible to organise files into old and new directories. +respectively, making it possible to organise files into old and new directories. --flatten is applied recursively, so inputted files can contain further C<\input> statements. Also handles files included by the import package (C<\import> and C<\subimport>), and C<\subfile> command. @@ -4777,7 +4819,7 @@ Suppress generation of hyperreferences, used for minimal diffs (option --only-ch =back -=head2 Predefined styles +=head2 Predefined styles =head2 Major types @@ -4790,9 +4832,14 @@ The major type determine the markup of plain text and some selected latex comman Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package). +=item C<LUAUNDERLINE> + +Added text is underlined and blue, discarded text is struck out and red +(Requires lua-ul package + LuaLaTeX). + =item C<CTRADITIONAL> -Added text is blue and set in sans-serif, and a red footnote is created for each discarded +Added text is blue and set in sans-serif, and a red footnote is created for each discarded piece of text. (Requires color package) =item C<TRADITIONAL> @@ -4833,13 +4880,13 @@ Added text is set in bold face, discarded is not shown. (also see --no-del optio =item C<PDFCOMMENT> -The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. +The pdfcomment package is used to underline new text, and mark deletions with a PDF comment. Note that this markup might appear differently or not at all based on the pdf viewer used. The viewer with best support for pdf markup is probably acroread. This style is only recommended if the number of differences is small. =back =head2 Subtypes -The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) +The subtype defines the commands that are inserted at the begin and end of added or discarded blocks, irrespectively of whether these blocks contain text or commands (Defined commands: C<\DIFaddbegin, \DIFaddend, \DIFdelbegin, \DIFdelend>) =over 10 @@ -4857,7 +4904,7 @@ from the intended position. An alternative way of marking added passages in blue, and deleted ones in red. (It is recommeneded to use instead the main types to effect colored markup, -although in some cases coloring with dvipscol can be more complete, for example +although in some cases coloring with dvipscol can be more complete, for example with citation commands). =item C<DVIPSCOL> @@ -4872,12 +4919,12 @@ although in some cases coloring with dvipscol can be more complete). can be used to highlight only changed pages, but requires post-processing. It is recommend to not call this option manually but use C<latexdiff-vc> with C<--only-changes> option. Alternatively, use the script given within preamble of diff files made using this style. -=item C<ONLYCHANGEDPAGE> +=item C<ONLYCHANGEDPAGE> also highlights changed pages, without the need for post-processing, but might not work reliably if there is floating material (figures, tables). -=item C<LABEL> +=item C<LABEL> is similar to C<ZLABEL>, but does not need the zref package and works less reliably (deprecated). @@ -4885,7 +4932,7 @@ is similar to C<ZLABEL>, but does not need the zref package and works less relia =head2 Float Types -Some of the markup used in the main text might cause problems when used within +Some of the markup used in the main text might cause problems when used within floats (e.g. figures or tables). For this reason alternative versions of all markup commands are used within floats. The float type defines these alternative commands. @@ -4912,7 +4959,7 @@ Make no difference between the main text and floats. =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 +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: C<ARRENV>=S<C<(?:array|[pbvBV]matrix)> > @@ -4932,9 +4979,9 @@ C<|subsubsection|paragraph|subparagraph)> ] This option is for advanced users and allows definition of special versions of commands, which do not work as safe commands. Commands in C<CUSTOMDIFCMD> that occur in added or deleted blocks will be given an ADD or DEL prefix. -The prefixed versions of the command must be defined in the preamble, either by putting them +The prefixed versions of the command must be defined in the preamble, either by putting them in the preamble of at least the new file, or by creating a custom preamble file (Option --preamble). -For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that +For example the command C<\blindtext> (from package blindtext) does not interact well with underlining, so that for the standard markup type, it is not satisfactory to define it as a safe command. Instead, a customised versions without underlining can be defined in the preamble: @@ -4948,7 +4995,7 @@ and then latexdiff should be invoked with the option C<-c CUSTOMDIFCMD=blindtext =item C<FLOATENV> -Environments whose name matches the regular expression in C<FLOATENV> are +Environments whose name matches the regular expression in C<FLOATENV> are considered floats. Within these environments, the I<latexdiff> markup commands are replaced by their FL variaties. @@ -4997,17 +5044,17 @@ If C<--graphics-markup=both> is chosen, C<SCALEDELGRAPHICS> is the factor, by wh =item C<VERBATIMENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: deleted content is commented out, new content is not marked up [ Default: S<C<comment> > ] =item C<VERBATIMLINEENV> -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by VERBATIMLINEENV are compared in line mode, and changes are marked up using the listings package. The markup style is set based on the chosen mains markup type (Option -t), or on an analysis of the preamble. -Note that "listings.sty" must be installed. If this file is not found the fallback solution is to +Note that "listings.sty" must be installed. If this file is not found the fallback solution is to treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV environments. [ Default: S<C<(?:verbatim[*]?|lstlisting> > ] @@ -5018,30 +5065,40 @@ treat VERBATIMLINEENV environments treated exactly the same way as VERBATIMENV e =over 10 -=item Citations result in overfull boxes +=item Changed citations result in overfull boxes There is an incompatibility between the C<ulem> package, which C<latexdiff> uses for underlining and striking out in the UNDERLINE style, -the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> -command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have two possibilities. +the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an C<\mbox> +command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have several possibilities. 1. Use C<CFONT> type markup (option C<-t CFONT>): If this markup is chosen, then changed citations are no longer marked up -with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. +with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the C<ulem> package will also work. 2. Choose option C<--disable-citation-markup> which turns off the marking up of citations: deleted citations are no longer shown, and -added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older) - +added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older). For custom packages you can define the commands which need to be protected by C<\mbox> with C<--append-mboxsafecmd> and C<--excludemboxsafecmd> options (submit your lists of command as feature request at github page to set the default behaviour of future versions, see section 6) -=item Changes in complicated mathematical equations result in latex processing errors +3. If you are using luatex >= 1.12.0 you can use option LUAUNDERLINE that uses lua-ul instead of ulem for underlining, which does not have this problem (experimental feature). + +=item Changes in complicated mathematical equations result in latex processing errors. + +Try option C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. -Try options C<--math-markup=whole>. If even that fails, you can turn off mark up for equations with C<--math-markup=off>. +=item Deleted parts in equations are not struck out but underlined. -=item How can I just show the pages where changes had been made +This is a limitation of the ulem package that implements the strike-out. If you use the amsmath package, then the strike-out command is redefined in such a way that deleted passages are wrapped with C<\text> command; adding C<\usepackage{amsmath}> to your preamble will trigger this behaviour. (If amsmath is not included directly, but imported by another package, latexdiff will not be able to detect its availability; in this case you can give latexdiff a hint with option C<--packages=amsmath>. -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 + +=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 package to be installed). +=item The character encoding breaks when running latexdiff from powershell. + +This problem is not limited to C<latexdiff> and has to do with the default settings of C<powershell> in Windows. It is recommended to use C<cmd> instead. + =back =head1 BUGS @@ -5054,13 +5111,13 @@ 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>, +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 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 latex, please send me those files, ideally edited to only contain the -offending passage as long as that still reproduces the problem. If your +offending passage as long as that still reproduces the problem. If your file relies on non-standard class files, you must include those. I will not look at examples where I have trouble to latex the original files. @@ -5071,24 +5128,24 @@ L<latexrevise>, L<latexdiff-vc> =head1 PORTABILITY I<latexdiff> does not make use of external commands and thus should run -on any platform supporting Perl 5.6 or higher. If files with encodings +on any platform supporting Perl 5.6 or higher. If files with encodings other than ASCII or UTF-8 are processed, Perl 5.8 or higher is required. The standard version of I<latexdiff> requires installation of the Perl package -C<Algorithm::Diff> (available from I<www.cpan.org> - +C<Algorithm::Diff> (available from I<www.cpan.org> - I<http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15>) but a stand-alone version, I<latexdiff-so>, which has this package inlined, is available, too. I<latexdiff-fast> requires the I<diff> command to be present. =head1 AUTHOR -Version 1.3.3 -Copyright (C) 2004-2022 Frederik Tilmann +Version 1.3.4 +Copyright (C) 2004-2024 Frederik Tilmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 -Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, +Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, T. Connors, Sebastian Gouezel and many others. Thanks to the many people who sent in bug reports, feature suggestions, and other feedback. @@ -5359,13 +5416,14 @@ value underline sqrt (SUPER|SUB)SCRIPT -%%END TEXT COMMANDS +%%END TEXT COMMANDS %%BEGIN CONTEXT1 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. These commands behave like text commands, except when they occur in a deleted section, where they are disabled, but their argument is shown as deleted text. caption subcaption -%%END CONTEXT1 COMMANDS +multicolumn +%%END CONTEXT1 COMMANDS %%BEGIN CONTEXT2 COMMANDS % Regex matching commands with a text argument (leave out the \), which will fail out of context. As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. @@ -5373,7 +5431,7 @@ title author date institute -%%END CONTEXT2 COMMANDS +%%END CONTEXT2 COMMANDS %% CONFIGURATION variabe defaults %%BEGIN LISTENV CONFIG @@ -5451,9 +5509,16 @@ verbatim[*]? \RequirePackage[normalem]{ulem} \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} -\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}} %DIF END UNDERLINE PREAMBLE +%DIF LUAUNDERLINE PREAMBLE +\RequirePackage{lua-ul} +\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} +\providecommand{\DIFadd}[1]{{\protect\color{blue}\underLine{#1}}} +\providecommand{\DIFdel}[1]{{\protect\color{red}\strikeThrough{#1}}} +%DIF END LUAUNDERLINE PREAMBLE + %DIF CTRADITIONAL PREAMBLE \RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} \RequirePackage[stable]{footmisc} @@ -5625,7 +5690,7 @@ verbatim[*]? % To show only pages with changes (dvips/dvipdf) % latex diff.tex % latex diff.tex -% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi +% dvips -pp `perl -lne 'if (m/\\newlabel{DIFchg[be]\d*}{{.*}{(.*)}}/) { print $1 }' diff.aux | uniq | tr -s \\n ','` diff.dvi \typeout{Check comments in preamble of output for instructions how to show only pages where changes have been made} \usepackage[user,abspage]{zref} \newcount\DIFcounterb @@ -5645,10 +5710,10 @@ verbatim[*]? \RequirePackage{etoolbox} \RequirePackage{zref} % redefine label command to write immediately to aux file - page references will be lost -\makeatletter \let\oldlabel\label% Store \label -\renewcommand{\label}[1]{% Update \label to write to the .aux immediately -\zref@wrapper@immediate{\oldlabel{#1}}} -\makeatother +\makeatletter \let\oldlabel\label% Store \label +\renewcommand{\label}[1]{% Update \label to write to the .aux immediately +\zref@wrapper@immediate{\oldlabel{#1}}} +\makeatother \newbool{DIFkeeppage} \newbool{DIFchange} \boolfalse{DIFkeeppage} @@ -5666,7 +5731,7 @@ verbatim[*]? \providecommand{\DIFmodend}{\global\booltrue{DIFkeeppage}\global\boolfalse{DIFchange}} %DIF END ONLYCHANGEDPAGE PREAMBLE -%% FLOAT TYPES +%% FLOAT TYPES %DIF FLOATSAFE PREAMBLE \providecommand{\DIFaddFL}[1]{\DIFadd{#1}} @@ -5698,7 +5763,7 @@ verbatim[*]? %DIF END TRADITIONALSAFE PREAMBLE % see: -% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself +% http://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself %DIF HIGHLIGHTGRAPHICS PREAMBLE \RequirePackage{settobox} @@ -5744,6 +5809,15 @@ verbatim[*]? %% SPECIAL PACKAGE PREAMBLE COMMANDS +%% Redefine strike out command to wrap in text box if amsmath is used and markup style with ulem is used +%DIF AMSMATHULEM PREAMBLE +\makeatletter +\let\sout@orig\sout +\renewcommand{\sout}[1]{\ifmmode\text{\sout@orig{\ensuremath{#1}}}\else\sout@orig{#1}\fi} +\makeatother +%DIF END AMSMATHULEM PREAMBLE + + % Standard \DIFadd and \DIFdel are redefined as \DIFaddtex and \DIFdeltex % when hyperref package is included. %DIF HYPERREF PREAMBLE @@ -5846,7 +5920,7 @@ verbatim[*]? %DIF END DIFCODE_BOLD %DIF DIFCODE_PDFCOMMENT - + moredelim=[il][\color{white}\tiny]{\%DIF\ <\ }, moredelim=[il][\sffamily\bfseries]{\%DIF\ >\ } %DIF END DIFCODE_PDFCOMMENT diff --git a/support/latexdiff/latexdiff-vc b/support/latexdiff/latexdiff-vc index 697d1e29b7..31760ca14c 100755 --- a/support/latexdiff/latexdiff-vc +++ b/support/latexdiff/latexdiff-vc @@ -26,6 +26,12 @@ # Detailed usage information at the end of the file # # TODO/IDEAS: - option to call external pre-processing codes +# +# version 1.3.4: +# - Enhancement: if --flatten option is used, and no bbl file is included in the version management, then latexdiff-vc will try to run bibtex to generate the bbl file. Implements the suggestion of PR #127 (contributed by github user cousteaulecommandant ) +# - Efficiency boost: use -draftmode for non-interactive preliminary runs of latex (idea from # +# - bug fix: minor fix for --only-changed that makes detection of changed pages more reliable [ PR #297 contributed by user nelijuc ] +# # version 1.3.2: # - bug fix: when setting config variables with the command lines it is now possible to use quotes to includes spaces in the value, e.g. -c LATEX="pdflatex --shell-escape" # - bug fix: --only-changes is not compatible with graphics markup. --graphics-markup=none is now set automatically @@ -71,7 +77,7 @@ use Getopt::Long ; use Pod::Usage qw/pod2usage/ ; use File::Temp qw/tempdir/ ; -use File::Basename qw/dirname/; +use File::Basename qw/dirname fileparse/; use File::Copy; use File::Path; @@ -79,8 +85,8 @@ use strict ; use warnings ; my $versionstring=<<EOF ; -This is LATEXDIFF-VC 1.3.2 - (c) 2005-2021 F J Tilmann +This is LATEXDIFF-VC 1.3.4 + (c) 2005-2024 F J Tilmann EOF # output debug and intermediate files, set to 0 in final distribution @@ -98,6 +104,8 @@ my ($configlatexdiff,@config,$config,$assign); #my $latexcmd="latex"; # latex compiler if not further identified my $vc=""; my $tempdir=tempdir(CLEANUP => 1); # generate a temp dir, which will automatically be deleted at program exit +#printf STDERR "DEBUG: tempdir $tempdir\n"; + # Variables my ($file1,$file2,$diff,$diffbase,$rootdir,$answer,$options,$infile,$append,$dirname,$cwd); my (@files,@ldoptions,@tmpfiles,@ptmpfiles,@difffiles,$extracomp); # , @@ -419,30 +427,39 @@ while ( $infile=$file2=shift @files ) { print STDERR "Working on $infile \n"; if ( scalar(@revs) == 1 ) { if ( defined($flatten) ) { - my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; - print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; - checkout_dir($revs[0],$olddir); - $file1=$olddir ."/".$infile; - } else { - ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; - push @tmpfiles,$file1; - # compare file with previous version ($revs[0]="") or specified version - ### system("$diffcmd$revs[0] $infile| $patchcmd -o$file1") ; - if (system("$diffcmd$revs[0] \"$infile\" | $patchcmd -o\"$file1\"")==0 and -z $file1 ) { - # no differences detected, i.e. file is equal to current version - copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; - } - } + my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; + print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; + checkout_dir($revs[0],$olddir,$infile); + $file1=$olddir ."/".$infile; + + # generate bibliography for new file if + if ( greptex('^[^%]*\\\\bibliography\\{',$infile) == 0) { + my ($filebase,$filedir)=fileparse($infile,".tex"); + if ( ! -e "$filedir$filebase.bbl" ) { + system("$CFG{LATEX} -draftmode -interaction=batchmode '$infile'; $CFG{BIBTEX} '$filedir$filebase'") + or die "Something went wrong in executing: $CFG{LATEX} -draftmode -interaction=batchmode '$infile'; $CFG{BIBTEX} '$filedir$filebase'" ; + } + } + } else { + ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; + push @tmpfiles,$file1; + # compare file with previous version ($revs[0]="") or specified version + ### system("$diffcmd$revs[0] $infile| $patchcmd -o$file1") ; + if (system("$diffcmd$revs[0] \"$infile\" | $patchcmd -o\"$file1\"")==0 and -z $file1 ) { + # no differences detected, i.e. file is equal to current version + copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; + } + } } elsif ( scalar(@revs) == 2 ) { if ( defined($flatten) ) { my $olddir=$tempdir . "/latexdiff-vc-$revs[0]"; print STDERR "Checking out old dir into: $olddir (rev: $revs[0])\n"; - checkout_dir($revs[0],$olddir); + checkout_dir($revs[0],$olddir,$infile); $file1=$olddir ."/".$infile; my $newdir=$tempdir . "/latexdiff-vc-$revs[1]"; print STDERR "Checking out new dir into: $newdir\n"; - checkout_dir($revs[1],$newdir); + checkout_dir($revs[1],$newdir,$infile); $file2=$newdir ."/".$infile; } else { ($file1=$infile) =~ s/\.(tex|bbl|flt)/-oldtmp-$$.$1/ ; @@ -468,7 +485,7 @@ while ( $infile=$file2=shift @files ) { } else { ($diff=$infile) =~ s/\.(tex|bbl|flt)$/$append.$1/ ; } - + # make directories if needed $dirname=dirname($diff) ; system("mkdir -p $dirname") unless ( -e $dirname ); @@ -488,13 +505,14 @@ while ( $infile=$file2=shift @files ) { die "Abort ... " ; } } + print STDERR "Running: $CFG{LATEXDIFF} $options \"$file1\" \"$file2\" > \"$diff\"\n"; unless ( system("$CFG{LATEXDIFF} $options \"$file1\" \"$file2\" > \"$diff\"") == 0 ) { print STDERR "Something went wrong in $CFG{LATEXDIFF}. Deleting $diff and abort\n" ; unlink $diff ; exit(5) }; print "Generated difference file $diff\n"; - if ( $run and !( scalar(@revs) && greptex( qr/\\document(?:class|style)/ , $diff ) ) ) { + if ( $run and !( scalar(@revs) && greptex( qr/\\document(?:class|style)/ , $diff,25) ) ) { # save filename for later processing if postscript or pdf conversion is requested and either two-file mode was used (scalar(@revs)==0) or the diff file contains documentclass statement (ie. is a root document) push @difffiles, $diff ; } @@ -519,19 +537,20 @@ foreach $diff ( @difffiles ) { if ( $run ) { print STDERR "PDF: $pdf Postscript: $postscript cwd $cwd\n" if $debug; - if ( system("grep -q \'^[^%]*\\\\bibliography{\' \"$diff\"") == 0 ) { - system("$CFG{LATEX} --interaction=batchmode \"$diff\"; $CFG{BIBTEX} \"$diffbase\";"); +# if ( system("grep -q \'^[^%]*\\\\bibliography{\' \"$diff\"") == 0 ) { + if ( greptex('^[^%]*\\\\bibliography{',$diff ) == 0 ) { + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\"; $CFG{BIBTEX} \"$diffbase\";"); push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; } # if special needs, as CHANGEBAR if ( $extracomp ) { # print "Extracomp\n"; - system("$CFG{LATEX} --interaction=batchmode \"$diff\";"); + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\";"); } # final compilation - system("$CFG{LATEX} --interaction=batchmode \"$diff\";"); # needed if cross-refs + system("$CFG{LATEX} -draftmode -interaction=batchmode \"$diff\";"); # needed if cross-refs system("$CFG{LATEX} \"$diff\";"); # final, with possible error messages if ( $rundvi2 ) { @@ -586,10 +605,10 @@ sub findchangedpages { my %start; open(AUX,$auxfile) or die ("Could open aux file $auxfile . System error: $!"); while (<AUX>) { - if (m/\\zref\@newlabel\{DIFchgb(\d*)\}\{.*\\abspage\{(\d*)\}\}/ ) { + if (m/\\zref\@newlabel\{DIFchgb(\d*)\}\{.*\\abspage\{(\d*)\}.*\}/ ) { $start{$1}=$2; $pages{$2}=1; } - if (m/\\zref\@newlabel\{DIFchge(\d*)\}\{.*\\abspage\{(\d*)\}\}/) { + if (m/\\zref\@newlabel\{DIFchge(\d*)\}\{.*\\abspage\{(\d*)\}.*\}/) { if (defined($start{$1})) { for ($j=$start{$1}; $j<=$2; $j++) { $pages{$j}=1; @@ -643,12 +662,14 @@ sub compresspages { return @res; } -# checkout_dir(rev,dirname) +# checkout_dir(rev,dirname, <file>) # checks out revision rev and stores it in dirname -# uses global variables: $vc, $rootdir +# If argument <file> is provided, check if this file imports a bibliography and generate it if necessary +# uses global variables: $vc, $rootdir, $CFG sub checkout_dir { - my ($rev,$dirname)=@_; + my ($rev,$dirname,$file)=@_; + my ($filebase,$filedir); unless (-e $dirname) { mkpath([ $dirname ]) or die "Cannot mkdir $dirname ." ;} if ( $vc eq "SVN" ) { system("svn checkout -r $rev $rootdir $dirname")==0 or die "Something went wrong in executing: svn checkout -r $rev $rootdir $dirname"; @@ -660,13 +681,25 @@ sub checkout_dir { } else { die "checkout_dir: only works with SVN, HG and GIT VCS system (selected: $vc)"; } + # Check if the main file needs a bbl generated + if ( defined($file) and greptex('^[^%]*\\\\bibliography\\{',$file) == 0) { + ($filebase,$filedir)=fileparse($file,".tex"); + if ( ! -e "$filedir$filebase.bbl" ){ + printf STDERR "Running $CFG{BIBTEX} to generate $filedir$filebase.bbl.\n"; + system("cd '$dirname'; $CFG{LATEX} -draftmode -interaction=batchmode '$file'; $CFG{BIBTEX} '$filedir$filebase'")==0 + or die "Something went wrong in executing: cd '$dirname'; $CFG{LATEX} -draftmode -interaction=batchmode '$file'; $CFG{BIBTEX} '$filedir$filebase'" ; + } +# else { # DEBUG +# printf STDERR "DEBUG: Skipping bbl file generation as $filedir$filebase.bbl already exists.\n" +# } #DEBUG + } } -# greptex returns 1 if regex is not matched in filename -# only the 25 first non-comment lines are scanned +# greptex($regex,$filename, <lines>) returns 1 if regex is not matched in filename +# only the first <lines> non-comment lines are scanned; by default everythin is scanned # 0 if there is a match sub greptex { - my ($regex,$filename)=@_; + my ($regex,$filename,$nlines)=@_; my ($i)=0; open (FH, $filename) or die("Couldn't open $filename: $!"); while (<FH>) { @@ -675,9 +708,9 @@ sub greptex { close(FH); return(0); } - # only scan 25 lines + # only scan <nlines> lines, if optional parameter proviede $i++; - last if $i>25 ; + last if defined($nlines) and $i>$nlines ; } close(FH); return(1); @@ -761,7 +794,7 @@ complete directory hierarchy. Optionally, a pathname F<path> can be specified, =item B<--flatten,--flatten=keep-intermediate> If combined with C<--git>, C<--svn> or C<--hg> option or the corresponding modes, check out the revisions to compare in a separate temporary directory, and then pass on option C<--flatten> to latexdiff. The directory in which C<latexdiff-vc> is invoked defines the subtree which will be checked out. -Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the C<.bbl> file in the version management. +Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the C<.bbl> file in the version management. From latexdiff-vc >=1.3.4 there is an attempt to create the C<.bbl> file by running bibtex in the retrieved subdirectories; note that the bibtex is run in the temporary subdirectories so any .bib or .bst files either need to be under version management, or in the global search paths for bibtex (shell environment variables C<BIBINPUTS> and C<BSTINPUTS>). The generic usage of this function is : C<latexdiff-vc --flatten -r rev1 [-r rev2] master.tex> where master.tex is the project file containing the highest level of includes etc. @@ -798,7 +831,7 @@ Available variables for latexdiff-vc: =over 8 -=item C<LATEXDIFF> latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the option C<--interaction=batchmode> +=item C<LATEXDIFF> latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the options C<-draftmode> and C<-interaction=batchmode> =item C<LATEX> latex command (e.g. pdflatex, lualatex) @@ -847,7 +880,7 @@ Show version number =back -All other options are passed on to C<latexdiff>. +All other options are passed on to C<latexdiff>. Note that it is not always easy for latexdiff to correctly assign arguments to options when short form (single letter) options are used so it is recommended to use long-form options. =head1 SEE ALSO @@ -868,7 +901,7 @@ or send them to I<tilmann -- AT -- gfz-potsdam.de>. Include the version number =head1 AUTHOR -Version 1.3.2 +Version 1.3.4a Copyright (C) 2005-2017 Frederik Tilmann This program is free software; you can redistribute it and/or modify diff --git a/support/latexdiff/latexdiff-vc.1 b/support/latexdiff/latexdiff-vc.1 index 8b6c6f8db7..8ed1715873 100644 --- a/support/latexdiff/latexdiff-vc.1 +++ b/support/latexdiff/latexdiff-vc.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXDIFF-VC 1" -.TH LATEXDIFF-VC 1 "2022-03-05" "perl v5.30.0" " " +.TH LATEXDIFF-VC 1 "2024-07-20" "perl v5.34.0" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -204,7 +204,7 @@ complete directory hierarchy. Optionally, a pathname \fIpath\fR can be specifie .IP "\fB\-\-flatten,\-\-flatten=keep\-intermediate\fR" 4 .IX Item "--flatten,--flatten=keep-intermediate" If combined with \f(CW\*(C`\-\-git\*(C'\fR, \f(CW\*(C`\-\-svn\*(C'\fR or \f(CW\*(C`\-\-hg\*(C'\fR option or the corresponding modes, check out the revisions to compare in a separate temporary directory, and then pass on option \f(CW\*(C`\-\-flatten\*(C'\fR to latexdiff. The directory in which \f(CW\*(C`latexdiff\-vc\*(C'\fR is invoked defines the subtree which will be checked out. -Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the \f(CW\*(C`.bbl\*(C'\fR file in the version management. +Note that if additional files are needed which are not included in the flatten procedure (package files, included graphics), they need to be accessible in the current directory. If you use bibtex, it is recommended to include the \f(CW\*(C`.bbl\*(C'\fR file in the version management. From latexdiff-vc >=1.3.4 there is an attempt to create the \f(CW\*(C`.bbl\*(C'\fR file by running bibtex in the retrieved subdirectories; note that the bibtex is run in the temporary subdirectories so any .bib or .bst files either need to be under version management, or in the global search paths for bibtex (shell environment variables \f(CW\*(C`BIBINPUTS\*(C'\fR and \f(CW\*(C`BSTINPUTS\*(C'\fR). .Sp The generic usage of this function is : \f(CW\*(C`latexdiff\-vc \-\-flatten \-r rev1 [\-r rev2] master.tex\*(C'\fR where master.tex is the project file containing the highest level of includes etc. .Sp @@ -232,9 +232,9 @@ Set configuration variables for latexdiff and latexdiff-vc. The option can be r variables (as an alternative to the comma-separated list). Available variables for latexdiff-vc: .RS 4 -.ie n .IP """LATEXDIFF"" latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the option ""\-\-interaction=batchmode""" 8 -.el .IP "\f(CWLATEXDIFF\fR latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the option \f(CW\-\-interaction=batchmode\fR" 8 -.IX Item "LATEXDIFF latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the option --interaction=batchmode" +.ie n .IP """LATEXDIFF"" latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the options ""\-draftmode"" and ""\-interaction=batchmode""" 8 +.el .IP "\f(CWLATEXDIFF\fR latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the options \f(CW\-draftmode\fR and \f(CW\-interaction=batchmode\fR" 8 +.IX Item "LATEXDIFF latexdiff command (e.g. latexdiff-fast, latexdiff-so). This command should support the options -draftmode and -interaction=batchmode" .PD 0 .ie n .IP """LATEX"" latex command (e.g. pdflatex, lualatex)" 8 .el .IP "\f(CWLATEX\fR latex command (e.g. pdflatex, lualatex)" 8 @@ -280,7 +280,7 @@ Show help text .IX Item "--version" Show version number .PP -All other options are passed on to \f(CW\*(C`latexdiff\*(C'\fR. +All other options are passed on to \f(CW\*(C`latexdiff\*(C'\fR. Note that it is not always easy for latexdiff to correctly assign arguments to options when short form (single letter) options are used so it is recommended to use long-form options. .SH "SEE ALSO" .IX Header "SEE ALSO" latexdiff @@ -297,7 +297,7 @@ or send them to \fItilmann \*(-- \s-1AT\s0 \*(-- gfz\-potsdam.de\fR. Include th (option \f(CW\*(C`\-\-version\*(C'\fR). .SH "AUTHOR" .IX Header "AUTHOR" -Version 1.3.2 +Version 1.3.4a Copyright (C) 2005\-2017 Frederik Tilmann .PP This program is free software; you can redistribute it and/or modify diff --git a/support/latexdiff/latexdiff.1 b/support/latexdiff/latexdiff.1 index 53644f607e..a52d6f03ac 100644 --- a/support/latexdiff/latexdiff.1 +++ b/support/latexdiff/latexdiff.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXDIFF 1" -.TH LATEXDIFF 1 "2022-09-25" "perl v5.30.0" " " +.TH LATEXDIFF 1 "2024-07-20" "perl v5.34.0" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -158,8 +158,8 @@ be real files (not pipes or similar) as they are opened twice (unless \f(CW\*(C` The program treats the preamble differently from the main document. Differences between the preambles are found using line-based differencing (similarly to the Unix diff command, but ignoring white -spaces). A comment, "\f(CW\*(C`%DIF\ >\*(C'\fR" is appended to each added line, i.e. a -line present in \f(CW\*(C`new.tex\*(C'\fR but not in \f(CW\*(C`old.tex\*(C'\fR. Discarded lines +spaces). A comment, "\f(CW\*(C`%DIF\ >\*(C'\fR" is appended to each added line, i.e. a +line present in \f(CW\*(C`new.tex\*(C'\fR but not in \f(CW\*(C`old.tex\*(C'\fR. Discarded lines are deactivated by prepending "\f(CW\*(C`%DIF\ <\*(C'\fR". Changed blocks are preceded by comment lines giving information about line numbers in the original files. Where there are insignificant differences, the resulting file \f(CW\*(C`diff.tex\*(C'\fR will be similar to @@ -238,7 +238,7 @@ but the choice is yours. Any markup within the environment will be removed, and generally everything within the environment will just be taken from the new file. .PP -It is also possible to difference files which do not have a preamble. +It is also possible to difference files which do not have a preamble. In this case, the file is processed in the main document mode, but the definitions of the markup commands are not inserted. .PP @@ -256,14 +256,14 @@ the scope of \f(CW\*(C`\eDIFadd\*(C'\fR. Added comments are marked by prependin .PP Within deleted blocks text is highlighted with \f(CW\*(C`\eDIFdel\*(C'\fR. Deleted comments are marked by prepending "\f(CW\*(C`%DIF\ <\ \*(C'\fR\*(L". Non-safe command -and curly braces within deleted blocks are commented out with +and curly braces within deleted blocks are commented out with \&\*(R"\f(CW\*(C`%DIFDELCMD\ <\ \*(C'\fR". .SH "OPTIONS" .IX Header "OPTIONS" .SS "Preamble" .IX Subsection "Preamble" The following options determine the visual markup style by adding the appropriate -command definitions to the preamble. See the end of this section for a description of +command definitions to the preamble. See the end of this section for a description of available styles. .IP "\fB\-\-type=markupstyle\fR or \fB\-t markupstyle\fR" 4 .IX Item "--type=markupstyle or -t markupstyle" @@ -271,8 +271,9 @@ Add code to preamble for selected markup style. This option defines \&\f(CW\*(C`\eDIFadd\*(C'\fR and \f(CW\*(C`\eDIFdel\*(C'\fR commands. Available styles: .Sp -\&\f(CW\*(C`UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE -CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT\*(C'\fR +\&\f(CW\*(C`UNDERLINE CTRADITIONAL TRADITIONAL CFONT FONTSTRIKE INVISIBLE +CHANGEBAR CCHANGEBAR CULINECHBAR CFONTCHBAR BOLD PDFCOMMENT +LUAUNDERLINE\*(C'\fR .Sp [ Default: \f(CW\*(C`UNDERLINE\*(C'\fR ] .IP "\fB\-\-subtype=markstyle\fR or \fB\-s markstyle\fR" 4 @@ -286,10 +287,10 @@ Available styles: \f(CW\*(C`SAFE MARGIN COLOR DVIPSCOL ZLABEL ONLYCHANGEDPAGE ( * Subtype \f(CW\*(C`LABEL\*(C'\fR is deprecated .IP "\fB\-\-floattype=markstyle\fR or \fB\-f markstyle\fR" 4 .IX Item "--floattype=markstyle or -f markstyle" -Add code to preamble for selected style which +Add code to preamble for selected style which replace standard marking and markup commands within floats (e.g., marginal remarks cause an error within floats -so marginal marking can be disabled thus). This option defines all +so marginal marking can be disabled thus). This option defines all \&\f(CW\*(C`\eDIF...FL\*(C'\fR commands. Available styles: \f(CW\*(C`FLOATSAFE TRADITIONALSAFE IDENTICAL\*(C'\fR .Sp @@ -297,14 +298,14 @@ Available styles: \f(CW\*(C`FLOATSAFE TRADITIONALSAFE IDENTICAL\*(C'\fR .IP "\fB\-\-encoding=enc\fR or \fB\-e enc\fR" 4 .IX Item "--encoding=enc or -e enc" Specify encoding of old.tex and new.tex. Typical encodings are -\&\f(CW\*(C`ascii\*(C'\fR, \f(CW\*(C`utf8\*(C'\fR, \f(CW\*(C`latin1\*(C'\fR, \f(CW\*(C`latin9\*(C'\fR. A list of available encodings can be +\&\f(CW\*(C`ascii\*(C'\fR, \f(CW\*(C`utf8\*(C'\fR, \f(CW\*(C`latin1\*(C'\fR, \f(CW\*(C`latin9\*(C'\fR. A list of available encodings can be obtained by executing .Sp \&\f(CW\*(C`perl \-MEncode \-e \*(Aqprint join ("\en",Encode\-\*(C'\fRencodings( \*(L":all\*(R" )) ;' > .Sp If this option is used, then old.tex, new.tex are only opened once. [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 +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 latex) is a subset of utf8] .IP "\fB\-\-preamble=file\fR or \fB\-p file\fR" 4 @@ -334,7 +335,7 @@ Ensure that \f(CW\*(C`\ebegin{figure}\*(C'\fR and \f(CW\*(C`\eend{figure}\*(C'\f .ie n .IP """hyperref""" 8 .el .IP "\f(CWhyperref\fR" 8 .IX Item "hyperref" -Change name of \f(CW\*(C`\eDIFadd\*(C'\fR and \f(CW\*(C`\eDIFdel\*(C'\fR commands to \f(CW\*(C`\eDIFaddtex\*(C'\fR and \f(CW\*(C`\eDIFdeltex\*(C'\fR and +Change name of \f(CW\*(C`\eDIFadd\*(C'\fR and \f(CW\*(C`\eDIFdel\*(C'\fR commands to \f(CW\*(C`\eDIFaddtex\*(C'\fR and \f(CW\*(C`\eDIFdeltex\*(C'\fR and define new \f(CW\*(C`\eDIFadd\*(C'\fR and \f(CW\*(C`\eDIFdel\*(C'\fR commands, which provide a wrapper for these commands, using them for the text but not for the link defining command (where any markup would cause errors). @@ -384,13 +385,13 @@ Print generated or included preamble commands to stdout. .IX Item "--append-safecmd=append-file or -a append-file or --append-safecmd=cmd1,cmd2,..." .PD Exclude from, replace or append to the list of regular expressions (RegEx) -matching commands which are safe to use within the +matching commands which are safe to use within the scope of a \f(CW\*(C`\eDIFadd\*(C'\fR or \f(CW\*(C`\eDIFdel\*(C'\fR command. The file must contain one Perl-RegEx per line (Comment lines beginning with # or % are -ignored). Note that the RegEx needs to match the whole of +ignored). Note that the RegEx needs to match the whole of the token, i.e., /^regex$/ is implied and that the initial -\&\*(L"\e\*(R" of the command is not included. -The \fB\-\-exclude\-safecmd\fR and \fB\-\-append\-safecmd\fR options can be combined with the \-\fB\-\-replace\-safecmd\fR +\&\*(L"\e\*(R" of the command is not included. +The \fB\-\-exclude\-safecmd\fR and \fB\-\-append\-safecmd\fR options can be combined with the \-\fB\-\-replace\-safecmd\fR option and can be used repeatedly to add cumulatively to the lists. \fB\-\-exclude\-safecmd\fR and \fB\-\-append\-safecmd\fR can also take a comma separated list as input. If a @@ -422,7 +423,7 @@ entry for \fB\-\-exclude\-safecmd\fR directly above for further details. Replace or append to the list of regex matching commands whose last argument is text but which require a particular context to work, e.g. \f(CW\*(C`\ecaption\*(C'\fR will only work within a figure -or table. These commands behave like text commands, except when +or table. These commands behave like text commands, except when they occur in a deleted section, when they are disabled, but their argument is shown as deleted text. .IP "\fB\-\-replace\-context2cmd=replace\-file\fR" 4 @@ -438,7 +439,7 @@ As corresponding commands for context1. The only difference is that context2 commands are completely disabled in deleted sections, including their arguments. .Sp -context2 commands are also the only commands in the preamble, whose argument will be processed in +context2 commands are also the only commands in the preamble, whose argument will be processed in word-by-word mode (which only works, if they occur no more than once in the preamble). The algorithm currently cannot cope with repeated context2 commands in the preamble, as they occur e.g. for the \f(CW\*(C`\eauthor\*(C'\fR argument in some journal styles (not in the standard styles, though If such a repetition is detected, the whole preamble will be processed in line-by-line mode. In such a case, use \f(CW\*(C`\-\-replace\-context2cmd\*(C'\fR option to just select the commands, which should be processed and are not used repeatedly in the preamble. .ie n .IP "\fB\-\-exclude\-mboxsafecmd=exclude\-file\fR or \fB\-\-exclude\-mboxsafecmd=""cmd1,cmd2,...""\fR" 4 @@ -450,7 +451,7 @@ If such a repetition is detected, the whole preamble will be processed in line-b .IX Item "--append-mboxsafecmd=append-file or --append-mboxsafecmd=cmd1,cmd2,..." .PD Define safe commands, which additionally need to be protected by encapsulating -in an \f(CW\*(C`\embox{..}\*(C'\fR. This is sometimes needed to get around incompatibilities +in an \f(CW\*(C`\embox{..}\*(C'\fR. 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 CFONTSTRIKE\s0 .IP "\fB\-\-config var1=val1,var2=val2,...\fR or \fB\-c var1=val1,..\fR" 4 @@ -489,10 +490,10 @@ Available variables (see below for further explanations): .IP "\fB\-\-add\-to\-config varenv1=pattern1,varenv2=pattern2,...\fR" 4 .IX Item "--add-to-config varenv1=pattern1,varenv2=pattern2,..." For configuration variables, which are a regular expression (essentially those ending -in \s-1ENV, COUNTERCMD\s0 and \s-1CUSTOMDIFCMD,\s0 see list above) this option provides an alternative way to modify the configuration +in \s-1ENV, COUNTERCMD\s0 and \s-1CUSTOMDIFCMD,\s0 see list above) this option provides an alternative way to modify the configuration variables. Instead of setting the complete pattern, with this option it is possible to add an alternative pattern. \f(CW\*(C`varenv\*(C'\fR must be one of the variables listed above that take a regular -expression as argument, and pattern is any regular expression (which might need to be +expression as argument, and pattern is any regular expression (which might need to be protected from the shell by quotation). Several patterns can be added at once by using semi-colons to separate them, e.g. \f(CW\*(C`\-\-add\-to\-config "LISTENV=myitemize;myenumerate,COUNTERCMD=endnote"\*(C'\fR .IP "\fB\-\-show\-safecmd\fR" 4 @@ -508,7 +509,7 @@ Show values of configuration variables. .IX Item "--show-all" Combine all \-\-show commands. .Sp -\&\s-1NB\s0 For all \-\-show commands, no \f(CW\*(C`old.tex\*(C'\fR or \f(CW\*(C`new.tex\*(C'\fR file needs to be specified, and no +\&\s-1NB\s0 For all \-\-show commands, no \f(CW\*(C`old.tex\*(C'\fR or \f(CW\*(C`new.tex\*(C'\fR file needs to be specified, and no differencing takes place. .SS "Other configuration options:" .IX Subsection "Other configuration options:" @@ -521,20 +522,20 @@ default produces erroneous results. (Default requires arguments to directly follow each other without intervening spaces). .IP "\fB\-\-math\-markup=level\fR" 4 .IX Item "--math-markup=level" -Determine granularity of markup in displayed math environments: +Determine granularity of markup in displayed math environments: Possible values for level are (both numerical and text labels are acceptable): .Sp -\&\f(CW\*(C`off\*(C'\fR or \f(CW0\fR: suppress markup for math environments. Deleted equations will not -appear in diff file. This mode can be used if all the other modes +\&\f(CW\*(C`off\*(C'\fR or \f(CW0\fR: suppress markup for math environments. Deleted equations will not +appear in diff file. This mode can be used if all the other modes cause invalid latex code. .Sp \&\f(CW\*(C`whole\*(C'\fR or \f(CW1\fR: Differencing on the level of whole equations. Even trivial changes -to equations cause the whole equation to be marked changed. This -mode can be used if processing in coarse or fine mode results in +to equations cause the whole equation to be marked changed. This +mode can be used if processing in coarse or fine mode results in invalid latex code. .Sp \&\f(CW\*(C`coarse\*(C'\fR or \f(CW2\fR: Detect changes within equations marked up with a coarse -granularity; changes in equation type (e.g.displaymath to equation) +granularity; changes in equation type (e.g.displaymath to equation) appear as a change to the complete equation. This mode is recommended for situations where the content and order of some equations are still being changed. [Default] @@ -554,29 +555,29 @@ Possible values for level: .Sp \&\f(CW\*(C`new\-only\*(C'\fR or \f(CW1\fR: surround newly added or changed figures with a blue frame [Default if graphicx package loaded] .Sp -\&\f(CW\*(C`both\*(C'\fR or \f(CW2\fR: highlight new figures with a blue frame and show deleted figures at reduced +\&\f(CW\*(C`both\*(C'\fR or \f(CW2\fR: highlight new figures with a blue frame and show deleted figures at reduced scale, and crossed out with a red diagonal cross. Use configuration variable \s-1SCALEDELGRAPHICS\s0 to set size of deleted figures. .Sp -Note that changes to the optional parameters will make the figure appear as changed +Note that changes to the optional parameters will make the figure appear as changed to latexdiff, and this figure will thus be highlighted. .Sp In some circumstances \*(L"Misplaced \enoalign\*(R" error can occur if there are certain types -of changes in tables. In this case please use \f(CW\*(C`\-\-graphics\-markup=none\*(C'\fR as a +of changes in tables. In this case please use \f(CW\*(C`\-\-graphics\-markup=none\*(C'\fR as a work-around. .IP "\fB\-\-no\-del\fR" 4 .IX Item "--no-del" -Suppress deleted text from the diff. It is similar in effect to the \s-1BOLD\s0 style, -but the deleted text ist not just invisible in the output, it is also not included in the diff text file. +Suppress deleted text from the diff. It is similar in effect to the \s-1BOLD\s0 style, +but the deleted text ist not just invisible in the output, it is also not included in the diff text file. This can be more robust than just making it invisible. .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 +Suppress citation markup and markup of other vulnerable commands in styles 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" -Protect citation commands and other vulnerable commands in changed sections +Protect citation commands and other vulnerable commands in changed sections with \f(CW\*(C`\embox\*(C'\fR command, i.e. use default behaviour for ulem package for other packages (the two options are identical and are simply aliases) .SS "Miscellaneous" @@ -611,17 +612,17 @@ labels like this \f(CW\*(C`\-L labelold \-L labelnew\*(C'\fR. Suppress inclusion of old and new file names as comment in output file .IP "\fB\-\-visible\-label\fR" 4 .IX Item "--visible-label" -Include old and new filenames (or labels set with \f(CW\*(C`\-\-label\*(C'\fR option) as +Include old and new filenames (or labels set with \f(CW\*(C`\-\-label\*(C'\fR option) as visible output. .IP "\fB\-\-flatten\fR" 4 .IX Item "--flatten" Replace \f(CW\*(C`\einput\*(C'\fR and \f(CW\*(C`\einclude\*(C'\fR commands within body by the content of the files in their argument. If \f(CW\*(C`\eincludeonly\*(C'\fR is present in the -preamble, only those files are expanded into the document. However, -no recursion is done, i.e. \f(CW\*(C`\einput\*(C'\fR and \f(CW\*(C`\einclude\*(C'\fR commands within -included sections are not expanded. The included files are assumed to +preamble, only those files are expanded into the document. However, +no recursion is done, i.e. \f(CW\*(C`\einput\*(C'\fR and \f(CW\*(C`\einclude\*(C'\fR commands within +included sections are not expanded. The included files are assumed to be located in the same directories as the old and new master files, -respectively, making it possible to organise files into old and new directories. +respectively, making it possible to organise files into old and new directories. \&\-\-flatten is applied recursively, so inputted files can contain further \&\f(CW\*(C`\einput\*(C'\fR statements. Also handles files included by the import package (\f(CW\*(C`\eimport\*(C'\fR and \f(CW\*(C`\esubimport\*(C'\fR), and \f(CW\*(C`\esubfile\*(C'\fR command. @@ -660,10 +661,15 @@ The major type determine the markup of plain text and some selected latex comman .IX Item "UNDERLINE" Added text is wavy-underlined and blue, discarded text is struck out and red (Requires color and ulem packages). Overstriking does not work in displayed math equations such that deleted parts of equation are underlined, not struck out (this is a shortcoming inherent to the ulem package). +.ie n .IP """LUAUNDERLINE""" 10 +.el .IP "\f(CWLUAUNDERLINE\fR" 10 +.IX Item "LUAUNDERLINE" +Added text is underlined and blue, discarded text is struck out and red +(Requires lua-ul package + LuaLaTeX). .ie n .IP """CTRADITIONAL""" 10 .el .IP "\f(CWCTRADITIONAL\fR" 10 .IX Item "CTRADITIONAL" -Added text is blue and set in sans-serif, and a red footnote is created for each discarded +Added text is blue and set in sans-serif, and a red footnote is created for each discarded piece of text. (Requires color package) .ie n .IP """TRADITIONAL""" 10 .el .IP "\f(CWTRADITIONAL\fR" 10 @@ -723,7 +729,7 @@ from the intended position. .IX Item "COLOR" An alternative way of marking added passages in blue, and deleted ones in red. (It is recommeneded to use instead the main types to effect colored markup, -although in some cases coloring with dvipscol can be more complete, for example +although in some cases coloring with dvipscol can be more complete, for example with citation commands). .ie n .IP """DVIPSCOL""" 10 .el .IP "\f(CWDVIPSCOL\fR" 10 @@ -747,7 +753,7 @@ there is floating material (figures, tables). is similar to \f(CW\*(C`ZLABEL\*(C'\fR, but does not need the zref package and works less reliably (deprecated). .SS "Float Types" .IX Subsection "Float Types" -Some of the markup used in the main text might cause problems when used within +Some of the markup used in the main text might cause problems when used within floats (e.g. figures or tables). For this reason alternative versions of all markup commands are used within floats. The float type defines these alternative commands. .ie n .IP """FLOATSAFE""" 10 @@ -767,7 +773,7 @@ Make no difference between the main text and floats. .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 +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\ @@ -787,9 +793,9 @@ numbering in the new file. This option is for advanced users and allows definition of special versions of commands, which do not work as safe commands. .Sp Commands in \f(CW\*(C`CUSTOMDIFCMD\*(C'\fR that occur in added or deleted blocks will be given an \s-1ADD\s0 or \s-1DEL\s0 prefix. -The prefixed versions of the command must be defined in the preamble, either by putting them +The prefixed versions of the command must be defined in the preamble, either by putting them in the preamble of at least the new file, or by creating a custom preamble file (Option \-\-preamble). -For example the command \f(CW\*(C`\eblindtext\*(C'\fR (from package blindtext) does not interact well with underlining, so that +For example the command \f(CW\*(C`\eblindtext\*(C'\fR (from package blindtext) does not interact well with underlining, so that for the standard markup type, it is not satisfactory to define it as a safe command. Instead, a customised versions without underlining can be defined in the preamble: .Sp @@ -803,7 +809,7 @@ and then latexdiff should be invoked with the option \f(CW\*(C`\-c CUSTOMDIFCMD= .ie n .IP """FLOATENV""" 10 .el .IP "\f(CWFLOATENV\fR" 10 .IX Item "FLOATENV" -Environments whose name matches the regular expression in \f(CW\*(C`FLOATENV\*(C'\fR are +Environments whose name matches the regular expression in \f(CW\*(C`FLOATENV\*(C'\fR are considered floats. Within these environments, the \fIlatexdiff\fR markup commands are replaced by their \s-1FL\s0 variaties. .Sp @@ -852,55 +858,62 @@ If \f(CW\*(C`\-\-graphics\-markup=both\*(C'\fR is chosen, \f(CW\*(C`SCALEDELGRAP .ie n .IP """VERBATIMENV""" 10 .el .IP "\f(CWVERBATIMENV\fR" 10 .IX Item "VERBATIMENV" -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of these environments will not be processed in any way: deleted content is commented out, new content is not marked up .Sp [ Default: \f(CW\*(C`comment\*(C'\fR\ ] .ie n .IP """VERBATIMLINEENV""" 10 .el .IP "\f(CWVERBATIMLINEENV\fR" 10 .IX Item "VERBATIMLINEENV" -RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by \s-1VERBATIMLINEENV\s0 are compared in +RegEx describing environments like verbatim, whose contents should be taken verbatim. The content of environments described by \s-1VERBATIMLINEENV\s0 are compared in line mode, and changes are marked up using the listings package. The markup style is set based on the chosen mains markup type (Option \-t), or on an analysis of the preamble. -Note that \*(L"listings.sty\*(R" must be installed. If this file is not found the fallback solution is to +Note that \*(L"listings.sty\*(R" must be installed. If this file is not found the fallback solution is to treat \s-1VERBATIMLINEENV\s0 environments treated exactly the same way as \s-1VERBATIMENV\s0 environments. .Sp [ Default: \f(CW\*(C`(?:verbatim[*]?|lstlisting\*(C'\fR\ ] .SH "COMMON PROBLEMS AND FAQ" .IX Header "COMMON PROBLEMS AND FAQ" -.IP "Citations result in overfull boxes" 10 -.IX Item "Citations result in overfull boxes" +.IP "Changed citations result in overfull boxes" 10 +.IX Item "Changed citations result in overfull boxes" There is an incompatibility between the \f(CW\*(C`ulem\*(C'\fR package, which \f(CW\*(C`latexdiff\*(C'\fR uses for underlining and striking out in the \s-1UNDERLINE\s0 style, -the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an \f(CW\*(C`\embox\*(C'\fR -command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have two possibilities. +the default style, and the way citations are generated. In order to be able to mark up citations properly, they are enclosed with an \f(CW\*(C`\embox\*(C'\fR +command. As mboxes cannot be broken across lines, this procedure frequently results in overfull boxes, possibly obscuring the content as it extends beyond the right margin. The same occurs for some other packages (e.g., siunitx). If this is a problem, you have several possibilities. .Sp 1. Use \f(CW\*(C`CFONT\*(C'\fR type markup (option \f(CW\*(C`\-t CFONT\*(C'\fR): If this markup is chosen, then changed citations are no longer marked up with the wavy line (additions) or struck out (deletions), but are still highlighted in the appropriate color, and deleted text is shown with a different font. Other styles not using the \f(CW\*(C`ulem\*(C'\fR package will also work. .Sp 2. Choose option \f(CW\*(C`\-\-disable\-citation\-markup\*(C'\fR which turns off the marking up of citations: deleted citations are no longer shown, and -added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older) -.Sp +added citations are shown without markup. (This was the default behaviour of latexdiff at versions 0.6 and older). For custom packages you can define the commands which need to be protected by \f(CW\*(C`\embox\*(C'\fR with \f(CW\*(C`\-\-append\-mboxsafecmd\*(C'\fR and \f(CW\*(C`\-\-excludemboxsafecmd\*(C'\fR options (submit your lists of command as feature request at github page to set the default behaviour of future versions, see section 6) -.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 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 +.Sp +3. If you are using luatex >= 1.12.0 you can use option \s-1LUAUNDERLINE\s0 that uses lua-ul instead of ulem for underlining, which does not have this problem (experimental feature). +.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 option \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 "Deleted parts in equations are not struck out but underlined." 10 +.IX Item "Deleted parts in equations are not struck out but underlined." +This is a limitation of the ulem package that implements the strike-out. If you use the amsmath package, then the strike-out command is redefined in such a way that deleted passages are wrapped with \f(CW\*(C`\etext\*(C'\fR command; adding \f(CW\*(C`\eusepackage{amsmath}\*(C'\fR to your preamble will trigger this behaviour. (If amsmath is not included directly, but imported by another package, latexdiff will not be able to detect its availability; in this case you can give latexdiff a hint with option \f(CW\*(C`\-\-packages=amsmath\*(C'\fR. +.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 package to be installed). +.IP "The character encoding breaks when running latexdiff from powershell." 10 +.IX Item "The character encoding breaks when running latexdiff from powershell." +This problem is not limited to \f(CW\*(C`latexdiff\*(C'\fR and has to do with the default settings of \f(CW\*(C`powershell\*(C'\fR in Windows. It is recommended to use \f(CW\*(C`cmd\*(C'\fR instead. .SH "BUGS" .IX Header "BUGS" .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, +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 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 latex, please send me those files, ideally edited to only contain the -offending passage as long as that still reproduces the problem. If your +offending passage as long as that still reproduces the problem. If your file relies on non-standard class files, you must include those. I will not look at examples where I have trouble to latex the original files. .SH "SEE ALSO" @@ -909,22 +922,22 @@ latexrevise, latexdiff-vc .SH "PORTABILITY" .IX Header "PORTABILITY" \&\fIlatexdiff\fR does not make use of external commands and thus should run -on any platform supporting Perl 5.6 or higher. If files with encodings +on any platform supporting Perl 5.6 or higher. If files with encodings other than \s-1ASCII\s0 or \s-1UTF\-8\s0 are processed, Perl 5.8 or higher is required. .PP The standard version of \fIlatexdiff\fR requires installation of the Perl package -\&\f(CW\*(C`Algorithm::Diff\*(C'\fR (available from \fIwww.cpan.org\fR \- +\&\f(CW\*(C`Algorithm::Diff\*(C'\fR (available from \fIwww.cpan.org\fR \- \&\fIhttp://search.cpan.org/~nedkonz/Algorithm\-Diff\-1.15\fR) but a stand-alone 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.3.3 -Copyright (C) 2004\-2022 Frederik Tilmann +Version 1.3.4 +Copyright (C) 2004\-2024 Frederik Tilmann .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License Version 3 .PP -Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, +Contributors of fixes and additions: V. Kuhlmann, J. Paisley, N. Becker, T. Doerges, K. Huebner, T. Connors, Sebastian Gouezel and many others. Thanks to the many people who sent in bug reports, feature suggestions, and other feedback. diff --git a/support/latexdiff/latexrevise.1 b/support/latexdiff/latexrevise.1 index a67d09564f..d2d91dbe41 100644 --- a/support/latexdiff/latexrevise.1 +++ b/support/latexdiff/latexrevise.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "LATEXREVISE 1" -.TH LATEXREVISE 1 "2021-12-27" "perl v5.30.0" " " +.TH LATEXREVISE 1 "2021-12-27" "perl v5.34.0" " " .\" 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/support/latexindent/LatexIndent/GetYamlSettings.pm b/support/latexindent/LatexIndent/GetYamlSettings.pm index 6365e0fd93..cbea5437c6 100644 --- a/support/latexindent/LatexIndent/GetYamlSettings.pm +++ b/support/latexindent/LatexIndent/GetYamlSettings.pm @@ -749,6 +749,9 @@ sub yaml_read_settings { my $parent = $keysValues[0]; my $child = $keysValues[1]; my $grandchild = $keysValues[2]; + + delete $mainSettings{$parent}{$child} if (defined $mainSettings{$parent}{$child} and ref $mainSettings{$parent}{$child} ne "HASH" ); + $logger->info("Updating mainSettings with $parent: $child: $grandchild: $value"); $mainSettings{$parent}{$child}{$grandchild} = $value; } diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm index 5232967fb9..039d492356 100644 --- a/support/latexindent/LatexIndent/Version.pm +++ b/support/latexindent/LatexIndent/Version.pm @@ -20,6 +20,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.24.2'; -our $versionDate = '2024-06-15'; +our $versionNumber = '3.24.4'; +our $versionDate = '2024-07-18'; 1 diff --git a/support/latexindent/LatexIndent/Wrap.pm b/support/latexindent/LatexIndent/Wrap.pm index 334902dc66..1116b05fa8 100644 --- a/support/latexindent/LatexIndent/Wrap.pm +++ b/support/latexindent/LatexIndent/Wrap.pm @@ -659,6 +659,13 @@ sub text_wrap_comment_blocks { # call the text wrapping routine my $columns = ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{columns}; + # fail gracefully if columns == 0 + if ($columns==0){ + $logger->warn("* textWrapOptions: columns is set to 0, can't text wrap with this"); + ${ ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{comments} }{wrap} = 0; + return; + } + # # text wrap comment blocks # diff --git a/support/latexindent/README b/support/latexindent/README index 0b58c4ee72..3bd2dbfe98 100644 --- a/support/latexindent/README +++ b/support/latexindent/README @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.24.2, 2024-06-15 + latexindent.pl, version 3.24.4, 2024-07-18 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/support/latexindent/bin/linux/latexindent b/support/latexindent/bin/linux/latexindent Binary files differindex 00a6b1c1ae..f6337243cb 100644 --- a/support/latexindent/bin/linux/latexindent +++ b/support/latexindent/bin/linux/latexindent diff --git a/support/latexindent/bin/macos/latexindent b/support/latexindent/bin/macos/latexindent Binary files differindex 649392d07e..63421aa529 100644 --- a/support/latexindent/bin/macos/latexindent +++ b/support/latexindent/bin/macos/latexindent diff --git a/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml index 15073c2f98..7ad03f254b 100644 --- a/support/latexindent/defaultSettings.yaml +++ b/support/latexindent/defaultSettings.yaml @@ -1,5 +1,5 @@ # -# latexindent.pl, version 3.24.2, 2024-06-15 +# latexindent.pl, version 3.24.4, 2024-07-18 # # defaultSettings.yaml, the default settings for latexindent.pl # diff --git a/support/latexindent/documentation/latexindent-yaml-schema.json b/support/latexindent/documentation/latexindent-yaml-schema.json index 8f457e916f..8f0cf208e2 100644 --- a/support/latexindent/documentation/latexindent-yaml-schema.json +++ b/support/latexindent/documentation/latexindent-yaml-schema.json @@ -2,7 +2,7 @@ "$schema": "http://json-schema.org/schema", "$id": "latexindent-yaml-schema.json", "title": "latexindent.pl YAML schema", - "description": "latexindent.pl YAML schema helper, V3.24.2 2024-06-15", + "description": "latexindent.pl YAML schema helper, V3.24.4 2024-07-18", "type": "object", "properties": { "fileExtensionPreference": { diff --git a/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf Binary files differindex 60f57e8d37..19361f5268 100644 --- a/support/latexindent/documentation/latexindent.pdf +++ b/support/latexindent/documentation/latexindent.pdf diff --git a/support/latexindent/documentation/latexindent.tex b/support/latexindent/documentation/latexindent.tex index e5a2ae3b16..fefde34ec2 100644 --- a/support/latexindent/documentation/latexindent.tex +++ b/support/latexindent/documentation/latexindent.tex @@ -131,6 +131,7 @@ % bibliographies \addbibresource{latex-indent} \addbibresource{contributors} +\BiblatexSplitbibDefernumbersWarningOff % http://tex.stackexchange.com/questions/122135/how-to-add-a-png-icon-on-the-right-side-of-a-tcolorbox-title \newtcolorbox{warning}{parbox=false, @@ -585,14 +586,14 @@ title={example~\thetcbcounter}, fonttitle=\bfseries\sffamily, detach title, - before upper={\llap{\tcbtitle\hspace{5mm}}}, coltitle=black, colback=white, grow to left by=6mm, % % circles and line by the side % - overlay unbroken={% + overlay unbroken and first={% + \node at ([xshift=-8mm,yshift=-4.5mm]interior.north west) {\bfseries example \thetcbcounter}; \path [fill=black] ([xshift=1mm,yshift=3mm]interior.south east) node{\hbox{\rule{1ex}{1ex}}}; }, overlay last={% @@ -859,7 +860,7 @@ throughout this document for details}. \subsection{Quick start}\label{sec:quickstart} - When \texttt{latexindent.pl} reads and writes files, the files are read and written in UTF-8 format by default. + When \texttt{latexindent.pl} reads and writes files, the files are read and written in UTF-8 format by default. That is to say, the encoding format for tex and yaml files needs to be in UTF-8 format. If you'd like to get started with \texttt{latexindent.pl} then simply type @@ -8563,8 +8564,8 @@ perl latexindent-module-installer.pl \begin{commandshell} sudo apt-get install perlbrew perlbrew init -perlbrew install perl-5.39.1 -perlbrew switch perl-5.39.1 +perlbrew install perl-5.40.0 +perlbrew switch perl-5.40.0 sudo apt-get install curl curl -L http://cpanmin.us | perl - App::cpanminus cpanm YAML::Tiny diff --git a/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl index c85bdf2047..a467fb420e 100755 --- a/support/latexindent/latexindent.pl +++ b/support/latexindent/latexindent.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# latexindent.pl, version 3.24.2, 2024-06-15 +# latexindent.pl, version 3.24.4, 2024-07-18 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/support/luafindfont/CHANGELOG b/support/luafindfont/CHANGELOG index 783f804f29..a629f6617a 100644 --- a/support/luafindfont/CHANGELOG +++ b/support/luafindfont/CHANGELOG @@ -1,3 +1,4 @@ +0.14 2024-08-25 - small changes to the output 0.13 2023-06-23 - add exrun:close() for every kpsewhich test 0.12 2023-06-21 - bugfix for undefined exrun (l. 251) - check for empty font list and given font number diff --git a/support/luafindfont/doc/luafindfont-doc.pdf b/support/luafindfont/doc/luafindfont-doc.pdf Binary files differindex 65be6ced10..f51c3478b8 100644 --- a/support/luafindfont/doc/luafindfont-doc.pdf +++ b/support/luafindfont/doc/luafindfont-doc.pdf diff --git a/support/luafindfont/doc/luafindfont-doc.tex b/support/luafindfont/doc/luafindfont-doc.tex index c10483ce5a..818cd16fbb 100644 --- a/support/luafindfont/doc/luafindfont-doc.tex +++ b/support/luafindfont/doc/luafindfont-doc.tex @@ -1,4 +1,4 @@ - %% $Id: luafindfont-doc.tex 648 2022-11-03 19:58:48Z herbert $ + %% $Id: luafindfont-doc.tex 962 2024-08-25 16:50:54Z herbert $ % \listfiles\setcounter{errorcontextlines}{100} \documentclass[paper=a4,fontsize=11pt,DIV=14,parskip=half-, @@ -81,7 +81,7 @@ \def\setVersion#1{\setVVersion#1!!} \def\setVVersion#1=#2!!{\def\luafindfontVersion{#2}} -\setVersion{version = 0.11}% can be automatically changed by perl +\setVersion{version = 0.14}% can be automatically changed by perl \setkeys{hv}{cleanup={},force} diff --git a/support/luafindfont/scripts/luafindfont.lua b/support/luafindfont/scripts/luafindfont.lua index a1d554b5ae..f77f913a7d 100755 --- a/support/luafindfont/scripts/luafindfont.lua +++ b/support/luafindfont/scripts/luafindfont.lua @@ -1,6 +1,6 @@ #!/usr/bin/env texlua -- --- $Id: luafindfont.lua 735 2023-06-22 19:12:29Z herbert $ +-- $Id: luafindfont.lua 961 2024-08-25 16:47:59Z herbert $ ----------------------------------------------------------------------- -- FILE: luafindfont.lua -- DESCRIPTION: search for fonts in the database @@ -8,7 +8,7 @@ -- AUTHOR: Herbert Voß (C) 2023-06-21 ----------------------------------------------------------------------- luafindfont = luafindfont or { } - local version = 0.13 + local version = 0.14 luafindfont.version = version --[[ @@ -31,6 +31,7 @@ Report bugs to hvoss@tug.org ]] +-- equivilant with ConTeXt, e.g. times -- mtxrun --script font --list --name --all --pattern=times kpse.set_program_name("luatex") @@ -38,8 +39,6 @@ local f = kpse.find_file("lualibs.lua") require("lualibs") -- all part of LuaTeX ---require("luafindfont-utflib") - if #arg == 0 then print("I need at least one argument or option! Will exit ...") os.exit() @@ -282,6 +281,13 @@ function compareEntries(f1, f2) end end +function centerText(text, width) + if text == nil then return "" end + local spaces = math.floor((width-string.len(text))/2) + local len = string.len(text) + return ((" "):rep(spaces)..text..(" "):rep(spaces)) +end + local fontData = {} local fontListFile = getFileLocation() if fontListFile == "" then @@ -375,20 +381,38 @@ if l_max[3] > maxStrLength then l_max[3] = maxStrLength end local minChars = 26 local Fontname = "Filename" local Path = "Path" -local SymbolicName = "Symbolic name" +local SymbolicName = "Symbolic" local lfdNr = "No." if (font_str ~= "*") and not noSymbolicNames then if args_xetex > 0 then - print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,SymbolicName,Path,"X")) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + io.write(centerText(Path,l_max[3])) + print("X") else - print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[2].."s %"..l_max[3].."s",lfdNr,Fontname,SymbolicName,Path)) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + print(centerText(Path,l_max[3])) end else if args_xetex > 0 then - print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s".."%4s",lfdNr,Fontname,Path,"X")) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + io.write(centerText(Path,l_max[3])) + print("X") else - print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s",lfdNr,Fontname,Path)) +-- print(string.format("%5s %"..l_max[1].."s %"..l_max[3].."s",lfdNr,Fontname,Path)) + io.write(string.format("%5s",lfdNr)) + io.write(centerText(Fontname,l_max[1])) + io.write(centerText(SymbolicName,l_max[2])) + print(centerText(Path,l_max[3])) end end diff --git a/support/mf2pt1/ChangeLog b/support/mf2pt1/ChangeLog index a8e6d2d910..6df8f95067 100644 --- a/support/mf2pt1/ChangeLog +++ b/support/mf2pt1/ChangeLog @@ -1,4 +1,15 @@ -2021-12-04 Scott Pakin <pakin@pakin.org> +2024-07-06 Scott Pakin <scott+mf@pakin.org> + + * README, mf2pt1.texi, mf2pt1.mp, mf2pt1.pl: Updated the copyright + year to 2024. + + * mf2pt1.pl: Applied a patch from Werner Lemberg <wl@gnu.org> that + adds extrema later in the FontForge postprocessing script. This + patch originally was submitted as a LilyPond merge request + (https://gitlab.com/lilypond/lilypond/-/merge_requests/2374). + Updated the program version to 2.8. + +2021-12-04 Scott Pakin <scott+mf@pakin.org> * README, mf2pt1.texi: Updated the copyright year to 2021. @@ -7,7 +18,7 @@ already exist. Updated the copyright year to 2021. Updated the version to 2.7. -2021-11-28 Scott Pakin <pakin@pakin.org> +2021-11-28 Scott Pakin <scott+mf@pakin.org> * Makefile, mf2pt1.pl, mf2pt1.texi: Documented that environment variables for programs can now include @@ -18,13 +29,13 @@ commands to be overridden by environment variables that can also include program parameters. -2021-11-27 Scott Pakin <pakin@pakin.org> +2021-11-27 Scott Pakin <scott+mf@pakin.org> * mf2pt1.pl: Introduced a --save-temps option to suppress deletion of intermediate files. -2020-11-27 Scott Pakin <pakin@pakin.org> +2020-11-27 Scott Pakin <scott+mf@pakin.org> * ChangeLog, README, mf2pt1.mp, mf2pt1.pl, mf2pt1.texi: mf2pt1 no longer generates a UniqueID automatically, only when diff --git a/support/mf2pt1/README b/support/mf2pt1/README index 0eb57ca8fc..e101952ff9 100644 --- a/support/mf2pt1/README +++ b/support/mf2pt1/README @@ -27,7 +27,7 @@ For installation instructions, see the mf2pt1 manual (mf2pt1.pdf). Copyright and license --------------------- -Copyright (C) 2005-2021 Scott Pakin, scott+mf@pakin.org +Copyright (C) 2005-2024 Scott Pakin, scott+mf@pakin.org This package may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this diff --git a/support/mf2pt1/mf2pt1.mp b/support/mf2pt1/mf2pt1.mp index 3ef56f9ab9..e5cbc9474f 100644 --- a/support/mf2pt1/mf2pt1.mp +++ b/support/mf2pt1/mf2pt1.mp @@ -10,7 +10,7 @@ %%%% ==================================================================== %%%% %%%% mf2pt1 %%%% -%%%% Copyright (C) 2005-2020 Scott Pakin %%%% +%%%% Copyright (C) 2005-2024 Scott Pakin %%%% %%%% %%%% %%%% This program may be distributed and/or modified under the conditions %%%% %%%% of the LaTeX Project Public License, either version 1.3c of this %%%% diff --git a/support/mf2pt1/mf2pt1.pdf b/support/mf2pt1/mf2pt1.pdf Binary files differindex a28895171a..e702482c74 100644 --- a/support/mf2pt1/mf2pt1.pdf +++ b/support/mf2pt1/mf2pt1.pdf diff --git a/support/mf2pt1/mf2pt1.pl b/support/mf2pt1/mf2pt1.pl index a9ee8b74fc..982f8c98be 100755 --- a/support/mf2pt1/mf2pt1.pl +++ b/support/mf2pt1/mf2pt1.pl @@ -7,7 +7,7 @@ ######################################################################## # mf2pt1 # -# Copyright (C) 2005-2021 Scott Pakin # +# Copyright (C) 2005-2024 Scott Pakin # # # # This program may be distributed and/or modified under the conditions # # of the LaTeX Project Public License, either version 1.3c of this # @@ -21,7 +21,7 @@ # version 2006/05/20 or later. # ######################################################################## -our $VERSION = "2.7"; # mf2pt1 version number +our $VERSION = "2.8"; # mf2pt1 version number require 5.6.1; # I haven't tested mf2pt1 with older Perl versions use Cwd; @@ -161,7 +161,7 @@ my $filedir; my $filenoext; my $versionmsg = "mf2pt1 version $VERSION -Copyright (C) 2005-2021 Scott Pakin +Copyright (C) 2005-2024 Scott Pakin This program may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this @@ -1006,9 +1006,9 @@ else { Open($1); SelectAll(); RemoveOverlap(); -AddExtrema(); Simplify(0, 2); CorrectDirection(); +AddExtrema(1); Simplify(0, 2); RoundToInt(); AutoHint(); diff --git a/support/mf2pt1/mf2pt1.texi b/support/mf2pt1/mf2pt1.texi index 9260689d18..f18ed6694c 100644 --- a/support/mf2pt1/mf2pt1.texi +++ b/support/mf2pt1/mf2pt1.texi @@ -11,7 +11,7 @@ @c %**end of header @copying -Copyright @copyright{} 2005--2021 Scott Pakin +Copyright @copyright{} 2005--2024 Scott Pakin @sp 2 @@ -30,8 +30,8 @@ version 2006/05/20 or later. @end copying -@set VERSION 2.7 -@set DATE 4 December 2021 +@set VERSION 2.8 +@set DATE 6 July 2024 @c Define some fonts we intend to use. @iftex @@ -679,9 +679,9 @@ parameters that @command{mf2pt1} accepts: @noindent @b{if} known @i{ps_output}: -@multitable {@b{if}} {@b{font_underline_thickness}} {@t{"Copyright (C) 2021 Scott Pakin.";}} +@multitable {@b{if}} {@b{font_underline_thickness}} {@t{"Copyright (C) 2005-2024 Scott Pakin.";}} @item @tab @b{font_coding_scheme} @tab @t{"ot1"}; -@item @tab @b{font_comment} @tab @t{"Copyright (C) 2021 Scott Pakin."}; +@item @tab @b{font_comment} @tab @t{"Copyright (C) 2005-2024 Scott Pakin."}; @item @tab @b{font_family} @tab @t{"Kerplotz"}; @item @tab @b{font_fixed_pitch} @tab @b{false}; @item @tab @b{font_identifier} @tab @t{"Kerplotz Light Oblique"}; @@ -708,7 +708,7 @@ The same parameters can also be specified on the command line as follows: @example -mf2pt1 --encoding=ot1 --comment="Copyright (C) 2021 Scott Pakin." +mf2pt1 --encoding=ot1 --comment="Copyright (C) 2005-2024 Scott Pakin." --family=Kerplotz --nofixedpitch --fullname="Kerplotz Light Oblique" --name=Kerplotz-LightOblique --designsize=10 --italicangle=-9.5 --underpos=-100 --underthick=50 --uniqueid=4112233 --version=002.005 @@ -881,7 +881,7 @@ character position the current encoding has designated for the @section Restoring @file{mfplain} defaults @command{mf2pt1} normally redefines @strong{filldraw} as @strong{fill} -and @strong{unfilldraw} and @strong{unfill} because @w{Type 1} fonts +and @strong{unfilldraw} as @strong{unfill} because @w{Type 1} fonts don't allow overlapping curves. Similarly, @command{mf2pt1} redefines @strong{pencircle} as a 20-gon to coerce MetaPost into drawing it using a filled instead of a stroked PostScript path. @@ -957,7 +957,7 @@ more robust way to dump @file{mf2pt1.mem}; for directing me to the overlap-removal code mentioned in @ref{Restrictions}; for supplying the @emph{crossproduct}, @emph{makeline}, and @emph{is_clockwise} functions used by @file{mf2pt1.mp}; for proposing the @copt{bpppix} -command-line option; and for suggesting various features and +command-line option; and for suggesting numerous features and improvements to @command{mf2pt1}. Thanks also go to Werner Lemberg and @iftex diff --git a/support/texlab/CHANGELOG.md b/support/texlab/CHANGELOG.md index 007f344876..f2fa8d96cf 100644 --- a/support/texlab/CHANGELOG.md +++ b/support/texlab/CHANGELOG.md @@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [5.19.0] - 2024-07-08 + +### Added + +- Add `texlab.build.useFileList` setting to allow controlling whether to use the `.fls` files + +### Changed + +- Disable using `.fls` files for project detection by default + +## [5.18.0] - 2024-07-06 + +### Added + +- Parse `.fls` files to make the project detection more reliable ([#1145](https://github.com/latex-lsp/texlab/issues/1145)) + +### Fixed + +- Fix parsing commands with unicode characters inside BibTeX entries + ([#1147](https://github.com/latex-lsp/texlab/issues/1147)) +- Improve detection of included files when non-ASCII characters are used ([#923](https://github.com/latex-lsp/texlab/issues/923)) +- Fix resolving includes starting from files included using `\subimport` ([#1145](https://github.com/latex-lsp/texlab/issues/1145)) + ## [5.17.0] - 2024-06-23 ### Added diff --git a/support/texlab/Cargo.lock b/support/texlab/Cargo.lock index 09847a2a79..ead2473278 100644 --- a/support/texlab/Cargo.lock +++ b/support/texlab/Cargo.lock @@ -90,7 +90,7 @@ dependencies = [ "bibtex-utils", "dirs", "distro", - "itertools 0.12.1", + "itertools 0.13.0", "line-index", "log", "notify", @@ -99,7 +99,7 @@ dependencies = [ "percent-encoding", "regex", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "shellexpand", "syntax", "titlecase", @@ -130,10 +130,10 @@ dependencies = [ "chrono", "expect-test", "human_name", - "itertools 0.12.1", + "itertools 0.13.0", "parser", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "unicode-normalization", ] @@ -232,10 +232,10 @@ dependencies = [ "bibtex-utils", "expect-test", "isocountry", - "itertools 0.12.1", + "itertools 0.13.0", "parser", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "titlecase", "unicode-normalization", @@ -244,9 +244,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "84b3edb18336f4df585bc9aa31dd99c036dfa5dc5e9a2939a722a188f3a8970d" dependencies = [ "clap_builder", "clap_derive", @@ -254,9 +254,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "c1c09dd5ada6c6c78075d6fd0da3f90d8080651e2d6cc8eb2f1aaa4034ced708" dependencies = [ "anstream", "anstyle", @@ -266,9 +266,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" dependencies = [ "heck", "proc-macro2", @@ -298,11 +298,11 @@ dependencies = [ "crossbeam-channel", "distro", "expect-test", - "itertools 0.12.1", + "itertools 0.13.0", "libc", "log", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", "thiserror", @@ -337,7 +337,7 @@ dependencies = [ "parser", "rayon", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", "url", @@ -348,9 +348,9 @@ name = "completion-data" version = "0.0.0" dependencies = [ "flate2", - "itertools 0.12.1", + "itertools 0.13.0", "once_cell", - "rustc-hash", + "rustc-hash 2.0.0", "serde", "serde_json", ] @@ -408,9 +408,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -450,9 +450,9 @@ name = "definition" version = "0.0.0" dependencies = [ "base-db", - "itertools 0.12.1", + "itertools 0.13.0", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", ] @@ -465,14 +465,14 @@ dependencies = [ "encoding_rs", "encoding_rs_io", "expect-test", - "itertools 0.12.1", + "itertools 0.13.0", "line-index", "log", "multimap", "once_cell", "regex", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", "url", @@ -510,7 +510,7 @@ name = "distro" version = "0.0.0" dependencies = [ "anyhow", - "rustc-hash", + "rustc-hash 2.0.0", ] [[package]] @@ -742,7 +742,7 @@ dependencies = [ "base-db", "expect-test", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "test-utils", ] @@ -811,9 +811,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -869,7 +869,7 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" name = "line-index" version = "0.0.0" dependencies = [ - "rustc-hash", + "rustc-hash 2.0.0", "text-size", ] @@ -900,9 +900,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "logos" @@ -1127,7 +1127,7 @@ dependencies = [ "pathdiff", "regex", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "tempfile", "versions", @@ -1299,16 +1299,16 @@ version = "0.0.0" dependencies = [ "base-db", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -1340,7 +1340,7 @@ dependencies = [ "base-db", "parser", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "syntax", "test-utils", ] @@ -1354,7 +1354,7 @@ dependencies = [ "countme", "hashbrown", "memoffset", - "rustc-hash", + "rustc-hash 1.1.0", "text-size", ] @@ -1365,6 +1365,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] name = "rustix" version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1406,18 +1412,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -1426,9 +1432,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "e8eddb61f0697cc3989c5d64b452f5488e2b8a60fd7d5076a3045076ffef8cb0" dependencies = [ "itoa", "ryu", @@ -1496,7 +1502,7 @@ dependencies = [ "base-db", "distro", "expect-test", - "itertools 0.12.1", + "itertools 0.13.0", "line-index", "regex", "rowan", @@ -1521,8 +1527,9 @@ dependencies = [ name = "syntax" version = "0.0.0" dependencies = [ - "itertools 0.12.1", + "itertools 0.13.0", "rowan", + "rustc-hash 2.0.0", ] [[package]] @@ -1550,7 +1557,7 @@ dependencies = [ [[package]] name = "texlab" -version = "5.17.0" +version = "5.19.0" dependencies = [ "anyhow", "base-db", @@ -1584,7 +1591,7 @@ dependencies = [ "regex", "rename", "rowan", - "rustc-hash", + "rustc-hash 2.0.0", "serde", "serde_json", "serde_regex", @@ -1744,11 +1751,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "versions" -version = "6.2.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38a8931f8d167b6448076020e70b9de46dcf5ea1731212481a092d0071c4ac5b" +checksum = "5fc28d1172a20e32754969ea1a873c2c6e68e36c449c6056aa3e2ee5fe69a794" dependencies = [ - "itertools 0.12.1", + "itertools 0.13.0", "nom", ] diff --git a/support/texlab/crates/base-db/Cargo.toml b/support/texlab/crates/base-db/Cargo.toml index ca477c496c..547ba2ad77 100644 --- a/support/texlab/crates/base-db/Cargo.toml +++ b/support/texlab/crates/base-db/Cargo.toml @@ -10,16 +10,16 @@ rust-version.workspace = true bibtex-utils = { path = "../bibtex-utils" } dirs = "5.0.1" distro = { path = "../distro" } -itertools = "0.12.1" +itertools = "0.13.0" line-index = { path = "../line-index" } -log = "0.4.21" +log = "0.4.22" notify = "6.0.1" once_cell = "1.19.0" parser = { path = "../parser" } percent-encoding = "2.3.0" -regex = "1.10.4" +regex = "1.10.5" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" shellexpand = "3.1.0" syntax = { path = "../syntax" } titlecase = "3.0.0" diff --git a/support/texlab/crates/base-db/src/deps/graph.rs b/support/texlab/crates/base-db/src/deps/graph.rs index 4b2399b7f8..0d8252688d 100644 --- a/support/texlab/crates/base-db/src/deps/graph.rs +++ b/support/texlab/crates/base-db/src/deps/graph.rs @@ -1,4 +1,4 @@ -use std::{ffi::OsStr, path::PathBuf, rc::Rc}; +use std::{ffi::OsStr, path::PathBuf, rc::Rc, sync::Arc}; use distro::Language; use itertools::Itertools; @@ -23,6 +23,7 @@ pub struct Edge { #[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum EdgeData { DirectLink(Box<DirectLinkData>), + FileList(Arc<ProjectRoot>), AdditionalFiles, Artifact, } @@ -74,6 +75,7 @@ impl Graph { if visited.insert(edge.target.clone()) { let new_root = match &edge.data { EdgeData::DirectLink(data) => data.new_root.clone(), + EdgeData::FileList(root) => Some(root.as_ref().clone()), _ => None, }; @@ -101,6 +103,10 @@ impl Graph { self.add_direct_links(workspace, start); self.add_artifacts(workspace, start); self.add_additional_files(workspace, start); + + if workspace.config().syntax.use_file_list { + self.add_file_list_links(workspace, start); + } } fn add_additional_files(&mut self, workspace: &Workspace, start: Start) { @@ -120,6 +126,43 @@ impl Graph { } } + fn add_file_list_links(&mut self, workspace: &Workspace, start: Start) -> Option<()> { + let file_list = start.source.data.as_file_list()?; + let home_dir = HOME_DIR.as_deref(); + + let working_dir = file_list + .working_dir + .as_deref() + .and_then(|dir| Url::from_directory_path(dir).ok()); + + let working_dir = working_dir.as_ref().unwrap_or(&start.source.dir); + let new_root = Arc::new(ProjectRoot::from_config(workspace, working_dir)); + + for target_uri in file_list + .inputs + .iter() + .chain(file_list.outputs.iter()) + .filter(|path| { + path.is_relative() + || Language::from_path(&path) == Some(Language::Bib) + || home_dir.map_or(false, |home_dir| path.starts_with(home_dir)) + }) + .filter_map(|path| working_dir.join(path.to_str()?).ok()) + { + if workspace.lookup(&target_uri).is_some() { + self.edges.push(Edge { + source: start.source.uri.clone(), + target: target_uri, + data: EdgeData::FileList(Arc::clone(&new_root)), + }); + } else { + self.missing.push(target_uri); + } + } + + Some(()) + } + fn add_direct_links(&mut self, workspace: &Workspace, start: Start) -> Option<()> { let data = start.source.data.as_tex()?; @@ -169,7 +212,7 @@ impl Graph { .base_dir .as_deref() .and_then(|path| start.root.src_dir.join(path).ok()) - .map(|dir| ProjectRoot::walk_and_find(workspace, &dir)); + .map(|dir| ProjectRoot::from_config(workspace, &dir)); let link_data = DirectLinkData { link: link.clone(), @@ -197,27 +240,33 @@ impl Graph { } let root = start.root; - let relative_path = root.compile_dir.make_relative(&start.source.uri).unwrap(); - - self.add_artifact( - workspace, - start.source, - &root.aux_dir.join(&relative_path).unwrap(), - "aux", - ); + self.add_artifact_group(workspace, start, &root.aux_dir, "aux"); + self.add_artifact_group(workspace, start, &root.log_dir, "log"); + self.add_artifact_group(workspace, start, &root.aux_dir, "fls"); + } - self.add_artifact(workspace, start.source, &root.aux_dir, "aux"); - self.add_artifact(workspace, start.source, &root.compile_dir, "aux"); + fn add_artifact_group( + &mut self, + workspace: &Workspace, + start: Start, + dir: &Url, + extension: &str, + ) { + let relative_path = start + .root + .compile_dir + .make_relative(&start.source.uri) + .unwrap(); self.add_artifact( workspace, start.source, - &root.log_dir.join(&relative_path).unwrap(), - "log", + &dir.join(&relative_path).unwrap(), + extension, ); - self.add_artifact(workspace, start.source, &root.log_dir, "log"); - self.add_artifact(workspace, start.source, &root.compile_dir, "log"); + self.add_artifact(workspace, start.source, &dir, extension); + self.add_artifact(workspace, start.source, &start.root.compile_dir, extension); } fn add_artifact( diff --git a/support/texlab/crates/base-db/src/document.rs b/support/texlab/crates/base-db/src/document.rs index afb5869d69..6fdcf30c16 100644 --- a/support/texlab/crates/base-db/src/document.rs +++ b/support/texlab/crates/base-db/src/document.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use distro::Language; use line_index::{LineCol, LineIndex}; use rowan::TextRange; -use syntax::{bibtex, latex, latexmkrc::LatexmkrcData, BuildError}; +use syntax::{bibtex, file_list::FileList, latex, latexmkrc::LatexmkrcData, BuildError}; use url::Url; use crate::{semantics, Config}; @@ -89,6 +89,7 @@ impl Document { DocumentData::Latexmkrc(data) } Language::Tectonic => DocumentData::Tectonic, + Language::FileList => DocumentData::FileList(parser::parse_file_list(&text)), }; Self { @@ -146,6 +147,7 @@ pub enum DocumentData { Root, Latexmkrc(LatexmkrcData), Tectonic, + FileList(FileList), } impl DocumentData { @@ -188,6 +190,14 @@ impl DocumentData { None } } + + pub fn as_file_list(&self) -> Option<&FileList> { + if let DocumentData::FileList(data) = self { + Some(data) + } else { + None + } + } } #[derive(Debug, Clone)] diff --git a/support/texlab/crates/bibtex-utils/Cargo.toml b/support/texlab/crates/bibtex-utils/Cargo.toml index c20508107c..88ba2d3a37 100644 --- a/support/texlab/crates/bibtex-utils/Cargo.toml +++ b/support/texlab/crates/bibtex-utils/Cargo.toml @@ -9,9 +9,9 @@ rust-version.workspace = true [dependencies] chrono = { version = "0.4.38", default-features = false, features = ["std"] } human_name = "2.0.3" -itertools = "0.12.1" +itertools = "0.13.0" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } unicode-normalization = "0.1.23" diff --git a/support/texlab/crates/citeproc/Cargo.toml b/support/texlab/crates/citeproc/Cargo.toml index 9e187f88e6..c87ab14b0e 100644 --- a/support/texlab/crates/citeproc/Cargo.toml +++ b/support/texlab/crates/citeproc/Cargo.toml @@ -10,9 +10,9 @@ rust-version.workspace = true bibtex-utils = { path = "../bibtex-utils" } base-db = { path = "../base-db" } isocountry = "0.3.2" -itertools = "0.12.1" +itertools = "0.13.0" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } titlecase = "3.0.0" unicode-normalization = "0.1.23" diff --git a/support/texlab/crates/commands/Cargo.toml b/support/texlab/crates/commands/Cargo.toml index 6e415f20d6..6507efb3b8 100644 --- a/support/texlab/crates/commands/Cargo.toml +++ b/support/texlab/crates/commands/Cargo.toml @@ -10,12 +10,12 @@ rust-version.workspace = true anyhow = "1.0.86" base-db = { path = "../base-db" } bstr = "1.9.1" -crossbeam-channel = "0.5.12" -itertools = "0.12.1" +crossbeam-channel = "0.5.13" +itertools = "0.13.0" libc = "0.2.155" -log = "0.4.21" +log = "0.4.22" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } thiserror = "1.0.61" url = "2.5.0" diff --git a/support/texlab/crates/commands/src/dep_graph.rs b/support/texlab/crates/commands/src/dep_graph.rs index fe9ff3829c..86b49da0ac 100644 --- a/support/texlab/crates/commands/src/dep_graph.rs +++ b/support/texlab/crates/commands/src/dep_graph.rs @@ -48,6 +48,7 @@ pub fn show_dependency_graph(workspace: &Workspace) -> Result<String> { base_db::deps::EdgeData::DirectLink(data) => &data.link.path.text, base_db::deps::EdgeData::AdditionalFiles => "<project>", base_db::deps::EdgeData::Artifact => "<artifact>", + base_db::deps::EdgeData::FileList(_) => "<fls>", }; writeln!(&mut writer, "\t{source} -> {target} [label=\"{label}\"];")?; diff --git a/support/texlab/crates/completion-data/Cargo.toml b/support/texlab/crates/completion-data/Cargo.toml index 970cd6a578..6dbb7d4086 100644 --- a/support/texlab/crates/completion-data/Cargo.toml +++ b/support/texlab/crates/completion-data/Cargo.toml @@ -8,11 +8,11 @@ rust-version.workspace = true [dependencies] flate2 = "1.0.30" -itertools = "0.12.1" +itertools = "0.13.0" once_cell = "1.19.0" -rustc-hash = "1.1.0" -serde = { version = "1.0.202", features = ["derive"] } -serde_json = "1.0.117" +rustc-hash = "2.0.0" +serde = { version = "1.0.203", features = ["derive"] } +serde_json = "1.0.119" [lib] doctest = false diff --git a/support/texlab/crates/completion/Cargo.toml b/support/texlab/crates/completion/Cargo.toml index 6469b5f004..f98f12260b 100644 --- a/support/texlab/crates/completion/Cargo.toml +++ b/support/texlab/crates/completion/Cargo.toml @@ -13,7 +13,7 @@ fuzzy-matcher = { version = "0.3.7", features = ["compact"] } line-index = { path = "../line-index" } rayon = "1.10.0" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } url = "2.5.0" diff --git a/support/texlab/crates/definition/Cargo.toml b/support/texlab/crates/definition/Cargo.toml index 63ba15c308..254bea0314 100644 --- a/support/texlab/crates/definition/Cargo.toml +++ b/support/texlab/crates/definition/Cargo.toml @@ -9,11 +9,11 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } [dev-dependencies] -itertools = "0.12.1" +itertools = "0.13.0" test-utils = { path = "../test-utils" } [lib] diff --git a/support/texlab/crates/diagnostics/Cargo.toml b/support/texlab/crates/diagnostics/Cargo.toml index 1cb09fdec9..37e39280ad 100644 --- a/support/texlab/crates/diagnostics/Cargo.toml +++ b/support/texlab/crates/diagnostics/Cargo.toml @@ -10,14 +10,14 @@ rust-version.workspace = true base-db = { path = "../base-db" } encoding_rs = "0.8.34" encoding_rs_io = "0.1.7" -itertools = "0.12.1" +itertools = "0.13.0" line-index = { path = "../line-index" } -log = "0.4.21" +log = "0.4.22" multimap = "0.10.0" once_cell = "1.19.0" -regex = "1.10.4" +regex = "1.10.5" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } url = "2.5.0" diff --git a/support/texlab/crates/distro/Cargo.toml b/support/texlab/crates/distro/Cargo.toml index dea6a56979..c81288e86e 100644 --- a/support/texlab/crates/distro/Cargo.toml +++ b/support/texlab/crates/distro/Cargo.toml @@ -8,7 +8,7 @@ rust-version.workspace = true [dependencies] anyhow = "1.0.86" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" [lib] doctest = false diff --git a/support/texlab/crates/distro/src/language.rs b/support/texlab/crates/distro/src/language.rs index 201ed0702b..0a94a93604 100644 --- a/support/texlab/crates/distro/src/language.rs +++ b/support/texlab/crates/distro/src/language.rs @@ -9,6 +9,7 @@ pub enum Language { Root, Latexmkrc, Tectonic, + FileList, } impl Language { @@ -32,6 +33,7 @@ impl Language { "bib" | "bibtex" => Some(Self::Bib), "aux" => Some(Self::Aux), "log" => Some(Self::Log), + "fls" => Some(Self::FileList), _ => None, } } diff --git a/support/texlab/crates/inlay-hints/Cargo.toml b/support/texlab/crates/inlay-hints/Cargo.toml index ede4ca6188..94651ef4c7 100644 --- a/support/texlab/crates/inlay-hints/Cargo.toml +++ b/support/texlab/crates/inlay-hints/Cargo.toml @@ -9,7 +9,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" [dev-dependencies] test-utils = { path = "../test-utils" } diff --git a/support/texlab/crates/ipc/Cargo.toml b/support/texlab/crates/ipc/Cargo.toml index 1e1ff7a822..92afbba876 100644 --- a/support/texlab/crates/ipc/Cargo.toml +++ b/support/texlab/crates/ipc/Cargo.toml @@ -7,10 +7,10 @@ edition.workspace = true rust-version.workspace = true [dependencies] -crossbeam-channel = "0.5.12" -serde = "1.0.202" -serde_json = "1.0.117" -log = "0.4.21" +crossbeam-channel = "0.5.13" +serde = "1.0.203" +serde_json = "1.0.119" +log = "0.4.22" uds_windows = "1.1.0" [lib] diff --git a/support/texlab/crates/line-index/Cargo.toml b/support/texlab/crates/line-index/Cargo.toml index 73d2766d60..58e2fa9e16 100644 --- a/support/texlab/crates/line-index/Cargo.toml +++ b/support/texlab/crates/line-index/Cargo.toml @@ -7,7 +7,7 @@ edition.workspace = true rust-version.workspace = true [dependencies] -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" text-size = "1.1.1" [lib] diff --git a/support/texlab/crates/parser/Cargo.toml b/support/texlab/crates/parser/Cargo.toml index 39fa34ef63..2faadcb262 100644 --- a/support/texlab/crates/parser/Cargo.toml +++ b/support/texlab/crates/parser/Cargo.toml @@ -7,16 +7,16 @@ edition.workspace = true rust-version.workspace = true [dependencies] -log = "0.4.21" +log = "0.4.22" logos = "0.14.0" once_cell = "1.19.0" pathdiff = "0.2.1" -regex = "1.10.4" +regex = "1.10.5" rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } tempfile = "3.10.1" -versions = "6.2.0" +versions = "6.3.0" [dev-dependencies] expect-test = "1.5.0" diff --git a/support/texlab/crates/parser/src/bibtex.rs b/support/texlab/crates/parser/src/bibtex.rs index e2cde27dec..4d1e561dbe 100644 --- a/support/texlab/crates/parser/src/bibtex.rs +++ b/support/texlab/crates/parser/src/bibtex.rs @@ -2,6 +2,8 @@ use logos::Logos; use rowan::{GreenNode, GreenNodeBuilder}; use syntax::bibtex::SyntaxKind::{self, *}; +use crate::util::lex_command_name; + pub fn parse_bibtex(input: &str) -> GreenNode { let mut ptr = TokenPtr { builder: GreenNodeBuilder::new(), @@ -135,8 +137,8 @@ fn curly_group(mut ptr: TokenPtr<ContentToken>) -> TokenPtr<ContentToken> { | ContentToken::Quote | ContentToken::Word => ptr.bump(), ContentToken::LCurly => ptr = curly_group(ptr), - ContentToken::AccentName => ptr = accent(ptr), - ContentToken::CommandName => ptr = command(ptr), + ContentToken::CommandName(CommandName::Accent) => ptr = accent(ptr), + ContentToken::CommandName(CommandName::Generic) => ptr = command(ptr), }; } @@ -160,8 +162,8 @@ fn quote_group(mut ptr: TokenPtr<ContentToken>) -> TokenPtr<ContentToken> { | ContentToken::Integer | ContentToken::Word => ptr.bump(), ContentToken::LCurly => ptr = curly_group(ptr), - ContentToken::AccentName => ptr = accent(ptr), - ContentToken::CommandName => ptr = command(ptr), + ContentToken::CommandName(CommandName::Accent) => ptr = accent(ptr), + ContentToken::CommandName(CommandName::Generic) => ptr = command(ptr), }; } @@ -181,7 +183,7 @@ fn accent(mut ptr: TokenPtr<ContentToken>) -> TokenPtr<ContentToken> { ptr.expect(ContentToken::Whitespace); } - if ptr.at(ContentToken::Word) || ptr.at(ContentToken::CommandName) { + if ptr.at(ContentToken::Word) || ptr.at(ContentToken::CommandName(CommandName::Generic)) { ptr.bump(); } @@ -355,31 +357,29 @@ enum ContentToken { #[token(r#"~"#)] Nbsp, - #[token(r#"\`"#)] - #[token(r#"\'"#)] - #[token(r#"\^"#)] - #[token(r#"\""#)] - #[token(r#"\H"#)] - #[token(r#"\~"#)] - #[token(r#"\c"#)] - #[token(r#"\k"#)] - #[token(r#"\="#)] - #[token(r#"\b"#)] - #[token(r#"\."#)] - #[token(r#"\d"#)] - #[token(r#"\r"#)] - #[token(r#"\u"#)] - #[token(r#"\v"#)] - #[token(r#"\t"#)] - AccentName, - - #[regex(r"\\([^\r\n]|[@a-zA-Z:_]+\*?)?")] - CommandName, + #[regex(r"\\", |lexer| { CommandName::from(lex_command_name(lexer)) })] + CommandName(CommandName), #[regex(r#"[^\s"\{\}\\~,]+"#)] Word, } +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] +enum CommandName { + Generic, + Accent, +} + +impl From<&str> for CommandName { + fn from(value: &str) -> Self { + match value { + "`" | "'" | "^" | "\"" | "H" | "~" | "c" | "k" | "=" | "b" | "." | "d" | "r" | "u" + | "v" | "t" => CommandName::Accent, + _ => CommandName::Generic, + } + } +} + impl From<RootToken> for SyntaxKind { fn from(token: RootToken) -> Self { match token { @@ -428,8 +428,8 @@ impl From<ContentToken> for SyntaxKind { ContentToken::Quote => QUOTE, ContentToken::Integer => INTEGER, ContentToken::Nbsp => NBSP, - ContentToken::AccentName => ACCENT_NAME, - ContentToken::CommandName => COMMAND_NAME, + ContentToken::CommandName(CommandName::Accent) => ACCENT_NAME, + ContentToken::CommandName(CommandName::Generic) => COMMAND_NAME, ContentToken::Word => WORD, } } diff --git a/support/texlab/crates/parser/src/bibtex/tests.rs b/support/texlab/crates/parser/src/bibtex/tests.rs index e2bb1314d8..f0872b4ca6 100644 --- a/support/texlab/crates/parser/src/bibtex/tests.rs +++ b/support/texlab/crates/parser/src/bibtex/tests.rs @@ -3992,3 +3992,280 @@ fn test_rivest_1978() { "#]], ); } + +#[test] +fn test_cuesta_2002() { + check( + r#"@INPROCEEDINGS{Cuesta02, + author = {Cuesta, Carlos E. and de la Fuente, Pablo and Barrio-Sol\órzano, Manuel and Beato, Encarnaci\ón}, + title = {{Coordination in a Reflective Architecture Description Language}}, + booktitle = {{Proceedings of the 5th International Conference on Coordination Models and Languages (COORDINATION'02)}}, + year = 2002, + editor = {Arbab, Fahrad and Talcott, Carolyn}, + pages = {141--148}, + address = {York, United Kingdom}, + organization = {}, + publisher = {Springer}, + volume = {}, + number = {}, + series = {Lecture Notes in Computer Science 2315}, + month = apr, + note = {} +}"#, + expect![[r#" + ROOT@0..617 + ENTRY@0..617 + TYPE@0..14 "@INPROCEEDINGS" + L_DELIM@14..15 "{" + NAME@15..23 "Cuesta02" + COMMA@23..24 "," + WHITESPACE@24..27 "\n " + FIELD@27..136 + NAME@27..33 "author" + WHITESPACE@33..34 " " + EQ@34..35 "=" + WHITESPACE@35..36 " " + CURLY_GROUP@36..135 + L_CURLY@36..37 "{" + WORD@37..43 "Cuesta" + COMMA@43..44 "," + WHITESPACE@44..45 " " + WORD@45..51 "Carlos" + WHITESPACE@51..52 " " + WORD@52..54 "E." + WHITESPACE@54..55 " " + WORD@55..58 "and" + WHITESPACE@58..59 " " + WORD@59..61 "de" + WHITESPACE@61..62 " " + WORD@62..64 "la" + WHITESPACE@64..65 " " + WORD@65..71 "Fuente" + COMMA@71..72 "," + WHITESPACE@72..73 " " + WORD@73..78 "Pablo" + WHITESPACE@78..79 " " + WORD@79..82 "and" + WHITESPACE@82..83 " " + WORD@83..93 "Barrio-Sol" + COMMAND@93..101 + COMMAND_NAME@93..101 "\\órzano" + COMMA@101..102 "," + WHITESPACE@102..103 " " + WORD@103..109 "Manuel" + WHITESPACE@109..110 " " + WORD@110..113 "and" + WHITESPACE@113..114 " " + WORD@114..119 "Beato" + COMMA@119..120 "," + WHITESPACE@120..121 " " + WORD@121..130 "Encarnaci" + COMMAND@130..134 + COMMAND_NAME@130..134 "\\ón" + R_CURLY@134..135 "}" + COMMA@135..136 "," + WHITESPACE@136..139 "\n " + FIELD@139..214 + NAME@139..144 "title" + WHITESPACE@144..145 " " + EQ@145..146 "=" + WHITESPACE@146..147 " " + CURLY_GROUP@147..213 + L_CURLY@147..148 "{" + CURLY_GROUP@148..212 + L_CURLY@148..149 "{" + WORD@149..161 "Coordination" + WHITESPACE@161..162 " " + WORD@162..164 "in" + WHITESPACE@164..165 " " + WORD@165..166 "a" + WHITESPACE@166..167 " " + WORD@167..177 "Reflective" + WHITESPACE@177..178 " " + WORD@178..190 "Architecture" + WHITESPACE@190..191 " " + WORD@191..202 "Description" + WHITESPACE@202..203 " " + WORD@203..211 "Language" + R_CURLY@211..212 "}" + R_CURLY@212..213 "}" + COMMA@213..214 "," + WHITESPACE@214..217 "\n " + FIELD@217..336 + NAME@217..226 "booktitle" + WHITESPACE@226..227 " " + EQ@227..228 "=" + WHITESPACE@228..229 " " + CURLY_GROUP@229..335 + L_CURLY@229..230 "{" + CURLY_GROUP@230..334 + L_CURLY@230..231 "{" + WORD@231..242 "Proceedings" + WHITESPACE@242..243 " " + WORD@243..245 "of" + WHITESPACE@245..246 " " + WORD@246..249 "the" + WHITESPACE@249..250 " " + WORD@250..253 "5th" + WHITESPACE@253..254 " " + WORD@254..267 "International" + WHITESPACE@267..268 " " + WORD@268..278 "Conference" + WHITESPACE@278..279 " " + WORD@279..281 "on" + WHITESPACE@281..282 " " + WORD@282..294 "Coordination" + WHITESPACE@294..295 " " + WORD@295..301 "Models" + WHITESPACE@301..302 " " + WORD@302..305 "and" + WHITESPACE@305..306 " " + WORD@306..315 "Languages" + WHITESPACE@315..316 " " + WORD@316..333 "(COORDINATION'02)" + R_CURLY@333..334 "}" + R_CURLY@334..335 "}" + COMMA@335..336 "," + WHITESPACE@336..339 "\n " + FIELD@339..351 + NAME@339..343 "year" + WHITESPACE@343..344 " " + EQ@344..345 "=" + WHITESPACE@345..346 " " + LITERAL@346..350 + INTEGER@346..350 "2002" + COMMA@350..351 "," + WHITESPACE@351..354 "\n " + FIELD@354..400 + NAME@354..360 "editor" + WHITESPACE@360..361 " " + EQ@361..362 "=" + WHITESPACE@362..363 " " + CURLY_GROUP@363..399 + L_CURLY@363..364 "{" + WORD@364..369 "Arbab" + COMMA@369..370 "," + WHITESPACE@370..371 " " + WORD@371..377 "Fahrad" + WHITESPACE@377..378 " " + WORD@378..381 "and" + WHITESPACE@381..382 " " + WORD@382..389 "Talcott" + COMMA@389..390 "," + WHITESPACE@390..391 " " + WORD@391..398 "Carolyn" + R_CURLY@398..399 "}" + COMMA@399..400 "," + WHITESPACE@400..403 "\n " + FIELD@403..422 + NAME@403..408 "pages" + WHITESPACE@408..409 " " + EQ@409..410 "=" + WHITESPACE@410..411 " " + CURLY_GROUP@411..421 + L_CURLY@411..412 "{" + WORD@412..420 "141--148" + R_CURLY@420..421 "}" + COMMA@421..422 "," + WHITESPACE@422..425 "\n " + FIELD@425..458 + NAME@425..432 "address" + WHITESPACE@432..433 " " + EQ@433..434 "=" + WHITESPACE@434..435 " " + CURLY_GROUP@435..457 + L_CURLY@435..436 "{" + WORD@436..440 "York" + COMMA@440..441 "," + WHITESPACE@441..442 " " + WORD@442..448 "United" + WHITESPACE@448..449 " " + WORD@449..456 "Kingdom" + R_CURLY@456..457 "}" + COMMA@457..458 "," + WHITESPACE@458..461 "\n " + FIELD@461..479 + NAME@461..473 "organization" + WHITESPACE@473..474 " " + EQ@474..475 "=" + WHITESPACE@475..476 " " + CURLY_GROUP@476..478 + L_CURLY@476..477 "{" + R_CURLY@477..478 "}" + COMMA@478..479 "," + WHITESPACE@479..482 "\n " + FIELD@482..505 + NAME@482..491 "publisher" + WHITESPACE@491..492 " " + EQ@492..493 "=" + WHITESPACE@493..494 " " + CURLY_GROUP@494..504 + L_CURLY@494..495 "{" + WORD@495..503 "Springer" + R_CURLY@503..504 "}" + COMMA@504..505 "," + WHITESPACE@505..508 "\n " + FIELD@508..520 + NAME@508..514 "volume" + WHITESPACE@514..515 " " + EQ@515..516 "=" + WHITESPACE@516..517 " " + CURLY_GROUP@517..519 + L_CURLY@517..518 "{" + R_CURLY@518..519 "}" + COMMA@519..520 "," + WHITESPACE@520..523 "\n " + FIELD@523..535 + NAME@523..529 "number" + WHITESPACE@529..530 " " + EQ@530..531 "=" + WHITESPACE@531..532 " " + CURLY_GROUP@532..534 + L_CURLY@532..533 "{" + R_CURLY@533..534 "}" + COMMA@534..535 "," + WHITESPACE@535..538 "\n " + FIELD@538..588 + NAME@538..544 "series" + WHITESPACE@544..545 " " + EQ@545..546 "=" + WHITESPACE@546..547 " " + CURLY_GROUP@547..587 + L_CURLY@547..548 "{" + WORD@548..555 "Lecture" + WHITESPACE@555..556 " " + WORD@556..561 "Notes" + WHITESPACE@561..562 " " + WORD@562..564 "in" + WHITESPACE@564..565 " " + WORD@565..573 "Computer" + WHITESPACE@573..574 " " + WORD@574..581 "Science" + WHITESPACE@581..582 " " + INTEGER@582..586 "2315" + R_CURLY@586..587 "}" + COMMA@587..588 "," + WHITESPACE@588..591 "\n " + FIELD@591..603 + NAME@591..596 "month" + WHITESPACE@596..597 " " + EQ@597..598 "=" + WHITESPACE@598..599 " " + LITERAL@599..602 + NAME@599..602 "apr" + COMMA@602..603 "," + WHITESPACE@603..606 "\n " + FIELD@606..616 + NAME@606..610 "note" + WHITESPACE@610..611 " " + EQ@611..612 "=" + WHITESPACE@612..613 " " + CURLY_GROUP@613..615 + L_CURLY@613..614 "{" + R_CURLY@614..615 "}" + WHITESPACE@615..616 "\n" + R_DELIM@616..617 "}" + + "#]], + ) +} diff --git a/support/texlab/crates/parser/src/config.rs b/support/texlab/crates/parser/src/config.rs index 95b3e4eb56..2c5380448f 100644 --- a/support/texlab/crates/parser/src/config.rs +++ b/support/texlab/crates/parser/src/config.rs @@ -3,6 +3,7 @@ use rustc_hash::FxHashSet; #[derive(Debug)] pub struct SyntaxConfig { pub follow_package_links: bool, + pub use_file_list: bool, pub math_environments: FxHashSet<String>, pub enum_environments: FxHashSet<String>, pub verbatim_environments: FxHashSet<String>, @@ -57,6 +58,7 @@ impl Default for SyntaxConfig { Self { follow_package_links: false, + use_file_list: false, math_environments, enum_environments, verbatim_environments, diff --git a/support/texlab/crates/parser/src/file_list.rs b/support/texlab/crates/parser/src/file_list.rs new file mode 100644 index 0000000000..c892ebfeef --- /dev/null +++ b/support/texlab/crates/parser/src/file_list.rs @@ -0,0 +1,44 @@ +use syntax::file_list::FileList; + +pub fn parse_file_list(input: &str) -> FileList { + let mut file_list = FileList::default(); + for line in input.lines() { + if let Some(working_dir) = line.strip_prefix("PWD ") { + file_list.working_dir = Some(working_dir.into()); + } else if let Some(input) = line.strip_prefix("INPUT ") { + file_list.inputs.insert(input.into()); + } else if let Some(output) = line.strip_prefix("OUTPUT ") { + file_list.outputs.insert(output.into()); + } + } + + file_list +} + +#[cfg(test)] +mod tests { + use rustc_hash::FxHashSet; + + use super::*; + + #[test] + fn test_parse_file_list() { + let input = r#" +PWD /home/user +INPUT file1.tex +INPUT file1.tex +OUTPUT file2.pdf"#; + + let expected_file_list = FileList { + working_dir: Some("/home/user".into()), + inputs: FxHashSet::from_iter(["file1.tex".into()]), + outputs: FxHashSet::from_iter(["file2.pdf".into()]), + }; + let actual_file_list = parse_file_list(input); + assert_eq!(actual_file_list, expected_file_list); + + assert_eq!(actual_file_list.working_dir, Some("/home/user".into())); + assert_eq!(actual_file_list.inputs.len(), 1); + assert_eq!(actual_file_list.outputs.len(), 1); + } +} diff --git a/support/texlab/crates/parser/src/latex/lexer/types.rs b/support/texlab/crates/parser/src/latex/lexer/types.rs index 896ce01c05..85e542792b 100644 --- a/support/texlab/crates/parser/src/latex/lexer/types.rs +++ b/support/texlab/crates/parser/src/latex/lexer/types.rs @@ -1,5 +1,7 @@ use logos::Logos; +use crate::util::lex_command_name; + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Logos)] pub enum Token { #[regex(r"[\r\n]+", priority = 2)] @@ -44,55 +46,10 @@ pub enum Token { #[regex(r"\$\$?")] Dollar, - #[regex(r"\\", lex_command_name)] + #[regex(r"\\", |lexer| { lex_command_name(lexer); CommandName::Generic } )] CommandName(CommandName), } -fn lex_command_name(lexer: &mut logos::Lexer<Token>) -> CommandName { - let input = &lexer.source()[lexer.span().end..]; - - let mut chars = input.chars().peekable(); - let Some(c) = chars.next() else { - return CommandName::Generic; - }; - - if c.is_whitespace() { - return CommandName::Generic; - } - - lexer.bump(c.len_utf8()); - if !c.is_alphanumeric() && c != '@' { - return CommandName::Generic; - } - - while let Some(c) = chars.next() { - match c { - '*' => { - lexer.bump(c.len_utf8()); - break; - } - c if c.is_alphanumeric() => { - lexer.bump(c.len_utf8()); - } - '_' => { - if !matches!(chars.peek(), Some(c) if c.is_alphanumeric()) { - break; - } - - lexer.bump(c.len_utf8()); - } - '@' | ':' => { - lexer.bump(c.len_utf8()); - } - _ => { - break; - } - } - } - - CommandName::Generic -} - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash)] pub enum CommandName { Generic, diff --git a/support/texlab/crates/parser/src/lib.rs b/support/texlab/crates/parser/src/lib.rs index 2a4190b7e2..b3952d6ea5 100644 --- a/support/texlab/crates/parser/src/lib.rs +++ b/support/texlab/crates/parser/src/lib.rs @@ -1,10 +1,12 @@ mod bibtex; mod build_log; mod config; +mod file_list; mod latex; mod latexmkrc; +pub(crate) mod util; pub use self::{ - bibtex::parse_bibtex, build_log::parse_build_log, config::*, latex::parse_latex, - latexmkrc::parse_latexmkrc, + bibtex::parse_bibtex, build_log::parse_build_log, config::*, file_list::parse_file_list, + latex::parse_latex, latexmkrc::parse_latexmkrc, }; diff --git a/support/texlab/crates/parser/src/util.rs b/support/texlab/crates/parser/src/util.rs new file mode 100644 index 0000000000..cb147c493b --- /dev/null +++ b/support/texlab/crates/parser/src/util.rs @@ -0,0 +1,52 @@ +use std::ops::{Index, Range}; + +use logos::{Logos, Source}; + +pub fn lex_command_name<'a, T>(lexer: &mut logos::Lexer<'a, T>) -> &'a str +where + T: Logos<'a>, + T::Source: Index<Range<usize>, Output = str>, +{ + let start = lexer.span().end; + let input = &lexer.source()[start..lexer.source().len()]; + + let mut chars = input.chars().peekable(); + let Some(c) = chars.next() else { + return ""; + }; + + if c.is_whitespace() { + return ""; + } + + lexer.bump(c.len_utf8()); + + if c.is_alphanumeric() || c == '@' { + while let Some(c) = chars.next() { + match c { + '*' => { + lexer.bump(c.len_utf8()); + break; + } + c if c.is_alphanumeric() => { + lexer.bump(c.len_utf8()); + } + '_' => { + if !matches!(chars.peek(), Some(c) if c.is_alphanumeric()) { + break; + } + + lexer.bump(c.len_utf8()); + } + '@' | ':' => { + lexer.bump(c.len_utf8()); + } + _ => { + break; + } + } + } + } + + &lexer.source()[start..lexer.span().end] +} diff --git a/support/texlab/crates/references/Cargo.toml b/support/texlab/crates/references/Cargo.toml index e78e84ea4c..8d4e3a6936 100644 --- a/support/texlab/crates/references/Cargo.toml +++ b/support/texlab/crates/references/Cargo.toml @@ -9,7 +9,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } [dev-dependencies] diff --git a/support/texlab/crates/rename/Cargo.toml b/support/texlab/crates/rename/Cargo.toml index dc7558515a..592bafb474 100644 --- a/support/texlab/crates/rename/Cargo.toml +++ b/support/texlab/crates/rename/Cargo.toml @@ -9,7 +9,7 @@ rust-version.workspace = true [dependencies] base-db = { path = "../base-db" } rowan = "0.15.15" -rustc-hash = "1.1.0" +rustc-hash = "2.0.0" syntax = { path = "../syntax" } [dev-dependencies] diff --git a/support/texlab/crates/symbols/Cargo.toml b/support/texlab/crates/symbols/Cargo.toml index 65db0fc0bd..c44f120153 100644 --- a/support/texlab/crates/symbols/Cargo.toml +++ b/support/texlab/crates/symbols/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] base-db = { path = "../base-db" } distro = { path = "../distro" } -itertools = "0.12.1" +itertools = "0.13.0" line-index = { path = "../line-index" } rowan = "0.15.15" syntax = { path = "../syntax" } @@ -20,6 +20,6 @@ titlecase = "3.0.0" url = "2.5.0" [dev-dependencies] -regex = "1.10.4" +regex = "1.10.5" test-utils = { path = "../test-utils" } expect-test = "1.5.0" diff --git a/support/texlab/crates/symbols/src/document.rs b/support/texlab/crates/symbols/src/document.rs index 791f119919..611a7e0370 100644 --- a/support/texlab/crates/symbols/src/document.rs +++ b/support/texlab/crates/symbols/src/document.rs @@ -23,6 +23,7 @@ pub fn document_symbols(workspace: &Workspace, document: &Document) -> Vec<Symbo | DocumentData::Log(_) | DocumentData::Root | DocumentData::Latexmkrc(_) + | DocumentData::FileList(_) | DocumentData::Tectonic => Vec::new(), }; diff --git a/support/texlab/crates/syntax/Cargo.toml b/support/texlab/crates/syntax/Cargo.toml index a2d3d866b6..14dfffe380 100644 --- a/support/texlab/crates/syntax/Cargo.toml +++ b/support/texlab/crates/syntax/Cargo.toml @@ -7,8 +7,9 @@ edition.workspace = true rust-version.workspace = true [dependencies] -itertools = "0.12.1" +itertools = "0.13.0" rowan = "0.15.15" +rustc-hash = "2.0.0" [lib] doctest = false diff --git a/support/texlab/crates/syntax/src/file_list.rs b/support/texlab/crates/syntax/src/file_list.rs new file mode 100644 index 0000000000..cd32e787da --- /dev/null +++ b/support/texlab/crates/syntax/src/file_list.rs @@ -0,0 +1,10 @@ +use std::path::PathBuf; + +use rustc_hash::FxHashSet; + +#[derive(Debug, PartialEq, Eq, Clone, Default)] +pub struct FileList { + pub working_dir: Option<PathBuf>, + pub inputs: FxHashSet<PathBuf>, + pub outputs: FxHashSet<PathBuf>, +} diff --git a/support/texlab/crates/syntax/src/lib.rs b/support/texlab/crates/syntax/src/lib.rs index 35f1bb8c52..d3e2098757 100644 --- a/support/texlab/crates/syntax/src/lib.rs +++ b/support/texlab/crates/syntax/src/lib.rs @@ -1,4 +1,5 @@ pub mod bibtex; +pub mod file_list; pub mod latex; pub mod latexmkrc; diff --git a/support/texlab/crates/texlab/Cargo.toml b/support/texlab/crates/texlab/Cargo.toml index fa419413f5..f4cb2d3283 100644 --- a/support/texlab/crates/texlab/Cargo.toml +++ b/support/texlab/crates/texlab/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "texlab" description = "LaTeX Language Server" -version = "5.17.0" +version = "5.19.0" license.workspace = true readme = "README.md" authors.workspace = true @@ -26,11 +26,11 @@ anyhow = "1.0.86" base-db = { path = "../base-db" } bibfmt = { path = "../bibfmt" } citeproc = { path = "../citeproc" } -clap = { version = "4.5.4", features = ["derive"] } +clap = { version = "4.5.8", features = ["derive"] } commands = { path = "../commands" } completion = { path = "../completion" } completion-data = { path = "../completion-data" } -crossbeam-channel = "0.5.12" +crossbeam-channel = "0.5.13" definition = { path = "../definition" } diagnostics = { path = "../diagnostics" } distro = { path = "../distro" } @@ -42,7 +42,7 @@ inlay-hints = { path = "../inlay-hints" } ipc = { path = "../ipc" } line-index = { path = "../line-index" } links = { path = "../links" } -log = "0.4.21" +log = "0.4.22" lsp-server = "0.7.6" lsp-types = "0.95.1" notify = "6.1.1" @@ -50,12 +50,12 @@ notify-debouncer-full = "0.3.1" parking_lot = "0.12.3" parser = { path = "../parser" } references = { path = "../references" } -regex = "1.10.4" +regex = "1.10.5" rename = { path = "../rename" } rowan = "0.15.15" -rustc-hash = "1.1.0" -serde = "1.0.202" -serde_json = "1.0.117" +rustc-hash = "2.0.0" +serde = "1.0.203" +serde_json = "1.0.119" serde_regex = "1.1.0" serde_repr = "0.1.19" symbols = { path = "../symbols" } diff --git a/support/texlab/crates/texlab/src/features/formatting.rs b/support/texlab/crates/texlab/src/features/formatting.rs index 3fcd66e39b..9d152f6e8b 100644 --- a/support/texlab/crates/texlab/src/features/formatting.rs +++ b/support/texlab/crates/texlab/src/features/formatting.rs @@ -27,6 +27,7 @@ pub fn format_source_code( | Language::Log | Language::Root | Language::Latexmkrc - | Language::Tectonic => None, + | Language::Tectonic + | Language::FileList => None, } } diff --git a/support/texlab/crates/texlab/src/server/options.rs b/support/texlab/crates/texlab/src/server/options.rs index 1640c9cf7a..f4853d7cb9 100644 --- a/support/texlab/crates/texlab/src/server/options.rs +++ b/support/texlab/crates/texlab/src/server/options.rs @@ -70,6 +70,7 @@ pub struct BuildOptions { pub log_directory: Option<String>, pub pdf_directory: Option<String>, pub filename: Option<String>, + pub use_file_list: bool, } #[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)] diff --git a/support/texlab/crates/texlab/src/util.rs b/support/texlab/crates/texlab/src/util.rs index c301dc7722..87e41a78ae 100644 --- a/support/texlab/crates/texlab/src/util.rs +++ b/support/texlab/crates/texlab/src/util.rs @@ -18,9 +18,28 @@ pub fn normalize_uri(uri: &mut lsp_types::Url) { } } + uri.set_path(&normalize_percent_encoding(uri.path())); uri.set_fragment(None); } +fn normalize_percent_encoding(input: &str) -> String { + let mut output = String::new(); + let mut i = 0; + for c in input.chars() { + if c == '%' && i == 0 { + output.push(c); + i = 2; + } else if i > 0 { + output.push(c.to_ascii_uppercase()); + i -= 1; + } else { + output.push(c); + } + } + + output +} + fn fix_drive_letter(text: &str) -> Option<String> { if !text.is_ascii() || text.is_empty() { return None; @@ -59,4 +78,44 @@ mod tests { normalize_uri(&mut uri); assert_eq!(uri.as_str(), "foo:///bar/baz.txt"); } + + #[test] + #[cfg(unix)] + fn test_lowercase_percent_encoding_unix() { + let mut uri1 = Url::parse("file:///foo/%c3%a4.tex").unwrap(); + let uri2 = Url::from_file_path("/foo/ä.tex").unwrap(); + + normalize_uri(&mut uri1); + assert_eq!(uri1, uri2); + } + + #[test] + #[cfg(unix)] + fn test_uppercase_percent_encoding_unix() { + let mut uri1 = Url::parse("file:///foo/%C3%A4.tex").unwrap(); + let uri2 = Url::from_file_path("/foo/ä.tex").unwrap(); + + normalize_uri(&mut uri1); + assert_eq!(uri1, uri2); + } + + #[test] + #[cfg(windows)] + fn test_lowercase_percent_encoding_windows() { + let mut uri1 = Url::parse("file:///c%3a/foo/%c3%a4.tex").unwrap(); + let uri2 = Url::from_file_path("C:/foo/ä.tex").unwrap(); + + normalize_uri(&mut uri1); + assert_eq!(uri1, uri2); + } + + #[test] + #[cfg(windows)] + fn test_uppercase_percent_encoding_windows() { + let mut uri1 = Url::parse("file:///c%3A/foo/%C3%A4.tex").unwrap(); + let uri2 = Url::from_file_path("C:/foo/ä.tex").unwrap(); + + normalize_uri(&mut uri1); + assert_eq!(uri1, uri2); + } } diff --git a/support/texlab/texlab.1 b/support/texlab/texlab.1 index d829a081f9..852d37051e 100644 --- a/support/texlab/texlab.1 +++ b/support/texlab/texlab.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1. -.TH TEXLAB "1" "June 2024" "texlab 5.17.0" "User Commands" +.TH TEXLAB "1" "July 2024" "texlab 5.19.0" "User Commands" .SH NAME -texlab \- manual page for texlab 5.17.0 +texlab \- manual page for texlab 5.19.0 .SH SYNOPSIS .B texlab [\fI\,OPTIONS\/\fR] [\fI\,COMMAND\/\fR] diff --git a/support/texlab/texlab.pdf b/support/texlab/texlab.pdf Binary files differindex 828032ce0c..55922ca427 100644 --- a/support/texlab/texlab.pdf +++ b/support/texlab/texlab.pdf diff --git a/support/texplate/README.md b/support/texplate/README.md index 43673ed917..ea0f023a35 100644 --- a/support/texplate/README.md +++ b/support/texplate/README.md @@ -4,19 +4,26 @@ ![Minimum JRE: 8.0](https://img.shields.io/badge/Minimum_JRE-8.0-blue.svg?style=flat-square) ![Current version](https://img.shields.io/badge/dynamic/json.svg?color=blue&label=Latest%20release&query=%24.0.name&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F13793875%2Frepository%2Ftags&style=flat-square) -TeXplate is a tool for creating document structures based on templates. The application name is a word play on _TeX_ and _template_, so the purpose seems quite obvious: we want to provide an easy and straightforward framework for reducing the typical code boilerplate when writing TeX documents. Also note that one can easily extrapolate the use beyond articles and theses: the application is powerful enough to generate _any_ text-based structure, given that a corresponding template exists. +TeXplate is a tool for creating document structures based on templates. The +application name is a word play on _TeX_ and _template_, so the purpose seems +quite obvious: we want to provide an easy and straightforward framework for +reducing the typical code boilerplate when writing TeX documents. Also note that +one can easily extrapolate the use beyond articles and theses: the application +is powerful enough to generate _any_ text-based structure, given that a +corresponding template exists. ## Basic use -Our tool is a typical command line application, so we need to invoke it by simply typing `texplate` in the terminal: +Our tool is a typical command line application, so we need to invoke it by +simply typing `texplate` in the terminal: ```bash $ texplate ______ __ __ ___ __ -/\__ _\ /\ \ /\ \ /\_ \ /\ \__ -\/_/\ \/ __ \ `\`\/'/' _____\//\ \ __ \ \ ,_\ __ - \ \ \ /'__`\`\/ > < /\ '__`\\ \ \ /'__`\ \ \ \/ /'__`\ - \ \ \/\ __/ \/'/\`\\ \ \L\ \\_\ \_/\ \L\.\_\ \ \_/\ __/ +/\__ _\ /\ \ /\ \ /\_ \ /\ \__ +\/_/\ \/ __ \ `\`\/'/' _____\//\ \ __ \ \ ,_\ __ + \ \ \ /'__`\`\/ > < /\ '__`\\ \ \ /'__`\ \ \ \/ /'__`\ + \ \ \/\ __/ \/'/\`\\ \ \L\ \\_\ \_/\ \L\.\_\ \ \_/\ __/ \ \_\ \____\ /\_\\ \_\ \ ,__//\____\ \__/.\_\\ \__\ \____\ \/_/\/____/ \/_/ \/_/\ \ \/ \/____/\/__/\/_/ \/__/\/____/ \ \_\ @@ -55,23 +62,42 @@ Usage: texplate [-c=<configuration>] -o=<output> [-t=<template>] -Provided that TeXplate is properly available in the underlying operating system, we will get a lovely, colorful output in our terminal, along with a couple of scary messages telling that some required options are missing. Our tool provides four options, described as follows. Strictly speaking, there is only one mandatory option. The remainder might be optional, depending on certain scenarios. +Provided that TeXplate is properly available in the underlying operating system, +we will get a lovely, colorful output in our terminal, along with a couple of +scary messages telling that some required options are missing. Our tool provides +four options, described as follows. Strictly speaking, there is only one +mandatory option. The remainder might be optional, depending on certain +scenarios. ### Output -Referred as either`-o` (short representation) or `--output` (long representation), this option holds the output file in which the chosen template will be effectively written. The name is arbitrary, so you can use anything to your heart's desires. Keep in mind, however, that an existing file will be mercilessly overwritten. Also, make sure the path has the proper permissions for writing the output file. +Referred as either`-o` (short representation) or `--output` (long +representation), this option holds the output file in which the chosen template +will be effectively written. The name is arbitrary, so you can use anything to +your heart's desires. Keep in mind, however, that an existing file will be +mercilessly overwritten. Also, make sure the path has the proper permissions for +writing the output file. ### Template -Referred as either `-t` (short representation) or `--template` (long representation), this option holds the reference to the template to be potentially merged with data and properly generated. The provided string should match the template identifier, otherwise TeXplate will raise an error complaining about the missing reference. +Referred as either `-t` (short representation) or `--template` (long +representation), this option holds the reference to the template to be +potentially merged with data and properly generated. The provided string should +match the template identifier, otherwise TeXplate will raise an error +complaining about the missing reference. ### Map -Referred as either `-m` (short representation) or `--map` (long representation), this option holds a map entry, defined as a `key=value` ordered pair (mind the `=` symbol used as entry separator). This option can be used multiple times. The map entry denotes a variable in the template context, where the key is the variable name and the value is set to be the initial state of such variable. +Referred as either `-m` (short representation) or `--map` (long representation), +this option holds a map entry, defined as a `key=value` ordered pair (mind the +`=` symbol used as entry separator). This option can be used multiple times. The +map entry denotes a variable in the template context, where the key is the +variable name and the value is set to be the initial state of such variable. ## Examples -For instance, let us generate a document named `doc1.tex`, based on the standard `article` class: +For instance, let us generate a document named `doc1.tex`, based on the standard +`article` class: ```bash $ texplate -t article -o doc1.tex @@ -103,7 +129,8 @@ Done! Enjoy your template! Written: 112 B ``` -And that is it! We provided the template name (`-t article`) and the output (`-o doc1.tex`). Checking the contents of `doc1.tex`: +And that is it! We provided the template name (`-t article`) and the output (`-o +doc1.tex`). Checking the contents of `doc1.tex`: ```tex \documentclass{article} @@ -116,13 +143,18 @@ And that is it! We provided the template name (`-t article`) and the output (`-o \end{document} ``` -We could enhance the template generation by providing further options to it. Let us say we want to include A4 as the paper size for our document and use XeTeX as engine. The command line is as follows (we omitted the full output for reducing verbosity): +We could enhance the template generation by providing further options to it. Let +us say we want to include A4 as the paper size for our document and use XeTeX as +engine. The command line is as follows (we omitted the full output for reducing +verbosity): ```bash $ texplate -t article -o doc2.tex -m options=a4paper -m xetex=true ``` -For this example, we added two map entries referring to the class option and the support for newer engines (please refer to the user manual for more details on template options). The newly generated `doc2.tex` document is as follows: +For this example, we added two map entries referring to the class option and the +support for newer engines (please refer to the user manual for more details on +template options). The newly generated `doc2.tex` document is as follows: ```tex \documentclass[a4paper]{article} @@ -159,13 +191,20 @@ Checking the contents of `doc3.tex`: \end{document} ``` -And that is it! Make sure to take a look at the user manual to learn more about TeXplate! +And that is it! Make sure to take a look at the user manual to learn more about +TeXplate! ## License -This application is licensed under the [New BSD License](https://opensource.org/licenses/BSD-3-Clause). Please note that the New BSD License has been verified as a GPL-compatible free software license by the [Free Software Foundation](http://www.fsf.org/), and has been vetted as an open source license by the [Open Source Initiative](http://www.opensource.org/). +This application is licensed under the +[New BSD License](https://opensource.org/licenses/BSD-3-Clause). Please note +that the New BSD License has been verified as a GPL-compatible free software +license by the [Free Software Foundation](http://www.fsf.org/), and has been +vetted as an open source license by the +[Open Source Initiative](http://www.opensource.org/). ## The team -TeXplate is brought to you by Ben Frank and Paulo Cereda. If you want to support TeX development by a donation, the best way to do this is donating to the [TeX Users Group](https://www.tug.org/donate.html). - +TeXplate is brought to you by the Island of TeX. If you want to support TeX +development by a donation, the best way to do this is donating to the +[TeX Users Group](https://www.tug.org/donate.html). diff --git a/support/texplate/doc/texplate-manual.pdf b/support/texplate/doc/texplate-manual.pdf Binary files differindex 6f20dd4c2f..96d574ace6 100644 --- a/support/texplate/doc/texplate-manual.pdf +++ b/support/texplate/doc/texplate-manual.pdf diff --git a/support/texplate/doc/texplate-manual.tex b/support/texplate/doc/texplate-manual.tex index a56911ab72..1de47ab149 100644 --- a/support/texplate/doc/texplate-manual.tex +++ b/support/texplate/doc/texplate-manual.tex @@ -17,7 +17,7 @@ \newcommand{\shortopt}[1]{{\ttfamily-#1}} \newcommand{\longopt}[1]{{\ttfamily{-}{-}#1}} \newcommand{\macro}[1]{{\ttfamily\textbackslash#1}} -\newcommand{\texplateversion}{1.0.4} +\newcommand{\texplateversion}{1.0.6} \title{A gentle introduction to \texplate:\\ a document structure creation tool} \author{Island of \TeX} @@ -624,7 +624,23 @@ Happy \TeX ing with \texplate! \chapter*{Changelog} -\section*{1.0.4 (current)} +\section*{1.0.6 (current)} + +\subsection*{Fixed} + +\begin{itemize} +\item Application version is now retrieved from the manifest (regression fix). +\end{itemize} + +\section*{1.0.5 (2024-08-01)} + +\subsection*{Changed} + +\begin{itemize} +\item Updated dependencies to close a security vulnerability. +\end{itemize} + +\section*{1.0.4 (2021-07-27)} \subsection*{Fixed} diff --git a/support/texshop/README.txt b/support/texshop/README.txt index f8c0d70436..5c17bd2662 100644 --- a/support/texshop/README.txt +++ b/support/texshop/README.txt @@ -7,4 +7,4 @@ The main author is Richard Koch, koch@uoregon.edu, with supporting contributions Consult the program web site, https://pages.uoregon.edu/koch/texshop/texshop.html, for full source code, an extensive Changes document, and other information. -The current version, 5.36, was released on May 26, 2024.
\ No newline at end of file +The current version, 5.42, was released on August 5, 2024.
\ No newline at end of file diff --git a/support/texshop/texshop536.html b/support/texshop/texshop536.html deleted file mode 100644 index 705e6546b3..0000000000 --- a/support/texshop/texshop536.html +++ /dev/null @@ -1,64 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <title>TeXShop</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -</head> - -<body> - - -<!-- main content --> -<div id="main"> - -Version 5.36 has one minor bug fix and a major improvement of the PageNumber correction introduced in version 5.35. -<ul> -<p><li> In a document with over a thousand pages, the PageNumber box in the toolbar displays the number with a comma, as in 1,325. But users who want to go to a different page must enter the new page number without a comma. This makes it impossible to edit the existing number, say by changing 25 to 17 to go to page 1,317. This is fixed. -<p><li> Suppose a document has several pages of preliminary material before the main text begins. Perhaps these preliminary pages are numbered i, ii, iii, iv, v, ... and the main pages are numbered 1, 2, 3, 4, 5, ... Then entries in the PageNumber box will not be in sync with the actual page numbers in the text. The previous version of TeXShop introduced a fix for this problem, which required the user to insert a magic comment line and manually indicate the number of preliminary pages. The fix then numbered the preliminary pages 1#, 2#, 3#, ... and the main pages 1, 2, 3, ... -Moreover, users could enter a number like 17 in the box to go to main page 17, and 2# in the box to go to the second preliminary page. - -<p> This fix is still present in TeXShop 5.36, but the method of turning it on has been supplanted by a better method which does not require a magic comment line. The new method adds a macro to the source file which inserts an extra line in the console output and log file -during typesetting. That line reads "Start of main material: 3." Here 3 is replaced with the page number of the first main page. TeXShop looks for this line during typesetting; if it occurs, the PageNumber is modified as in the old method. A big advantage is that as the preliminary material grows during editing, the fix automatically adjusts without user intervention. - -<p> To activate this fix when using LaTeX and related engines, add the line -<pre> - \write128{Start of main material: \the\ReadonlyShipoutCounter.} -</pre> -to a spot in the source just after the main material is introduced. - -<p> If instead you are using plain TeX or related engines, add the line -<pre> - \write128{Start of main material: \the\pageno.} -</pre> -to a spot in the source just after the main material is introduced. - - -<p> TeXShop users need to find a way to remember these additional lines. Some may add items to the Macro -menu, while others may modify their templates. It is also possible to add appropriate items to the Command Completion dictionary. - -<p> After these lines have been added to the source, it is necessary to typeset to see changes in the PageNumber box. A lot of effort has gone into modifying the PageNumber whenever appropriate information is available in the log file. When TeXShop opens a new document, it checks to see if a log file is present, and if so it reads the log file to adjust the PageNumber box. If TeXShop is closed while documents are open, the documents will reappear the next time TeXShop starts with correct PageNumber entries. - -<p> Suppose a situation I did not anticipate causes the new code to crash the program when reading an old document, even when the extra lines above have not been added to the source. In that case, write me immediately and I'll fix the problem. But in the meantime, you can fix the crash. Add the magic comment below to the top of the source. This comment completely cancels all of the new code, and the number 0 in the comment tells it to make no changes in the numbering. -<pre> - % !TEX numberingCorrection = 0 + current - desired -</pre> - -<p> Fixing Page Number boxes is a standard feature of pdf display programs like Preview, Skim, and Adobe Acrobat. These programs do not have access to the source file, and often work by parsing the table of contents information in the pdf file. TeXShop is a program for authors rather than a pdf display program, so it is natural for it to find the information to fix the Page Number box in the source file. - -<p> Some users may prefer to view pdf files in TeXShop. If these users have access to the Log file associated with the pdf, they can get Number Box correction without using the source file. Just place the Log file in the same location as the pdf file, and TeXShop will automatically open and parse it, and adjust Page Numbers accordingly. - -<p> This feature is even available if you do not have access to the Log file. For example, the Driver Manual for my car is a pdf file with two preliminary pages and then the main pages numbered 1, 2, 3, ... Using Apple's Text Edit in plain text mode, I created a small file with the same name as the pdf manual, but extension ".log". The complete contents of this file were -<pre> - Start of main material: 3. -</pre> -After this file was placed in the location of the manual, opening the manual in TeXShop provided PageNumber boxes with the correct numbering. -</ul> - -<p> -<p> -</div> - - -</body> -</html>
\ No newline at end of file diff --git a/support/texshop/texshop542.html b/support/texshop/texshop542.html new file mode 100644 index 0000000000..990aec54dc --- /dev/null +++ b/support/texshop/texshop542.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>TeXShop</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +</head> + +<body> + + +<!-- main content --> +<div id="main"> + +Versions 5.37 - 5.41 were never released. Version 5.42 has seven small changes and one major additional feature: +<ul> +<p><li> Recall that version 5.36 fixed a bug reported by Hans Schoutens which surfaced when his document reached a length of 1000 pages. His Page Number box displayed the number with a comma, writing for instance 1,213. In that case, it was not possible to use the box to go to page 1,209 by just changing the last two digits, because TeXShop ignores all numerals after the comma. I fixed this problem by removing all commas in the box before using the number to go to another page. +<p>Shortly after making this fix, a similar complaint came from Emilio Faro Rivas. But in his country, periods are used to separate groups of three digits, and commas are used to set off the fractional part of a number. So while I would write 1,213.74, Rivas would write 1.213,74. + +<p> In the Language & Region control panel, Apple provides four different ways to determine how numbers are written. Since page numbers cannot have fractional part, TeXShop now removes all commas and periods from the Page Number box before interpreting the number. + +<p> Learning of two books with more than 1000 pages in the course of a couple of days reminded me of the English critic who met Edward Gibbons after skimming through the volumes of the Decline and Fall of the Roman Empire, and said "always scribble, scribble, scribble, eh Mr Gibbons.'' +<p><li> Version 5.42 fixes a bug reported by Juan Luis Varona Malumbres. In TeXShop Preferences under the Misc2 tab, there is an item reading "During File Save, Automatic UTF-8-Mac to UTF-8 Conversion", but this item no longer worked. I checked back to TeXShop 5.18 and the item was already broken then. The ultimate cause is embarrassing. TeXShop's code interpreting a change in this preference read as follows +<pre> + 1) Remember the old Conversion value so we can undo if the user clicks "Cancel" rather than "OK" + 2) Activate the font panel for the Console Font. + 3) Modify the Console Font if the user chooses a new font. +</pre> +Huh? It turns out that sometime in the past, a mistaken copy and paste operation replaced the rest of the +code for Conversion with pieces of code for the Console Font. Miraculously, that bad code still compiled, and +caused no problems when the Preference Panel ran except that the Conversion item no longer worked. The misplaced Console code also existed in its regular spot, where it did what it was supposed to do. The bad code was removed and the original code was reinserted. Problem fixed. +<p><li> Peter Smith requested that the keyboard shortcut command-T also apply if an Experiment window is open, and typeset for that window rather than for the entire document. Done. +<p><li> If TeXShop opens the Log file of a project, a header at the top allows users to filter the contents of the log file based on various criteria, showing for instance all warnings, or all underfull boxes. This feature was added to TeXShop twenty years ago, and I had completely forgotten how it works. It turns out that texloganalyser is a perl script +by Thomas van Oudenhove, which he has maintained over the years. This script is in TeXLive, and TeXShop + calls the script to parse. Thanks, Thomas van Oudenhove, after all these years! + <p> This script does not have an option to print only error messages. But error messages in files typeset by TeXShop leave an easy-to-recognize trace in the log file due to the flag "-file-line-error" added by default in Preferences. + TeXShop already uses this trace to implement Goto Error. So an extra button has been added to the header when TeXShop displays Log Files allowing users to search for error messages. + <p><li> TeXShop can now open, write, and edit .adoc files. This was requested by Richard Bennett, who wrote that he is transitioning to using the asciidoc format and wanted to edit such files in TeXShop. + <p><li> In languages like Spanish, many words begin with "part", so using "part" as a trigger word in the Tags menu leads to incorrect items. This problem is fixed by changing the trigger to "part{". + <p><li> Finally, a comment about the PageNumber correction system introduced in versions 5.35 and 5.36 + of TeXshop. Large documents often begin with preliminary pages, numbered with Roman numerals. After that, the main pages begin, with numbering starting at page 1. But then the page number in the TeXShop Page Number Box does not agree with the actual page number shown in the document. +<p> Version 5.36 provides an easy fix by asking the author to add just one line of source code. After the fix, TeXShop reports preliminary pages as 1#, 2#, 3#, ..., and then regular pages as 1, 2, 3, ... +<p> To activate this fix when using LaTeX and related engines, add the line +<pre> + \write128{Start of main material: \the\ReadonlyShipoutCounter.} +</pre> +to a spot in the source just after the main material is introduced. + +<p> If instead you are using plain TeX or related engines, add the line +<pre> + \write128{Start of main material: \the\pageno.} +</pre> +to a spot in the source just after the main material is introduced. +<p> Alan C. Bowen pointed out that the fix also works in ConTeXt, and in that case the line to add is +<pre> + \write128{Start of main material: \the\realpageno} +</pre> +<p><li>The new feature is that TeXShop can now annotate pages of a pdf document. +See the "Annotation" chapter of the TeXShop manual for details. +<p> It has always been possible to annotate pdf files created by TeXShop using a third party program like Preview, Skim, Adobe Acrobat, etc. The resulting annotated file can be opened in TeXShop and displayed alongside the +original source and preview windows. So an author can write a paper in TeXShop, send the pdf output to an editor to be annotated in Adobe Acrobat, open the annotated version alongside the regular version in TeXShop, and revise as needed. All of this is possible in earlier versions of TeXShop because Apple's PDFKit supports annotation. This use pattern is likely to remain standard in the future because the listed programs and many others have sophisticated annotation capabilities. +<p> TeXShop 5.42 provides only a subset of easy to use annotations, but these may be +helpful for those just starting to annotate, or if one author is creating both a manuscript and the annotated version +at the same time. +<p> The new feature has been added in a nonintrusive manner. No new tools were added to the toolbar, no new code runs in standard mode, and the only difference a regular user will notice is a new item in the Preview menu called "Annotation Panel". +The ability to annotate in TeXShop may not change authors' working habits, but it was a fun summer project for me. + +<p> For those who don't read the manual, here's a short survey. The annotation panel contains all tools needed to annotate. Switch between Edit mode and Run mode at top left. Annotations are created, moved, resized, and modified in Edit mode. They are fixed in Run mode. Create new annotations by clicking on the picture of the annotation in the panel. For instance, select some text and then click strikeout to strike out the text. Emphasize and underline work the same way. + +<p> For other annotations, select some pdf text and click on a picture in the panel to make an annotation appear near the text selection. Or just click the picture and the annotation will appear at bottom left. Drag and resize annotations +after creation. To change annotation colors, open the Color Panel, +select an annotation, and then select a color. One annotation shows text on a colored background. Change the background color as above, and hold down the option key while selecting a color to change the text color. +To change the fonts in annotations with text, open the Font Panel, select an annotation, and change the font in the panel. To modify the text in annotations with text, open the Text Panel and edit the copy of text it contains. + +<p> Popups are annotations that look like a small icon, often in the document margin. In Run mode, clicking on this icon opens a panel of scrollable text. The font and color of this text cannot be changed; to change the background color, change the color of the icon. To insert text in a popup during Edit mode, click on the icon while holding down the option key to reveal the editable panel of text. + +<p>A special note of thanks to Uwe Schmock, who was helpful with both program design and the manual pages during work on Annotations. He has a list of further desirable changes, but eventually I cried "enough." +</ul> + +<p> +<p> +</div> + + +</body> +</html>
\ No newline at end of file |