diff options
author | Karl Berry <karl@freefriends.org> | 2021-03-15 22:02:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-03-15 22:02:45 +0000 |
commit | ec4f77d5218a6cd250b3e8ba4b368f6d3ba813e8 (patch) | |
tree | 0a46c065a2f67e41ef79d8f5dba9a64237c7d7a5 | |
parent | 119326d29a3f4d8d3262847f18c6c7783ce03922 (diff) |
highlightlatex (15mar21)
git-svn-id: svn://tug.org/texlive/trunk@58392 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/highlightlatex/LICENSE.txt | 21 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/highlightlatex/README.md | 267 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/highlightlatex/highlightlatex-manual.pdf | bin | 0 -> 231500 bytes | |||
-rw-r--r-- | Master/texmf-dist/tex/latex/highlightlatex/highlightlatex.sty | 525 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 7 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/highlightlatex.tlpsrc | 0 |
8 files changed, 820 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/highlightlatex/LICENSE.txt b/Master/texmf-dist/doc/latex/highlightlatex/LICENSE.txt new file mode 100644 index 00000000000..74e1b58f1b6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/highlightlatex/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Vincent Kuhlmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Master/texmf-dist/doc/latex/highlightlatex/README.md b/Master/texmf-dist/doc/latex/highlightlatex/README.md new file mode 100644 index 00000000000..e6d0e6f2a12 --- /dev/null +++ b/Master/texmf-dist/doc/latex/highlightlatex/README.md @@ -0,0 +1,267 @@ +# Highlight LaTeX: Pretty LaTeX code within LaTeX + +Teaching other people LaTeX is great fun, and I've seen plenty of slides and +readers doing so. You show what you achieve, and how you achieve it. However, +while the LaTeX you achieve might look splendid, showing code is often done +using very rudimentary solutions (like plain old verbatim). + +They're not to blame: I didn't find pretty colored LaTeX highlighting either. I +sure want it, and if you're reading this, you probably too, so I've made a +package for it! It builds further on the generic `listings` package to provide +colored highlighting for LaTeX. The file `demo.tex` achieves this: + +<img src="assets/demoshowoff.png" width="600" +alt="highlight demo" title="Highlight demo"> + +## Manual installation + +1. Download the `.sty` file, e.g. +[right click here and select 'save as'](https://github.com/vkuhlmann/highlight-latex/raw/main/highlightlatex.sty). +2. Copy the file to the directory where your `.tex` file is at... +3. ... or make it available for all your `.tex` files by placing the file in + your TEXMF root. + + **Locating TEXTMF root** + + Note the following default locations: + + MiKTeX on Windows: + global installation: C:\Program Files\MiKTeX\tex\latex + local installation: %AppData%\..\Local\Programs\MiKTeX\tex\latex + + TeX Live on Linux or Mac: + /usr/share/texmf-texlive/tex/latex + /usr/local/texlive/texmf-local/tex/latex + + On Windows you can open a path by pasting the address in the Windows Explorer + address bar, or pressing <kbd>Start</kbd>+<kbd>R</kbd> and pasting the + address there. One of these directories should contain a long list of + packages you have installed. If you can't it, and you use MiKTeX, open MiKTeX + Console and open the directories listed under `Settings > Directories` with + `Purpose` set to `Install`. Doesn't it exist? Append a `tex` or `latex` + directory to the path. + + **Adding the package** + + Add a new directory called `highlightlatex` and place the `.sty` file in it. + Then refresh the file name database: + * For MiKTeX on Windows open MiKTeX Console and execute `Tasks > Refresh file + name database`. + * For TeX Live on Linux or Mac, execute in a terminal `sudo texhash`. +4. Add `\usepackage{highlightlatex}` to your `.tex` file. +5. For usage of this package, consult the demo files, or read the + documentation below. + +## Getting started + +After having added the package, you can add LaTeX in two ways: +* Inline style: + + Your file begins with a line of the form \hll|\documentclass[]{}|. The + square brackets ... + + The first non-space character following `\hll` is delimits the argument to + this command. + +* Block style: + + Your basic document now looks like + \begin{highlightblock}[gobble=2] + \documentclass[a4paper]{article} + \begin{document} + Hello world! + \end{document} + \end{highlightblock} + + To prevent indentation of our `highlightblock` (here one tab), to be shown as + part of the code, the `gobble` parameters strips them off. Play around with + it until everything looks right. I recommend to set this value globally using + `\def\defaultgobble{2}`. You can still override that, if necessary. + + There are situations where width of the block could run out of the page. For + example, when using beamer and storing a block as described in the section + 'Fragile breaking situations', the normal full-width of a slide is assumed. + If you use multiple columns, set the `linewidth` on the `highlightblock`. + This can be a fraction of the total slide width available, `0.6\textwidth` + is 60% of the width, or an absolute value, like `10em`, which seems to equal + 20 characters. + + There are more keys you can provide. Check the + [listings package documentation](https://www.ctan.org/pkg/listings) for + options available to the `lstlisting`-environment and `lstset` command. + +## Adding a command to a highlighting rule + +By default, only some LaTeX commands will be highlighted in blue. If there are +others you need, like `\tableofcontents` and `\figref`, update the highlighting +rules: +``` +\updatehighlight{ + name = default, + add = { + \tableofcontents, \figref + } +} +``` + +The changes will affect only code after it. For a use as this example, I +recommend putting it in your preamble (before the `\begin{document}`). + +## Custom highlighting rules + +As shown `demo.tex`, you can put any command or keyword you want to highlight on +in a different color. You do this with +``` +\updatehighlight{ + % A name like 'focus' or 'orange' would be more descriptive, + % this is just to show you can make up the name yourself. + name = orangejuice, + color = orange + add = { + \tableofcontents + } +} +``` + +You can use the `xcolor` syntax for describing colors as well. If you find the +orange too bright, you can replace it with `orange!90!black`: 90% orange, +remaining is black. For more information on color definitions and name, refer to +[LaTeX/Colors on Wikibooks](https://en.wikibooks.org/wiki/LaTeX/Colors). + +--- + +The argument to `\updatehighlight` is a key-value list. Keys are processed +sequentially. For example, use `color` before rather than after the `add`, and +a key can appear multiple times. Each one will be processed. You can merge any +two `\updatehighlight` in one. No need to close and reopen `\updatehighlight` +for each highlighting rule. + +You might be tempted to add a blank line for clarity; that means a new paragraph +too LaTeX, don't do it. Instead, just put a line with only a `%` sign. Spacing +within the argument is often irrelevant. If you need a comma in the value, +surround your value with braces. + +The possible keys are: +* **name**: Create or modify a named rule. This key is optional. + + The default keys are `default`, which includes a bunch of basic commands, + and has by default a dark blue color, and `structure`, which consists of + `\begin` and `\end` and prints them in light blue. + + _Deprecated alias: label_ + +* **classoffset**: Set the `listings` classoffset manually. Try to avoid this. + Use **name** to refer to existing rules instead. + +* **add**: Add a commands (`\mycommand`) oor keywords (`Hi!`) to the current + rule. The value can contain multiple values by opening braces, and comma + separating values within them. + + _Deprecated aliases: macros (only for commands), commands (only for commands), + and keywords (only for keywords)_ + +* **remove**: Remove a commands or keywords from the current rule. The value can + contain multiple values by opening braces, and comma separating values within + them. + +* **clear**: Remove all commands and keywords from the current rule. Use without + value, for example + + \updatehighlight{ + name = default, + clear + } + +* **color**: Specify a color for the rule. Equivalent to specifying **style** + instead, with value `\color{value}` where `value` is the value for the + **color** key. So `color=red` and `style=\color{red}` are equivalent. + +* **style**: Specify a style for the rule. A rule can only have one style. If + you specify a style after `add`, `remove`, `keywords` (deprecated), `macros` + (deprecated) or `commands` (deprecated), this starts a new (unnamed) rule. + In practice, the only style which will probably work for you is only a color, + so just use it instead. But hey, you have the option if you want to. :) + +## Global settings +There are some global parameters involved in the appearance: +``` +\colorlet{curlyBrackets}{red!50!blue} +\colorlet{squareBrackets}{blue!50!white} +\colorlet{codeBackground}{gray!10!white} +\colorlet{comment}{green!40!black} +\def\defaultgobble{0} +``` + +Each line can be set independent of eachother, and each shows its default value. + +There are package options you can use as well: +* **frame** (default `lines`): specify the frame you want around code. My + favorites are `lines` and `none`. Check the + [listings package documentation](https://www.ctan.org/pkg/listings) for all + possibilities. + +* **noframe** (use without value): equivalent to `frame=none`. + +* **styleanywhere** (use without value): override the default behavior that + `style` starts a new style after commands like `add` and `remove`. + +## Fragile breaking situations (like beamer frames) + +When passing command arguments around, or storing environment content, LaTeX +interprets all characters. This includes seeing `\maketitle` in `\hll|\maketitle|` +as a real command. To prevent this behavior, everything from `\verb`, to the +`verbatim`-environment, to the `listings` package the highlight LaTeX package +uses temporarily changes the interpretation of characters that are still to be +read. The blackslash before maketitle in `\hll|\maketitle|` will be read as +`just text' (a _letter_ technically). + +When content has already been interpreted, like the `frame`-environment in +`beamer` does, this trick can't be done anymore. Instead, you either need to +_escape_ code, or _pre-process_ the code outside a fragile breaking situation. + +Escaping is done by preceding the special character with a backslash. For +example, `\hll|\documentclass[]{}|` becomes `\hll|\\documentclass[]\{\}|`. + +For large code blocks, this is undesirable. Therefore, the package provides for +a companion to the `highlightblock`-environment: surround it with a `saveblock` +environment which takes a single argument: a name to assign it. We use it to +refer to it later. For example: +```latex +\begin{saveblock}{basicfigure} + \begin{highlightblock}[linewidth=0.6\textwidth] + \begin{figure} + \includegraphics + [width=0.9\linewidth] + {myPlot.pdf} + + \caption{My plot} + \label{fig:myplot} + \end{figure} + \end{highlightblock} +\end{saveblock} +``` + +Do this outside a fragile breaking situation. (For the `frame`-environment +example, that means just before the `frame` for example.) Then, where you want +to use it, use `\useblock{basicfigure}`. There is also a variant +`\consumeblock{basicfigure}`. If you save many blocks, these will all remain +loaded in memory till your PDF has fully generated. The `\consumeblock` works +like `\useblock`, except the saved block is deleted from memory after its use. +Note this can also result in unexpected behavior, for example animations in a +beamer frame might need the code line to be executed multiple times. Use +`\useblock` when you can't make the guarantee this is the last use. + +For this special, but very important, situation, I've created a separate demo, +which you find at `deamerdemo/deamerdemo.tex`. + +## Adding extra space + +By default, highlight-latex follows an approach where it minimizes spacing. +This gives you full control over how tight or spacious your document looks. +Just use commands like `\medskip` to add extra spacing. The package doesn't +currently include an option to have that done everywhere automatically. + +## License + +The package is available under MIT License. See LICENSE.txt + diff --git a/Master/texmf-dist/doc/latex/highlightlatex/highlightlatex-manual.pdf b/Master/texmf-dist/doc/latex/highlightlatex/highlightlatex-manual.pdf Binary files differnew file mode 100644 index 00000000000..5050bc29c1c --- /dev/null +++ b/Master/texmf-dist/doc/latex/highlightlatex/highlightlatex-manual.pdf diff --git a/Master/texmf-dist/tex/latex/highlightlatex/highlightlatex.sty b/Master/texmf-dist/tex/latex/highlightlatex/highlightlatex.sty new file mode 100644 index 00000000000..3c173916396 --- /dev/null +++ b/Master/texmf-dist/tex/latex/highlightlatex/highlightlatex.sty @@ -0,0 +1,525 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{highlightlatex}[2021/03/14] + +% Repository: https://github.com/vkuhlmann/highlight-latex + +% Copyright (c) 2021 Vincent Kuhlmann +% +% Permission is hereby granted, free of charge, to any person +% obtaining a copy of this software and associated documentation +% files (the "Software"), to deal in the Software without +% restriction, including without limitation the rights to use, +% copy, modify, merge, publish, distribute, sublicense, and/or sell +% copies of the Software, and to permit persons to whom the +% Software is furnished to do so, subject to the following +% conditions: +% +% The above copyright notice and this permission notice shall be +% included in all copies or substantial portions of the Software. +% +% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +% OTHER DEALINGS IN THE SOFTWARE. + +\RequirePackage{listings} +\RequirePackage{xcolor} + +\RequirePackage{xkeyval} +\RequirePackage{etoolbox} + +% Snippet source: +% https://tex.stackexchange.com/questions/406015/defining-macro-gsetlength-as-global-setlength-reliable +\gdef\gsetlength#1#2{% + \begingroup + \setlength\skip@{#2}% + \global#1=\skip@ + \endgroup +} + + +\def\@highlight@frame{none} +\newlength{\hll@offset@fixskip} +\setlength{\hll@offset@fixskip}{0pt} + +\newif\ifhllStyleAnywhere +\newcommand\defaultgobble{0} +\newif\ifhllDebugFrame +%\hllDebugFrametrue +\newlength\hllBeforeSkip +\setlength\hllBeforeSkip{2pt} +\newlength\hllAfterSkip +\setlength\hllAfterSkip{0pt} + + +\DeclareOptionX{frame}{ + \setframe{#1} +} + +\DeclareOptionX{noframe}{ + \setframe{none} +} + +\def\setframe#1{% + \def\frameval{#1}% + \ifx\relax#1\relax + \def\frameval{lines}% + \fi + \def\linesvalue{lines}% + % + \xdef\@highlight@frame{\frameval}% + % + \ifx\frameval\linesvalue + \gsetlength{\hll@offset@fixskip}{6pt}% + \else + \gsetlength{\hll@offset@fixskip}{0pt}% + \fi +} + +\DeclareOptionX{styleanywhere}{ + \hllStyleAnywheretrue +} + +\DeclareOptionX*{\PackageWarning{highlight-latex}{`\CurrentOption' ignored}} +\ExecuteOptionsX{frame=lines} + +\ProcessOptionsX\relax + +\colorlet{curlyBrackets}{red!50!blue} +\colorlet{squareBrackets}{blue!50!white} +\colorlet{codeBackground}{gray!10!white} +\colorlet{comment}{green!40!black} + +\colorlet{accDefault}{blue!90!black} +\definecolor{accStructure}{RGB}{0,149,255} + +\colorlet{accentB}{green!60!black} + +\catcode`\{=11 +\let\myopenbrace={ +\catcode`\{=1 + +\catcode`\}=11 +\let\myclosebrace=} +\catcode`\}=2 + +\lstdefinelanguage{ColoredLaTeX} +[LaTeX]{TeX}{ + backgroundcolor=\color{codeBackground}, + keywordstyle=\bfseries\color{accDefault}, + basicstyle=\footnotesize\ttfamily, + commentstyle=\color{comment}, + numbers=none, + tabsize=2, + mathescape=false, + alsoletter={$@_!|?$}, +% + classoffset=0, + keywordstyle=\color{accDefault}, + texcsstyle=*\color{accDefault}, + moretexcs={subsection,thesubsection,thesection,theoremstyle}, + deletetexcs={begin,end}, +% + classoffset=1, + keywordstyle=\color{accStructure}, + texcsstyle=*\color{accStructure}, + moretexcs={begin,end}, +% + classoffset=2, + escapeinside=~~, +% + classoffset=0, + %literate={textA}{textB}{3}% + %https://tex.stackexchange.com/questions/172945/coloring-in-listing + literate={\{}{{\textcolor{curlyBrackets}{\myopenbrace}}}{1} + {\}}{{\textcolor{curlyBrackets}{\myclosebrace}}}{1} + {[}{{\textcolor{squareBrackets}{[}}}{1} + {]}{{\textcolor{squareBrackets}{]}}}{1}% + % {(}{{\textcolor{delimiterColor}{(}}}{1} + % {)}{{\textcolor{delimiterColor}{)}}}{1}% + %texcsstyle=\color{blue} +} +\lstset{language=ColoredLaTeX} + + +\newcommand{\hllDelimDollar}[1][\color{green!40!black}]{% + \lstset{ + classoffset=2, + moredelim=**[s][#1]{$}{$}, + classoffset=0 + }% +} + +\newcommand{\hllDelimParen}[1][\color{green!40!black}]{% + \lstset{ + classoffset=2, + moredelim=**[s][#1]{\(}{\)}, + classoffset=0 + }% +} + +\def\hll@assignlabel#1#2{% + \expandafter\gdef\csname hll@labeltoclassoffset@#1\endcsname{#2}% +} + +\hll@assignlabel{default}{0} +\hll@assignlabel{structure}{1} + + +% ========================= +% block & inline markup +% ========================= + +\newcommand{\hllPrepareBlock}{% + \lstset{framesep=0.1cm,framerule=0.6pt}% + \def\setHighlightFrame##1{% + \lstset{frame=##1}% + }% + \expandafter\setHighlightFrame\expandafter{\@highlight@frame}% + \lstset{belowskip=0pt,aboveskip=0pt,belowcaptionskip=0pt,gobble=\defaultgobble}% + \setlength\parskip{0pt}% + \setlength\parindent{0pt}% +} + +\lstnewenvironment{highlightblock}[1][] +{% + \vspace{\hllBeforeSkip}% + \begingroup + \hllPrepareBlock\lstset{#1}% +}{% + \nointerlineskip + \endgroup + \vspace{\hllAfterSkip}% +} + +\lstnewenvironment{hllblock}[1][] +{% + \vspace{\hllBeforeSkip}% + \begingroup + \hllPrepareBlock\lstset{#1}% +}{% + \endgroup + \vspace{\hllAfterSkip}% +} + +\def\hll{\lstinline} + +% ================ +% block saving +% ================ + +\newenvironment{saveblock}[1]{% + \expandafter\ifx\csname @codebox@#1\endcsname\relax + \expandafter\newbox\csname @codebox@#1\endcsname\relax + \fi + % + % The trick from latex/base/latex.ltx + \edef\@bracehack{% + \endgroup + \expandafter\setbox\csname @codebox@#1\endcsname\vbox{% + \begingroup\aftergroup}% + \def\noexpand\@currenvir{\@currenvir}% + \def\noexpand\@currenvline{\on@line}}% + \@bracehack + \begingroup\vspace{\hll@offset@fixskip} + \ignorespaces% +}{% + \endgroup +} + +\newcommand\useblock[1]{% + \ifhllDebugFrame + \par + {% + \setlength{\fboxsep}{0pt}% + \fcolorbox{orange}{red}{\expandafter\usebox\csname @codebox@#1\endcsname}% + }% + \par + \else + \par\expandafter\usebox\csname @codebox@#1\endcsname\par + \fi +} + +\newcommand\consumeblock[1]{% + \ifhllDebugFrame + \par + {% + \setlength{\fboxsep}{0pt}% + \setlength{\fboxrule}{1pt}% + \fcolorbox{orange}{red}{\leavevmode\expandafter\box\csname @codebox@#1\endcsname\relax}% + } + \par + \expandafter\let\csname @codebox@#1\endcsname\relax + \else + \par\leavevmode\expandafter\box\csname @codebox@#1\endcsname\relax\par + \expandafter\let\csname @codebox@#1\endcsname\relax + \fi +} + +% =================== +% updatehighlight +% =================== + +\def\hll@update@label{} + +\newcounter{hll@update@state} + +\newcounter{hll@update@nextclassoffset} +\setcounter{hll@update@nextclassoffset}{5} + +\newcounter{hll@update@classoffset} + +\def\hll@update@fixclassoffset{% + \ifnum\value{hll@update@state}<1\relax + \setcounter{hll@update@classoffset}{\thehll@update@nextclassoffset}% + \stepcounter{hll@update@nextclassoffset}% + \setcounter{hll@update@state}{1}% + \fi +} + +\newcommand{\updatehighlight}[1]{% + \setcounter{hll@update@state}{-1}% + \gdef\hll@update@label{}% + \setkeys{updatehighlight}{#1}% + % + \lstset{classoffset=0}% +} + + +%%% KEY: label +%%% ---------- + +\define@key{updatehighlight}{label}{% + \hll@update@setlabel{#1}% +} + +\define@key{updatehighlight}{name}{% + \hll@update@setlabel{#1}% +} + +\def\hll@update@setlabel#1{ + \gdef\hll@update@label{#1}% + \expandafter\def\expandafter\@capturedlabel\expandafter{\csname hll@labeltoclassoffset@#1\endcsname}% + \expandafter\unless\expandafter\ifx\@capturedlabel\relax\relax + % Label exists + \edef\@val{\@capturedlabel}% + \setcounter{hll@update@classoffset}{\@val}% + \setcounter{hll@update@state}{1}% + \else + % Allocate new label + \edef\@val{\thehll@update@nextclassoffset}% + \setcounter{hll@update@classoffset}{\@val}% + \stepcounter{hll@update@nextclassoffset}% + \setcounter{hll@update@state}{1}% + % + \expandafter\xdef\@capturedlabel{\@val}% + \fi +} + +%%% KEY: classoffset +%%% ---------------- + +\define@key{updatehighlight}{classoffset}{% + \setcounter{hll@update@classoffset}{#1}% + \setcounter{hll@update@state}{1}% +} + +%%% KEY: commands +%%% ------------- + +\define@key{updatehighlight}{macros}{% + \hll@update@macros{#1}% +} + +\define@key{updatehighlight}{commands}{% + \hll@update@macros{#1}% +} + + +\def\hll@update@macros#1{% + \hll@update@fixclassoffset + \def\@inv##1{\forcsvlist{\hll@update@addmacro{##1}}{#1}}% + \expandafter\@inv\expandafter{\the\c@hll@update@classoffset} + % + \setcounter{hll@update@state}{2}% +} + +\def\hll@update@addmacro#1#2{% + \if\noexpand#2\relax + \edef\keywordpure{\expandafter\@gobble\string#2}% + \def\callwithpure##1{\hll@update@addmacro@i{#1}{##1}}% + \expandafter\callwithpure\expandafter{\keywordpure}% + \else + \hll@update@addmacro@i{#1}{#2}% + \fi +} + +\def\hll@update@addmacro@i#1#2{% + \lstset{ + classoffset=0,deletetexcs={#2}, + classoffset=1,deletetexcs={#2}, + classoffset=#1,moretexcs={#2}, + classoffset=0 + }% +} + + +%%% KEY: add +%%% -------- + +\define@key{updatehighlight}{add}{% + \hll@update@add{#1}% +} + +\def\hll@update@add#1{% + \hll@update@fixclassoffset + \def\@inv##1{\forcsvlist{\hll@update@additem{##1}}{#1}}% + \expandafter\@inv\expandafter{\the\c@hll@update@classoffset} + % + \setcounter{hll@update@state}{2}% +} + +\def\hll@update@additem#1#2{% + \if\noexpand#2\relax + \edef\keywordpure{\expandafter\@gobble\string#2}% + \def\callwithpure##1{\hll@update@addmacro@i{#1}{##1}}% + \expandafter\callwithpure\expandafter{\keywordpure}% + \else + \hll@update@addkeyword{#1}{#2}% + \fi +} + +%%% KEY: remove +%%% ----------- + +\define@key{updatehighlight}{remove}{% + \hll@update@remove{#1}% +} + +\def\hll@update@remove#1{% + \hll@update@fixclassoffset + \def\@inv##1{\forcsvlist{\hll@update@removeitem{##1}}{#1}}% + \expandafter\@inv\expandafter{\the\c@hll@update@classoffset} + % + \setcounter{hll@update@state}{2}% +} + +\def\hll@update@removeitem#1#2{% + \if\noexpand#2\relax + \edef\keywordpure{\expandafter\@gobble\string#2}% + \def\callwithpure##1{\hll@update@removemacro{#1}{##1}}% + \expandafter\callwithpure\expandafter{\keywordpure}% + \else + \hll@update@removekeyword{#1}{#2}% + \fi +} + +\def\hll@update@removemacro#1#2{% + \lstset{ + classoffset={#1}, + deletetexcs={#2} + }% +} + +\def\hll@update@removekeyword#1#2{% + \lstset{ + classoffset={#1}, + deletekeywords={#2} + }% +} + + +%%% KEY: keywords +%%% ------------- + +\define@key{updatehighlight}{keywords}{% + \hll@update@keywords{#1}% +} + + +\def\hll@update@keywords#1{% + \hll@update@fixclassoffset + \def\@inv##1{\forcsvlist{\hll@update@addkeyword{##1}}{#1}}% + \expandafter\@inv\expandafter{\the\c@hll@update@classoffset}% + % + \setcounter{hll@update@state}{2}% +} + +\def\hll@update@addkeyword#1#2{% + \lstset{ + classoffset=0,deletekeywords={#2}, + classoffset=1,deletekeywords={#2}, + classoffset=#1,otherkeywords={#2},morekeywords={#2}, + classoffset=0 + }% +} + + +%%% KEY: style +%%% ---------- + +\define@key{updatehighlight}{style}{% + \hll@update@fixclassoffset + \unless\ifhllStyleAnywhere + \ifnum\value{hll@update@state}>1\relax + \setcounter{hll@update@state}{0}% + \hll@update@fixclassoffset + \fi + \fi + % + \expandafter\hll@update@setstyle\expandafter{\the\c@hll@update@classoffset}{#1}% +} + +\def\hll@update@setstyle#1#2{% + \lstset{% + classoffset=#1, + keywordstyle={#2}, + texcsstyle={*#2}, + }% +} + +%%% KEY: color +%%% ---------- + +\define@key{updatehighlight}{color}{% + \hll@update@fixclassoffset + \unless\ifhllStyleAnywhere + \ifnum\value{hll@update@state}>1\relax + \setcounter{hll@update@state}{0}% + \hll@update@fixclassoffset + \fi + \fi + % + \expandafter\hll@update@setcolor\expandafter{\the\c@hll@update@classoffset}{#1}% +} + +\def\hll@update@setcolor#1#2{% + \lstset{% + classoffset=#1, + keywordstyle={\color{#2}}, + texcsstyle={*\color{#2}}, + }% +} + +%%% KEY: clear +%%% ---------- + +\define@key{updatehighlight}{clear}[]{% + \hll@update@fixclassoffset + \expandafter\hll@update@clear\expandafter{\the\c@hll@update@classoffset}% +} + +\def\hll@update@clear#1{% + \lstset{ + classoffset=#1, + texcs={}, + keywords={}, + classoffset=0 + }% +} + + diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index b2a965e3555..9a5720511b3 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -282,7 +282,7 @@ my @TLP_working = qw( epigrafica epigram epigraph epigraph-keys epiolmec eplain epsdice epsf epsf-dvipdfmx epsincl epslatex-fr epspdfconversion epstopdf epstopdf-pkg - eq-fetchbbl eq-pin2corr eqell eqexpl eqlist + eq-pin2corr eqell eqexpl eqlist eqnalign eqname eqnarray eqnnumwarn eqparbox erdc erewhon erewhon-math errata erw-l3 esami es-tex-faq esdiff esindex esint esint-type1 esk eskd eskdx @@ -304,7 +304,8 @@ my @TLP_working = qw( fancyref fancyslides fancytabs fancytooltips fancyvrb fandol fascicules fast-diagram fbb fbithesis fbox fbs fc fcavtex fcltxdoc fcolumn fdsymbol fduthesis featpost fei fenixpar - fetamont fetchcls feupphdteses fewerfloatpages feyn feynmf feynmp-auto + fetamont fetchcls + feupphdteses fewerfloatpages feyn feynmf feynmp-auto ffslides fge fgruler fibeamer fifinddo-info fifo-stack fig4latex figbas figbib figflow figsize filecontents filecontentsdef filedate filehook fileinfo filemod @@ -377,7 +378,7 @@ my @TLP_working = qw( hep hep-paper hepnames hepparticles hepthesis hepunits here heuristica hexgame hf-tikz hfbright hfoldsty - hhtensor hindawi-latex-template hindmadurai + hhtensor highlightlatex hindawi-latex-template hindmadurai histogr historische-zeitschrift hitec hitreport hitszthesis hitszbeamer hithesis hletter hlist diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index c79f7fd2514..9895959244d 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -458,6 +458,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'epspdf', "die 'skipping, siep does it'", #"&MAKEflatten", 'epspdf-setup',"die 'skipping, siep does it'", 'epyt', "die 'renamed to beamertheme-epyt'", + 'eq-fetchbbl', "die 'skipping, requires fetchbibpes'", 'eq-save', "die 'skipping, requires acrotex'", 'eq2db', "die 'skipping, author request (and nonfree requirements)'", 'eqexam', "die 'skipping, per author (dps) request'", @@ -492,7 +493,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'fc-arith', "die 'skipping, per author request'", 'fc_arith', "die 'skipping, per author request'", 'fetamont', "&MAKEflatten", - 'fetchbibpes', "die 'skipping, per author (dps) request'", + 'fetchbibpes', "die 'skipping, generic runtime names'", 'feynmf', "&MAKEfeynmf", 'findhyph', "&MAKEflatten", 'firamath-otf',"&MAKEflatten", diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index f2c7ac9c193..dbc5e8570f9 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -399,7 +399,6 @@ depend envlab depend epigraph depend epigraph-keys depend epiolmec -depend eq-fetchbbl depend eq-pin2corr depend eqell depend eqlist @@ -589,6 +588,7 @@ depend harpoon depend hc depend he-she depend hhtensor +depend highlightlatex depend histogr depend hitec depend hitreport diff --git a/Master/tlpkg/tlpsrc/highlightlatex.tlpsrc b/Master/tlpkg/tlpsrc/highlightlatex.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/highlightlatex.tlpsrc |