summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-19 22:41:13 +0000
committerKarl Berry <karl@freefriends.org>2015-04-19 22:41:13 +0000
commit23cf0b808a389f0ca7db875f3b036de281ea26c7 (patch)
treebf8ad7535dd93ec90fb2c79a677209319436e0d4 /Master
parent6c6ef8b97a77c8d79c7110b87fd8afd43d676cb1 (diff)
latexindent (19apr15)
git-svn-id: svn://tug.org/texlive/trunk@36955 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/bin/win32/latexindent.exebin1536 -> 5422285 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/documentation/manual.pdfbin236102 -> 237320 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexindent/documentation/manual.tex31
-rw-r--r--Master/texmf-dist/doc/support/latexindent/success/figureValign.tex124
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl92
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds5
6 files changed, 223 insertions, 29 deletions
diff --git a/Master/bin/win32/latexindent.exe b/Master/bin/win32/latexindent.exe
index 5777d90a17a..039a470087f 100755
--- a/Master/bin/win32/latexindent.exe
+++ b/Master/bin/win32/latexindent.exe
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf b/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf
index c804d386db6..0fec7c336b1 100644
--- a/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf
+++ b/Master/texmf-dist/doc/support/latexindent/documentation/manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex b/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex
index 812aae39eb8..a34339c06cd 100644
--- a/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex
+++ b/Master/texmf-dist/doc/support/latexindent/documentation/manual.tex
@@ -2,6 +2,7 @@
% !arara: bibtex
% !arara: pdflatex
% !arara: pdflatex
+% !arara: pdflatex
% !arara: indent: {overwrite: no, trace: yes, localSettings: yes, silent: yes}
% http://tex.stackexchange.com/questions/122135/how-to-add-a-png-icon-on-the-right-side-of-a-tcolorbox-title
\begin{filecontents}{mybib.bib}
@@ -163,7 +164,7 @@ top=2cm,bottom=1.5cm]{geometry} % page setup
% \begin{noindent}
\title{\lstinline[basicstyle=\huge\ttfamily]!latexindent.pl!\\[1cm]
- Version 2.0R}
+ Version 2.1R}
% \end{noindent}
\author{Chris Hughes \footnote{smr01cmh AT users.sourceforge.net}}
\maketitle
@@ -394,8 +395,8 @@ on which of the following options are used.
Only \lstinline!defaultSettings.yaml!: you might like to read \cref{sec:defuseloc} before
using this switch. By default, \lstinline!latexindent.pl! will always search for
- \lstinline!indentconfig.yaml! in your home directory. If you would prefer it not to do so
- then (instead of deleting or renaming \lstinline!indentconfig.yaml!) you can simply
+ \lstinline!indentconfig.yaml! or \lstinline!.indentconfig.yaml! in your home directory. If you would prefer it not to do so
+ then (instead of deleting or renaming \lstinline!indentconfig.yaml!/\lstinline!.indentconfig.yaml!) you can simply
call the script with the \lstinline!-d! switch; note that this will also tell
the script to ignore \lstinline!localSettings.yaml! even if it has been called with the
\lstinline!-l! switch.
@@ -561,8 +562,8 @@ copy myfile.bak4 to myfile.bak3
which creates `trailing whitespace' feared by most version control systems. If
this option is set to \lstinline!1!, trailing whitespace is removed from all
lines, also non-empty ones. In general this should not create any problems, but
- by precaution this option is turned off by default. \footnote{Thanks to \href{https://github.com/vosskuhle}{vosskuhle} for
- providing this feature.}
+ by precaution this option is turned off by default. Thanks to \href{https://github.com/vosskuhle}{vosskuhle} for
+ providing this feature.
\item[\verbitem{lookForAlignDelims}] This is the first example of a field
in \lstinline!defaultSettings.yaml! that has more than one line; \cref{lst:aligndelims}
@@ -906,18 +907,25 @@ following order:
\item \lstinline!noAdditionalIndent!
\item \lstinline!indentRules!
\end{enumerate}
-\subsection{\lstinline!indentconfig.yaml! (for user settings)}\label{sec:indentconfig}
+\subsection{\lstinline!indentconfig.yaml! and \lstinline!.indentconfig.yaml! (for user settings)}\label{sec:indentconfig}
Editing \lstinline!defaultSettings.yaml! is not ideal as it may be overwritten when
updating your distribution--a better way to customize the settings to your liking
is to set up your own settings file,
\lstinline!mysettings.yaml! (or any name you like, provided it ends with \lstinline!.yaml!).
The only thing you have to do is tell \lstinline!latexindent.pl! where to find it.
-\lstinline!latexindent.pl! will always check your home directory for \lstinline!indentconfig.yaml! (unless
+\lstinline!latexindent.pl! will always check your home directory for \lstinline!indentconfig.yaml!
+and \lstinline!.indentconfig.yaml! (unless
it is called with the \lstinline!-d! switch),
which is a plain text file you can create that contains the \emph{absolute}
-paths for any settings files that you wish \lstinline!latexindent.pl! to load.
-Note that Mac and Linux users home directory is \lstinline!~/username! while
+paths for any settings files that you wish \lstinline!latexindent.pl! to load. There is no difference
+between \lstinline!indentconfig.yaml! and \lstinline!.indentconfig.yaml!, other than the
+fact that \lstinline!.indentconfig.yaml! is a `hidden' file; thank you to \href{https://github.com/cmhughes/latexindent.pl/pull/23}{Jacobo Diaz}
+for providing this feature. In what follows, we will use \lstinline!indentconfig.yaml!, but it
+is understood that this equally represents \lstinline!.indentconfig.yaml! as well. If you
+have both files in existence, \lstinline!indentconfig.yaml! takes priority.
+
+For Mac and Linux users, their home directory is \lstinline!~/username! while
Windows (Vista onwards) is \lstinline!C:\Users\username! \footnote{If you're not sure
where to put \lstinline!indentconfig.yaml!, don't
worry \lstinline!latexindent.pl! will tell you in the log file exactly where to
@@ -1162,6 +1170,11 @@ sudo perl -MCPAN -e 'install "File::HomeDir"'
Strawberry Perl users on Windows might use
\lstinline!CPAN client!. All of the modules are readily available on CPAN \cite{cpan}.
+As of Version 2.1R, \lstinline!indent.log! will contain details of the location
+of the Perl modules on your system. \lstinline!latexindent.exe! is a standalone
+executable for Windows (and therefore does not require a Perl distribution) and caches copies of the Perl modules onto your system; if you
+wish to see where they are cached, use the \lstinline!trace! option, e.g \lstinline!latexindent.exe -t myfile.tex!.
+
\section{The \lstinline!arara! rule}
The \lstinline!arara! rule (\lstinline!indent.yaml!) contains lines such as those
given in \cref{lst:arararule}. With this setup, the user \emph{always} has
diff --git a/Master/texmf-dist/doc/support/latexindent/success/figureValign.tex b/Master/texmf-dist/doc/support/latexindent/success/figureValign.tex
new file mode 100644
index 00000000000..8c2bc33281a
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexindent/success/figureValign.tex
@@ -0,0 +1,124 @@
+% arara: pdflatex
+% !arara: indent: {overwrite: yes}
+\documentclass{article}
+\usepackage{lipsum}
+\usepackage{graphicx}
+\usepackage{environ}
+\usepackage[showframe=true]{geometry}
+
+\newsavebox{\vabox}
+
+\NewEnviron{verticallyaligned}{%
+ % temporarily set \vamaxheight to nothing during the measurements
+ \let\vamaxheight\relax
+ % measure the height of the body
+ \begin{lrbox}{\vabox}
+ \BODY%
+ \end{lrbox}%
+ % set the height of the minipage box
+ \newlength{\vamaxheight}
+ \setlength{\vamaxheight}{\ht\vabox}
+ % output the body, which now contains the new height :)
+ \noindent\makebox[\linewidth][c]{\mbox{}\hfill\BODY\hfill\mbox{}}%
+}
+
+\begin{document}
+
+\sbox{\vabox}{%
+ \begin{minipage}[b][][b]{.10\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-a}
+ \end{minipage}%
+ \begin{minipage}[b][][t]{.15\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-b}
+ \end{minipage}%
+ \begin{minipage}[b][][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-c}
+ \end{minipage}%
+ \begin{minipage}[b][][c]{.10\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \end{minipage}%
+ \begin{minipage}[b][][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \end{minipage}%
+}%
+
+\noindent
+\begin{minipage}[b][\ht\vabox][b]{.10\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-a}
+\end{minipage}%
+\hfill
+\begin{minipage}[b][\ht\vabox][t]{.15\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-b}
+\end{minipage}%
+\hfill
+\begin{minipage}[b][\ht\vabox][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-c}
+\end{minipage}%
+\hfill
+\begin{minipage}[b][\ht\vabox][c]{.10\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+\end{minipage}%
+\hfill
+\begin{minipage}[b][\ht\vabox][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+\end{minipage}%
+\par\lipsum
+
+
+\begin{verticallyaligned}
+ \noindent\begin{minipage}[b][\vamaxheight][b]{.30\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-a}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[b][\vamaxheight][t]{.10\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-b}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[b][\vamaxheight][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image-c}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[b][\vamaxheight][c]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[b][\vamaxheight][t]{.20\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \end{minipage}%
+\end{verticallyaligned}
+
+\lipsum[1]
+
+\begin{figure}
+ \begin{verticallyaligned}
+ \noindent\begin{minipage}[b][\vamaxheight][c]{.50\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \caption{}
+ \end{minipage}%
+ \hfill
+ \begin{minipage}[b][\vamaxheight][t]{.40\textwidth}
+ \centering
+ \includegraphics[width=\textwidth]{example-image}
+ \caption{}
+ \end{minipage}%
+ \end{verticallyaligned}
+ \caption{}
+\end{figure}
+
+\end{document}
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index d023ef014d0..f273ab7b890 100755
--- a/Master/texmf-dist/scripts/latexindent/latexindent.pl
+++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl
@@ -17,10 +17,13 @@
use strict;
use warnings;
+# list of modules
+my @listOfModules = ('FindBin','YAML::Tiny','File::Copy','File::Basename','Getopt::Long','File::HomeDir');
+
# check the other modules are available
-foreach my $moduleName ('FindBin','YAML::Tiny','File::Copy','File::Basename','Getopt::Long','File::HomeDir')
+foreach my $moduleName (@listOfModules)
{
- # references:
+ # references:
# http://stackoverflow.com/questions/251694/how-can-i-check-if-i-have-a-perl-module-before-using-it
# http://stackoverflow.com/questions/1917261/how-can-i-dynamically-include-perl-modules-without-using-eval
eval {
@@ -60,7 +63,7 @@ GetOptions ("w"=>\$overwrite,
);
# version number
-my $versionNumber = "2.0R";
+my $versionNumber = "2.1R";
# Check the number of input arguments- if it is 0 then simply
# display the list of options (like a manual)
@@ -83,7 +86,7 @@ ENDQUOTE
exit(2);
}
-# set up default for cruftDirectory using the one from the input file,
+# set up default for cruftDirectory using the one from the input file,
# unless it has been specified using -c="/some/directory"
$cruftDirectory=dirname $ARGV[0] unless(defined($cruftDirectory));
@@ -103,14 +106,40 @@ print $logfile $time;
# output version to log file
print $logfile <<ENDQUOTE
-latexindent.pl version $versionNumber, a script to indent .tex files
-latexindent.pl lives here: $FindBin::RealBin/
+$FindBin::Script version $versionNumber, a script to indent .tex files
+$FindBin::Script lives here: $FindBin::RealBin/
-Directory for backup files and indent.log: $cruftDirectory
+ENDQUOTE
+;
+
+# latexindent.exe is a standalone executable, and caches
+# the required perl modules onto the users system; they will
+# only be displayed if the user specifies the trace option
+if($FindBin::Script eq 'latexindent.exe' and !$tracingMode )
+{
+print $logfile <<ENDQUOTE
+$FindBin::Script is a standalone script and caches the required perl modules
+onto your system. If you'd like to see their location in your log file, indent.log,
+call the script with the tracing option, e.g latexindent.exe -t myfile.tex
-file: $ARGV[0]
ENDQUOTE
;
+}
+
+# output location of modules
+if($FindBin::Script eq 'latexindent.pl' or ($FindBin::Script eq 'latexindent.exe' and $tracingMode ))
+{
+ print $logfile "Modules are being loaded from the following directories:\n ";
+ foreach my $moduleName (@listOfModules)
+ {
+ (my $file = $moduleName) =~ s|::|/|g;
+ require $file . '.pm';
+ print $logfile "\t",$INC{$file .'.pm'},"\n";
+ }
+}
+
+# cruft directory
+print $logfile "Directory for backup files and indent.log: $cruftDirectory\n";
# a quick options check
if($outputToFile and $overwrite)
@@ -179,15 +208,22 @@ ENDQUOTE
exit(2);
}
-
-# Read in YAML file
+# Read in defaultSettings.YAML file
my $defaultSettings = YAML::Tiny->new;
-print $logfile "Reading defaultSettings.yaml from $FindBin::RealBin/defaultSettings.yaml\n\n";
-
# Open defaultSettings.yaml
$defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/defaultSettings.yaml" );
+print $logfile "Reading defaultSettings.yaml from $FindBin::RealBin/defaultSettings.yaml\n\n" if($defaultSettings);
+# if latexindent.exe is invoked from TeXLive, then defaultSettings.yaml won't be in
+# the same directory as it; we need to navigate to it
+if(!$defaultSettings)
+{
+ $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/../../texmf-dist/scripts/latexindent/defaultSettings.yaml");
+ print $logfile "Reading defaultSettings.yaml (2nd attempt, TeXLive, Windows) from $FindBin::RealBin/../../texmf-dist/scripts/latexindent/defaultSettings.yaml\n\n" if($defaultSettings);
+}
+
+# if both of the above attempts have failed, we need to exit
if(!$defaultSettings)
{
for my $fh ($out,$logfile) {
@@ -255,9 +291,26 @@ my $userSettings;
# get information about user settings- first check if indentconfig.yaml exists
my $indentconfig = File::HomeDir->my_home . "/indentconfig.yaml";
+# if indentconfig.yaml doesn't exist, check for the hidden file, .indentconfig.yaml
+$indentconfig = File::HomeDir->my_home . "/.indentconfig.yaml" if(! -e $indentconfig);
+
if ( -e $indentconfig and !$onlyDefault )
{
- print $logfile "Reading path information from ",File::HomeDir->my_home,"/indentconfig.yaml\n";
+ print $logfile "Reading path information from $indentconfig\n";
+ # if both indentconfig.yaml and .indentconfig.yaml exist
+ if ( -e File::HomeDir->my_home . "/indentconfig.yaml" and -e File::HomeDir->my_home . "/.indentconfig.yaml")
+ {
+ print $logfile File::HomeDir->my_home,"/.indentconfig.yaml has been found, but $indentconfig takes priority\n";
+ }
+ elsif ( -e File::HomeDir->my_home . "/indentconfig.yaml" )
+ {
+ print $logfile "Alternatively, ",File::HomeDir->my_home,"/.indentconfig.yaml can be used\n";
+
+ }
+ elsif ( -e File::HomeDir->my_home . "/.indentconfig.yaml" )
+ {
+ print $logfile "Alternatively, ",File::HomeDir->my_home,"/indentconfig.yaml can be used\n";
+ }
# read the absolute paths from indentconfig.yaml
$userSettings = YAML::Tiny->read( "$indentconfig" );
@@ -284,15 +337,16 @@ else
{
if($onlyDefault)
{
- print $logfile "Only default settings requested, not reading USER settings from indentconfig.yaml \n";
+ print $logfile "Only default settings requested, not reading USER settings from $indentconfig\n";
print $logfile "Ignoring localSettings.yaml\n" if($readLocalSettings);
$readLocalSettings = 0;
}
else
{
- # give the user instructions on where to put indentconfig.yaml
+ # give the user instructions on where to put indentconfig.yaml or .indentconfig.yaml
print $logfile "Home directory is ",File::HomeDir->my_home,"\n";
print $logfile "To specify user settings you would put indentconfig.yaml here: \n\t",File::HomeDir->my_home,"/indentconfig.yaml\n\n";
+ print $logfile "Alternatively, you can use the hidden file .indentconfig.yaml as: \n\t",File::HomeDir->my_home,"/.indentconfig.yaml\n\n";
}
}
@@ -1561,7 +1615,7 @@ sub at_beg_of_env_or_eq{
# () empty just so that $1 and $2 are defined
# (\\\[) \[ there are lots of \ because both \ and [ need escaping
# \\begin{\\?(.*?)} \begin{something} where something could start
- # with a backslash, e.g \my@env@ which can happen
+ # with a backslash, e.g \my@env@ which can happen
# in a style or class file, for example
if( ( ( $_ =~ m/^\s*(\$)?\\begin{\\?(.*?)}/ and $_ !~ m/\\end{$2}/)
@@ -1648,9 +1702,9 @@ sub at_end_of_env_or_eq{
&decrease_indent($indentNames[-1]);
}
- # some commands contain \end{environmentname}, which
- # can cause a problem if \begin{environmentname} was not
- # started previously; if @environmentStack is empty,
+ # some commands contain \end{environmentname}, which
+ # can cause a problem if \begin{environmentname} was not
+ # started previously; if @environmentStack is empty,
# then we don't need to check for \end{environmentname}
if(@environmentStack)
{
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 6463f640272..ab23f3fba67 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -2718,7 +2718,6 @@ $standardclean = '\.head|\.tmp|\.dvi|\.log|\.out|\.aux|\.toc|\.lof|\.lot'
'ibycus-babel' => $standardclean . '|ibyhyph.tex', # in hyphen-ancientgreek
'jadetex' => $standardclean # these sty files are in passivetex
. '|(dummyels|mlnames|ucharacters|unicode)\.sty',
- 'latexindent' => 'latexindent.exe', # have our own stub
'lshort-russian'=>'lshortbk.zip', # sources are enough
'lshort-spanish'=>'lshort-letter.pdf', # a4 is enough
'mathexam' => 'sample.tex~',
@@ -3399,6 +3398,10 @@ sub doscripts {
&SYSTEM ("$MV $s.bat $platdir/");
next; # no wrapper
}
+ if ($s eq "latexindent.pl") { # provided .exe (made with par::packer)
+ &SYSTEM ("$MV latexindent.exe $platdir/");
+ next; # no wrapper
+ }
my $w32_wrapper = "$Build/$build_tldir/w32_wrapper/runscript.exe";
&SYSTEM ("$CP $w32_wrapper $platdir/$linkname.exe");
&SYSTEM ("$CP $w32_wrapper $platdir/r$linkname.exe")