### Install pre-commit on Ubuntu Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Use pip to install the pre-commit framework. ```latex python3 -m pip install pre-commit ``` -------------------------------- ### Install latexindent.pl on Linux via CMake Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.tex Commands to install dependencies, build, and install the script using CMake. ```bash sudo apt-get update sudo apt-get install --no-install-recommends cmake make # or any other generator mkdir build && cd build cmake ../path-helper-files sudo make install ``` -------------------------------- ### Log file output example Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/documentation/appendices-mod1.tex Example content found in indent.log when specific log file preferences are enabled. ```text +++++ TRACE: environment found: myenv No ancestors found for myenv Storing settings for myenvenvironments indentRulesGlobal specified (0) for environments, ... Using defaultIndent for myenv Putting linebreak after replacementText for myenv looking for COMMANDS and key = {value} TRACE: Searching for commands with optional and/or mandatory arguments AND key = {value} looking for SPECIAL begin/end TRACE: Searching myenv for special begin/end (see specialBeginEnd) TRACE: Searching myenv for optional and mandatory arguments ... no arguments found ----- ``` -------------------------------- ### If-Else-Fi conditional block example Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-default-user-local.tex Structure for conditional logic blocks starting with \if or \@if. ```latex \ifnum... ... \else ... \fi ``` -------------------------------- ### Demonstration .tex File Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-introduction.md This is a sample listing of a .tex file used for demonstration purposes. ```default demonstration .tex file ``` -------------------------------- ### Running latexindent.pl on a Quick Start File Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-introduction.md This command shows how to run latexindent.pl on a specific file named 'quick-start.tex'. This is part of the quick start guide to demonstrate the script's functionality. ```bash latexindent.pl quick-start.tex ``` -------------------------------- ### Example custom settings file Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-indent-config-and-settings.tex A sample configuration file demonstrating how to override default indentation settings and add environments. ```yaml defaultIndent: " " environments: tabbing: alignmentDelimiters: - "\\+" - "\\-" - "\\>" ``` -------------------------------- ### Run latexindent with configuration files Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-default-user-local.tex Command-line examples for executing latexindent.pl with different YAML configuration files to demonstrate alignment. ```bash latexindent.pl tabular2.tex latexindent.pl tabular2.tex -l tabular2.yaml latexindent.pl tabular2.tex -l tabular3.yaml latexindent.pl tabular2.tex -l tabular2.yaml,tabular4.yaml latexindent.pl tabular2.tex -l tabular2.yaml,tabular5.yaml latexindent.pl tabular2.tex -l tabular2.yaml,tabular6.yaml latexindent.pl tabular2.tex -l tabular2.yaml,tabular7.yaml latexindent.pl tabular2.tex -l tabular2.yaml,tabular8.yaml ``` -------------------------------- ### Initialize and store pgfkeys Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-unprotect-mod22.tex Demonstrates setting initial values and storage targets for pgfkeys. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial=0, ``` ```latex , sample line width/.initial=very thick, start coordinate/.initial =another/. style= 0, ``` ```latex , sample line width/.get=, start coordinate/.initial=0, something else , ``` -------------------------------- ### Install latexindent on macOS Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Command to install the latexindent package via Homebrew. ```bash brew install latexindent ``` -------------------------------- ### PGFKeys Configuration and Initialization Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-mod38.tex Demonstrates setting initial values, retrieving values, and defining styles within a PGFKeys path. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0, , sample line width/.initial=very thick, start coordinate/.initial = another/. style= 0, , sample line width/.get=, start coordinate/.initial=0, something else , ``` -------------------------------- ### Install Perl modules on Ubuntu/Debian Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.tex Standard installation commands for Debian-based systems. ```Bash sudo apt install perl sudo cpan -i App::cpanminus sudo cpanm YAML::Tiny sudo cpanm File::HomeDir ``` ```Bash sudo perl -MCPAN -e'install "File::HomeDir"' ``` -------------------------------- ### Initialize pgfkeys with line breaks Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-mod21.tex Demonstrates the initialization of various pgfkeys with specific formatting and line breaks. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0, , sample line width/.initial=very thick, start coordinate/.initial = another/. style= 0, , sample line width/.get=, start coordinate/.initial=0,something else, ``` -------------------------------- ### PGFKeys Key Initialization and Style Definitions Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-unprotect-mod23.tex Demonstrates the use of .cd, .initial, .get, .store in, and .style keys for configuring PGFKeys parameters. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0,, sample line width/.initial=very thick, start coordinate/.initial = another/. style= 0, , sample line width/.get=, start coordinate/.initial= 0, something else, ``` -------------------------------- ### Run module installer Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Execute the helper script to install missing Perl modules. ```latex perl latexindent-module-installer.pl ``` -------------------------------- ### Install Perl modules on macOS Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.tex Commands for Homebrew users to install Perl and dependencies. ```Bash brew install perl brew install cpanm cpanm YAML::Tiny cpanm File::HomeDir brew install latexindent ``` -------------------------------- ### Demonstrate paths configuration Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Example of a path specification used in YAML configuration files. ```default \pathdemo[ opt arg ]{ mand arg } ``` -------------------------------- ### Display environment demonstration files Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/subsec-poly-switches.tex Show source files used for testing poly-switch behavior. ```latex \begin{cmhtcbraster} \cmhlistingsfromfile{demonstrations/env-mlb2.tex}{\texttt{env-mlb2.tex}}{lst:mlb2} \cmhlistingsfromfile{demonstrations/env-mlb3.tex}{\texttt{env-mlb3.tex}}{lst:mlb3} \end{cmhtcbraster} ``` -------------------------------- ### Install via Conda Source: https://github.com/cmhughes/latexindent.pl/blob/main/readme.md Command to install latexindent.pl using the Conda package manager. ```bash conda install latexindent.pl -c conda-forge ``` -------------------------------- ### Install Perl modules on Arch Linux Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.tex Use pacman to install system-packaged Perl modules. ```Bash sudo pacman -S texlive-binextra perl-yaml-tiny perl-file-homedir sudo pacman -S perl-unicode-linebreak ``` -------------------------------- ### PGFKeys Key Initialization Syntax Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-add-equals.tex Demonstrates different ways to initialize keys within a PGFKeys path. ```latex /tikz/.cd, start coordinate/.initial =0,, ``` ```latex start coordinate/.initial=0,, ``` ```latex start coordinate/.initial=0,, ``` ```latex start coordinate/.initial=0,, ``` -------------------------------- ### Display Help Information Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-how-to-use.md Outputs a welcome message with the version number and available options. Use this to get a quick overview of the script's capabilities. ```bash latexindent.pl -h latexindent.pl --help ``` -------------------------------- ### Verbatim Environment Example Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/oneSentencePerLine/verbatim-testmod0.tex Example of text spanning multiple lines within a verbatim environment. ```latex This is the fourth sentence! This is the fifth sentence? This is the sixth sentence. ``` -------------------------------- ### Example Environment Block Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-default-user-local.md Illustrates a nested environment structure. This is a basic example of how environments are recognized. ```default \begin{outer} \begin{myenv} body of environment body of environment body of environment \end{myenv} \end{outer} ``` -------------------------------- ### PGFKeys Configuration and Style Definitions Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-mod12.tex Demonstrates setting initial values, storing keys, and defining styles using PGFKeys syntax. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0, , sample line width/.initial=very thick, start coordinate/.initial = another/. style= 0, , sample line width/.get=, start coordinate/.initial= 0, something else , ``` -------------------------------- ### Install Perl modules manually Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/documentation/appendices-mod1.tex Commands for installing missing Perl modules on Ubuntu and via CPAN. ```Bash sudo perl -MCPAN -e 'install "File::HomeDir"' ``` ```Bash sudo apt-get install perlbrew perlbrew install perl-5.22.1 perlbrew switch perl-5.22.1 sudo apt-get install curl curl -L http://cpanmin.us | perl - App::cpanminus cpanm YAML::Tiny cpanm File::HomeDir cpanm Unicode::GCString cpanm Log::Log4perl cpanm Log::Dispatch ``` -------------------------------- ### Configure pgfkeys with line breaks Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-remove-line-breaks-mod24.tex Demonstrates key initialization and storage assignments using pgfkeys syntax with varied line breaks. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0, , sample line width/.initial=very thick, start coordinate/.initial = another/. style= 0, , sample line width/.get=, start coordinate/.initial= 0, something else, ``` -------------------------------- ### Install and Execute Docker Image on Ubuntu Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Automates Docker installation if missing and executes the help command. ```latex # setup docker if not already installed if ! command -v docker &> /dev/null; then sudo apt install docker.io -y sudo groupadd docker sudo gpasswd -a "$USER" docker sudo systemctl restart docker newgrp docker fi # download image and execute docker pull ghcr.io/cmhughes/latexindent.pl docker run ghcr.io/cmhughes/latexindent.pl -h ``` -------------------------------- ### pgfkeys Configuration Setup Source: https://github.com/cmhughes/latexindent.pl/blob/main/test-cases/keyEqualsValueBraces/pgfkeys-nested-noAdditional-Global-mod24.tex Defines various keys for coordinate and styling parameters using pgfkeys syntax. ```latex /tikz/.cd, vertical factor/.initial=0.5, vertical factor/.get=, vertical factor/.store in=, start coordinate/.initial= 0,, start coordinate/.get=, start coordinate/.store in=, sample color/.initial=black, sample color/.get=, sample color/.store in=, sample size/.initial=1pt, sample size/.get=, sample size/.store in=, sample line width/.initial=very thick, start coordinate/.initial = another/. style=0,, sample line width/.get=, sample line width/.store in=, start coordinate/.initial= 0, something else, ``` -------------------------------- ### Install Unicode::GCString module Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.md Command to install the required Unicode::GCString module via cpanm. ```bash cpanm Unicode::GCString ``` -------------------------------- ### Install Perl modules on Alpine Linux Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-appendices.tex Installation script for Alpine environments where some modules require apk packages. ```Bash # Installing perl apk --no-cache add miniperl perl-utils # Installing incompatible latexindent perl dependencies via apk apk --no-cache add \ perl-log-dispatch \ perl-namespace-autoclean \ perl-specio \ perl-unicode-linebreak # Installing remaining latexindent perl dependencies via cpan apk --no-cache add curl wget make ls /usr/share/texmf-dist/scripts/latexindent cd /usr/local/bin && \ curl -L https://cpanmin.us/ -o cpanm && \ chmod +x cpanm cpanm -n App::cpanminus cpanm -n File::HomeDir cpanm -n Params::ValidationCompiler cpanm -n YAML::Tiny ``` -------------------------------- ### Load LaTeX and YAML files for huge option demonstration Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/subsec-text-wrap.tex Displays the source files and configuration files used to demonstrate the huge text wrapping behavior. ```latex \begin{cmhtcbraster}[raster column skip=.1\linewidth] \cmhlistingsfromfile{demonstrations/textwrap4-mod2A.tex}{\texttt{textwrap4-mod2A.tex}}{lst:textwrap4-mod2A} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/textwrap2A.yaml}[MLB-TCB]{\texttt{textwrap2A.yaml}}{lst:textwrap2A-yaml} \cmhlistingsfromfile{demonstrations/textwrap4-mod2B.tex}{\texttt{textwrap4-mod2B.tex}}{lst:textwrap4-mod2B} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/textwrap2B.yaml}[MLB-TCB]{\texttt{textwrap2B.yaml}}{lst:textwrap2B-yaml} \end{cmhtcbraster} ``` -------------------------------- ### Include demonstration files Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/sec-default-user-local.tex LaTeX commands used to display source files and their corresponding output in the documentation. ```latex \cmhlistingsfromfile{demonstrations/tabular-DM-mod6.tex}{\texttt{tabular-DM.tex} using \cref{lst:dontMeasure6}}{lst:tabular-DM-mod6} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/dontMeasure6.yaml}[yaml-TCB]{\texttt{dontMeasure6.yaml}}{lst:dontMeasure6} ``` ```latex \cmhlistingsfromfile{demonstrations/tabbing.tex}{\texttt{tabbing.tex}}{lst:tabbing} \cmhlistingsfromfile{demonstrations/tabbing-default.tex}{\texttt{tabbing.tex} default output}{lst:tabbing-default} ``` ```latex \cmhlistingsfromfile{demonstrations/tabbing-mod1.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx1}}{lst:tabbing-mod1} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/delimiterRegEx1.yaml}[yaml-TCB]{\texttt{delimiterRegEx1.yaml}}{lst:delimiterRegEx1} ``` ```latex \cmhlistingsfromfile{demonstrations/tabbing-mod2.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx2}}{lst:tabbing-mod2} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/delimiterRegEx2.yaml}[yaml-TCB]{\texttt{delimiterRegEx2.yaml}}{lst:delimiterRegEx2} ``` ```latex \cmhlistingsfromfile{demonstrations/tabbing-mod3.tex}{\texttt{tabbing.tex} using \cref{lst:delimiterRegEx3}}{lst:tabbing-mod3} \cmhlistingsfromfile[style=yaml-LST]{demonstrations/delimiterRegEx3.yaml}[yaml-TCB]{\texttt{delimiterRegEx3.yaml}}{lst:delimiterRegEx3} ``` -------------------------------- ### Run latexindent.pl with before/after wrapping settings Source: https://github.com/cmhughes/latexindent.pl/blob/main/documentation/subsec-one-sentence-per-line.tex Executes latexindent.pl using specific YAML configuration files to demonstrate how the 'when' setting affects column wrapping constraints. ```bash latexindent.pl multiple-sentences8 -o=+-mod1.tex -l=sentence-wrap2 -m ``` ```bash latexindent.pl multiple-sentences8.tex -o=+-mod2.tex -l=sentence-wrap3 -m ```