diff options
author | Karl Berry <karl@freefriends.org> | 2018-03-26 21:16:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-03-26 21:16:58 +0000 |
commit | ead783eecd15266cb75f481b8467c9daba5eeda7 (patch) | |
tree | 2736a661cadb8f9e4944d179baa2872d4eb4fe43 | |
parent | 1b9c31dfc4a61ac2077b6f069dcdb74f4d0d6bb2 (diff) |
texdef (26mar18)
git-svn-id: svn://tug.org/texlive/trunk@47137 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/texdef/texdef.pl | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/texdef/CHANGELOG | 49 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/texdef/README | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/texdef/texdef.pdf | bin | 145064 -> 151394 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/texdef/texdef.pl | 24 | ||||
-rw-r--r-- | Master/texmf-dist/source/support/texdef/texdef.tex | 70 |
6 files changed, 154 insertions, 20 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl b/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl index f29efd79ddf..7294ef595f0 100755 --- a/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl +++ b/Build/source/texk/texlive/linked_scripts/texdef/texdef.pl @@ -30,6 +30,7 @@ if ($scriptname =~ /^(.*)def$/) { $TEX = $1; } my $TEXOPTIONS = " -interaction nonstopmode "; +my $USERTEXOPTIONS = ""; ## Variables for options and settings my $CLASS = undef; @@ -115,14 +116,14 @@ my $ISCONTEXT = 0; my $BEGINENVSTR = '%s'; my $ENDENVSTR = '%s'; -my $VERSION = 'Version 1.7c -- 2017/12/09'; +my $VERSION = 'Version 1.8 -- 2018/03/25'; sub usage { my $option = shift; my $ret = ($option) ? 0 : 1; print << 'EOT'; texdef -- Show definitions of TeX commands -Version 1.7c -- 2017/12/09 -Copyright (C) 2011-2017 Martin Scharrer <martin@scharrer-online.de> +Version 1.8 -- 2019/03/25 +Copyright (C) 2011-2018 Martin Scharrer <martin@scharrer-online.de> This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; @@ -136,6 +137,7 @@ Options: --tex <format>, -t <format> : Use given format of TeX: 'tex', 'latex', 'context'. Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported. The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc. + --texoptions <options> : Call (La)TeX with the given options. --source, -s : Try to show the original source code of the command definition (L). --value, -v : Show value of command instead (i.e. \the\command). --Environment, -E : Every command name is taken as an environment name. This will show the definition of @@ -146,7 +148,7 @@ Options: or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end with `<pkgname>` or `{<pkgname>}`. --class <class>, -c <class> : (LaTeX only) Load given class instead of default ('article'). - The <class> can start with `[<classs options>]` and end + The <class> can start with `[<class options>]` and end with `<classname>` or `{<classname>}`. --environment <env>, -e <env> : (M) Show definition inside the given environment <env>. --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown. @@ -247,6 +249,7 @@ GetOptions ( 'before|b=s' => \&envcode, 'after|a=s' => \&envcode, 'tex|t=s' => \$TEX, + 'texoptions=s' => \$USERTEXOPTIONS, 'help|h' => \&usage, 'pgf-keys|k' => \$PGFKEYS, 'pgf-Keys|K' => \$PGFKEYSPLAIN, @@ -319,9 +322,14 @@ elsif ($TEX =~ /context$/) { $ENDENVSTR = '\stop%s' . "\n"; } +if ($TEX =~ /^dvi((la)?tex)$/) { + $TEX = $1; + $TEXOPTIONS .= ' -output-format=dvi ' +} + $USERCLASS = $CLASS; $CLASS = 'article' if not $CLASS; -$CLASS =~ /^(?:\[(.*)\])?{?(.*?)}?$/; +$CLASS =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/; $CLASS = $2; my $CLASSOPTIONS = $1 || ''; @@ -503,7 +511,7 @@ if ($ISLATEX) { } foreach my $pkg (@PACKAGES) { - $pkg =~ /^(?:\[(.*)\])?{?(.*?)}?$/; + $pkg =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/; my ($pkgname,$pkgoptions) = ($2, $1 || ''); print "\\usepackage[$pkgoptions]{$pkgname}\n"; } @@ -623,7 +631,7 @@ select STDOUT; sub remove_invalid_braces { $_[0] =~ s/\\[\\%]//g; # remove \\ and \% $_[0] =~ s/%.*$//; # remove line comments - $_[0] =~ s/\\[{}]//g; # remove \{ and \} + $_[0] =~ s/\\[\{\}]//g; # remove \{ and \} } sub env_braces { @@ -766,7 +774,7 @@ sub print_orig_def { return $found; } -open (my $texpipe, '-|', "$TEX $TEXOPTIONS \"$TMPFILE\" "); +open (my $texpipe, '-|', "$TEX $TEXOPTIONS $USERTEXOPTIONS \"$TMPFILE\" "); my $name = ''; my $definition = ''; diff --git a/Master/texmf-dist/doc/support/texdef/CHANGELOG b/Master/texmf-dist/doc/support/texdef/CHANGELOG new file mode 100644 index 00000000000..9a82888129b --- /dev/null +++ b/Master/texmf-dist/doc/support/texdef/CHANGELOG @@ -0,0 +1,49 @@ += Changelog = + + +== v1.8 from 2018/03/25 == + * Added "dvitex" and "dvilatex" as formats. These will set DVI mode on "tex" or "latex". + * Escaped further braces in regexs to avoid "Unescaped left brace in regex is deprecated" warnings or errors. + * Added option '--texoptions' to allow the passing of compiler options for special cases. + +== v1.7c from 2017/12/09 == + * Fixed 'Unescaped left brace in regex is deprecated' warning. + Thanks goes to Paulo Cereda <cereda.paulo@gmail.com> for providing the patch. + +== v1.7b from 2012/05/15 == + * Added support for \chardef, \countdef, \dimendef, \mathchardef, \myskip, \skipdef and \toksdef. + * Added support for \newbox, \newcount, \newdimen, \newif, \newinsert, \newread, \newskip, \newtoks, \newwrite. + * Added support for "\newif" and "\newcount". + * Changed internal processing order to put more frequently used elements first. + +== v1.7a from 2012/05/08 == + * Fix for currfile v0.6. + +== v1.7 from 2012/05/07 == + * Changed "--help" to return status code 0. + * Changed Windows default editor to texworks. Fixed If-statement. + * Fixed bug which reported name of included subpackages. + * Added option "--edit". + * Added "--editor" option and better editor handling. + * Added variable substitution for editor. + * Added support for "TEXDEF_EDITOR" variable. Added Mac "open" command. + * Fixed for behaviour when -s is used (correct name in message; do not follow protected macros etc.) + +== v1.6 from 2012/05/02 == + * Changed implementation of -E option to work better with new environment source code. + * Added code to detect environment source definitions. + * Added -E option. + * Changed "flavour" to "format". + * Added support for \let. + * Added fallback for when the source code can not be found. Added support for -F with "latex.ltx". + +== v1.5 from 2012/04/29 == + * Added experimental --source option to show source code of the definitions. + * Script now works correctly under MS Windows. + +== v1.4 from 2011/07/28 == + * Added -F option to display file path. + * Added basic support for pdfkeys using -k and -K options. + * Added -V option to print version numbers of LaTeX packages or classes. + * Added '--tempdir' option to specify the location of the temporary files. Useful for debugging. + diff --git a/Master/texmf-dist/doc/support/texdef/README b/Master/texmf-dist/doc/support/texdef/README index b8a8528c6cc..482cba6f39e 100644 --- a/Master/texmf-dist/doc/support/texdef/README +++ b/Master/texmf-dist/doc/support/texdef/README @@ -1,6 +1,6 @@ texdef -- Show definitions of TeX commands -Version 1.7c -- 2017/12/09 -Copyright (C) 2011-2017 Martin Scharrer <martin@scharrer-online.de> +Version 1.8 -- 2019/03/25 +Copyright (C) 2011-2018 Martin Scharrer <martin@scharrer-online.de> This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; @@ -14,6 +14,7 @@ Options: --tex <format>, -t <format> : Use given format of TeX: 'tex', 'latex', 'context'. Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported. The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc. + --texoptions <options> : Call (La)TeX with the given options. --source, -s : Try to show the original source code of the command definition (L). --value, -v : Show value of command instead (i.e. \the\command). --Environment, -E : Every command name is taken as an environment name. This will show the definition of @@ -24,7 +25,7 @@ Options: or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end with `<pkgname>` or `{<pkgname>}`. --class <class>, -c <class> : (LaTeX only) Load given class instead of default ('article'). - The <class> can start with `[<classs options>]` and end + The <class> can start with `[<class options>]` and end with `<classname>` or `{<classname>}`. --environment <env>, -e <env> : (M) Show definition inside the given environment <env>. --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown. diff --git a/Master/texmf-dist/doc/support/texdef/texdef.pdf b/Master/texmf-dist/doc/support/texdef/texdef.pdf Binary files differindex de10217b3e5..6af99054721 100644 --- a/Master/texmf-dist/doc/support/texdef/texdef.pdf +++ b/Master/texmf-dist/doc/support/texdef/texdef.pdf diff --git a/Master/texmf-dist/scripts/texdef/texdef.pl b/Master/texmf-dist/scripts/texdef/texdef.pl index f29efd79ddf..7294ef595f0 100755 --- a/Master/texmf-dist/scripts/texdef/texdef.pl +++ b/Master/texmf-dist/scripts/texdef/texdef.pl @@ -30,6 +30,7 @@ if ($scriptname =~ /^(.*)def$/) { $TEX = $1; } my $TEXOPTIONS = " -interaction nonstopmode "; +my $USERTEXOPTIONS = ""; ## Variables for options and settings my $CLASS = undef; @@ -115,14 +116,14 @@ my $ISCONTEXT = 0; my $BEGINENVSTR = '%s'; my $ENDENVSTR = '%s'; -my $VERSION = 'Version 1.7c -- 2017/12/09'; +my $VERSION = 'Version 1.8 -- 2018/03/25'; sub usage { my $option = shift; my $ret = ($option) ? 0 : 1; print << 'EOT'; texdef -- Show definitions of TeX commands -Version 1.7c -- 2017/12/09 -Copyright (C) 2011-2017 Martin Scharrer <martin@scharrer-online.de> +Version 1.8 -- 2019/03/25 +Copyright (C) 2011-2018 Martin Scharrer <martin@scharrer-online.de> This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; @@ -136,6 +137,7 @@ Options: --tex <format>, -t <format> : Use given format of TeX: 'tex', 'latex', 'context'. Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported. The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc. + --texoptions <options> : Call (La)TeX with the given options. --source, -s : Try to show the original source code of the command definition (L). --value, -v : Show value of command instead (i.e. \the\command). --Environment, -E : Every command name is taken as an environment name. This will show the definition of @@ -146,7 +148,7 @@ Options: or 'context' is used. For LaTeX the <pkg> can start with `[<options>]` and end with `<pkgname>` or `{<pkgname>}`. --class <class>, -c <class> : (LaTeX only) Load given class instead of default ('article'). - The <class> can start with `[<classs options>]` and end + The <class> can start with `[<class options>]` and end with `<classname>` or `{<classname>}`. --environment <env>, -e <env> : (M) Show definition inside the given environment <env>. --othercode <code>, -o <code> : (M) Add other code into the preamble before the definition is shown. @@ -247,6 +249,7 @@ GetOptions ( 'before|b=s' => \&envcode, 'after|a=s' => \&envcode, 'tex|t=s' => \$TEX, + 'texoptions=s' => \$USERTEXOPTIONS, 'help|h' => \&usage, 'pgf-keys|k' => \$PGFKEYS, 'pgf-Keys|K' => \$PGFKEYSPLAIN, @@ -319,9 +322,14 @@ elsif ($TEX =~ /context$/) { $ENDENVSTR = '\stop%s' . "\n"; } +if ($TEX =~ /^dvi((la)?tex)$/) { + $TEX = $1; + $TEXOPTIONS .= ' -output-format=dvi ' +} + $USERCLASS = $CLASS; $CLASS = 'article' if not $CLASS; -$CLASS =~ /^(?:\[(.*)\])?{?(.*?)}?$/; +$CLASS =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/; $CLASS = $2; my $CLASSOPTIONS = $1 || ''; @@ -503,7 +511,7 @@ if ($ISLATEX) { } foreach my $pkg (@PACKAGES) { - $pkg =~ /^(?:\[(.*)\])?{?(.*?)}?$/; + $pkg =~ /^(?:\[(.*)\])?\{?(.*?)\}?$/; my ($pkgname,$pkgoptions) = ($2, $1 || ''); print "\\usepackage[$pkgoptions]{$pkgname}\n"; } @@ -623,7 +631,7 @@ select STDOUT; sub remove_invalid_braces { $_[0] =~ s/\\[\\%]//g; # remove \\ and \% $_[0] =~ s/%.*$//; # remove line comments - $_[0] =~ s/\\[{}]//g; # remove \{ and \} + $_[0] =~ s/\\[\{\}]//g; # remove \{ and \} } sub env_braces { @@ -766,7 +774,7 @@ sub print_orig_def { return $found; } -open (my $texpipe, '-|', "$TEX $TEXOPTIONS \"$TMPFILE\" "); +open (my $texpipe, '-|', "$TEX $TEXOPTIONS $USERTEXOPTIONS \"$TMPFILE\" "); my $name = ''; my $definition = ''; diff --git a/Master/texmf-dist/source/support/texdef/texdef.tex b/Master/texmf-dist/source/support/texdef/texdef.tex index 26133354657..36df3aea079 100644 --- a/Master/texmf-dist/source/support/texdef/texdef.tex +++ b/Master/texmf-dist/source/support/texdef/texdef.tex @@ -5,7 +5,7 @@ \author{Martin Scharrer} \email{martin@scharrer-online.de} \repository{https://bitbucket.org/martin_scharrer/texdef} -\date{Version 1.7c -- 2017/12/09} +\date{Version 1.8 -- 2018/03/25} \makeatletter \DeclareRobustCommand{\LATeX}{% @@ -54,6 +54,7 @@ The following options can be used: --tex \MacroArgs<format>, -t \MacroArgs<format> \csep Use given format of TeX: 'tex', 'latex', 'context'. Variations of 'tex' and 'latex', like 'luatex', 'lualatex', 'xetex', 'xelatex' are supported. The default is given by the used program name: 'texdef' -> 'tex', 'latexdef' -> 'latex', etc.\cend + --texoptions \MacroArgs<options> \csep Call \LaTeX/\TeX{} with the given options.\cend --source, -s \csep Try to show the original source code of the command definition (L).\cend --value, -v \csep Show value of command instead (i.e. \Macro\the\AlsoMacro\command).\cend --preamble, -P \csep Show definition of the command inside the preamble.\cend @@ -198,5 +199,72 @@ latexdef -l -p xspace \end{verbatim} +\section{Changelog} + + +\subsection*{v1.8 from 2018/03/25} +\begin{itemize} + \item Added "dvitex" and "dvilatex" as formats. These will set DVI mode on "tex" or "latex". + \item Escaped further braces in regexs to avoid warnings or errors. + \item Added option "--texoptions" to allow the passing of compiler options for special cases. +\end{itemize} + +\subsection*{v1.7c from 2017/12/09} +\begin{itemize} + \item Fixed 'Unescaped left brace in regex is deprecated' warning. + Thanks goes to Paulo Cereda <cereda.paulo@gmail.com> for providing the patch. +\end{itemize} + +\subsection*{v1.7b from 2012/05/15} +\begin{itemize} + \item Added support for \Macro\chardef, \Macro\countdef, \Macro\dimendef, \Macro\mathchardef, \Macro\myskip, \Macro\skipdef and \Macro\toksdef. + \item Added support for \Macro\newbox, \Macro\newcount, \Macro\newdimen, \Macro\newif, \Macro\newinsert, \Macro\newread, \Macro\newskip, \Macro\newtoks, \Macro\newwrite. + \item Added support for \Macro\newif and \Macro\newcount. + \item Changed internal processing order to put more frequently used elements first. +\end{itemize} + +\subsection*{v1.7a from 2012/05/08} +\begin{itemize} + \item Fix for currfile v0.6. +\end{itemize} + +\subsection*{v1.7 from 2012/05/07} +\begin{itemize} + \item Changed "--help" to return status code 0. + \item Changed Windows default editor to texworks. Fixed If-statement. + \item Fixed bug which reported name of included subpackages. + \item Added option "--edit". + \item Added "--editor" option and better editor handling. + \item Added variable substitution for editor. + \item Added support for "TEXDEF_EDITOR" variable. Added Mac "open" command. + \item Fixed for behaviour when -s is used (correct name in message; do not follow protected macros etc.) +\end{itemize} + +\subsection*{v1.6 from 2012/05/02} +\begin{itemize} + \item Changed implementation of -E option to work better with new environment source code. + \item Added code to detect environment source definitions. + \item Added -E option. + \item Changed "flavour" to "format". + \item Added support for \Macro\let. + \item Added fallback for when the source code can not be found. Added support for -F with "latex.ltx". +\end{itemize} + +\subsection*{v1.5 from 2012/04/29} +\begin{itemize} + \item Added experimental --source option to show source code of the definitions. + \item Script now works correctly under MS Windows. +\end{itemize} + +\subsection*{v1.4 from 2011/07/28} +\begin{itemize} + \item Added -F option to display file path. + \item Added basic support for pdfkeys using -k and -K options. + \item Added -V option to print version numbers of LaTeX packages or classes. + \item Added '--tempdir' option to specify the location of the temporary files. Useful for debugging. +\end{itemize} + + + \end{document} |