diff options
author | Karl Berry <karl@freefriends.org> | 2023-02-11 21:16:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-02-11 21:16:41 +0000 |
commit | f9e3b88ca0a578b474fab0440a030136f034ab2e (patch) | |
tree | 62948f912e8aa0353fda5787b73bbc89cc5e4e77 /Master/texmf-dist/doc/latex/codehigh/codehigh.tex | |
parent | 28c6dbff46efa29add42b37b26f7c7cf7b51199e (diff) |
codehigh (11feb23)
git-svn-id: svn://tug.org/texlive/trunk@65787 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/codehigh/codehigh.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/codehigh/codehigh.tex | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/codehigh/codehigh.tex b/Master/texmf-dist/doc/latex/codehigh/codehigh.tex index c3bddd46329..5f1e0295e75 100644 --- a/Master/texmf-dist/doc/latex/codehigh/codehigh.tex +++ b/Master/texmf-dist/doc/latex/codehigh/codehigh.tex @@ -2,7 +2,7 @@ \documentclass[oneside]{book} \usepackage[a4paper,margin=2cm]{geometry} -\newcommand*{\myversion}{2022E} +\newcommand*{\myversion}{2023A} \newcommand*{\mydate}{Version \myversion\ (\the\year-\mylpad\month-\mylpad\day)} \newcommand*{\mylpad}[1]{\ifnum#1<10 0\the#1\else\the#1\fi} @@ -16,6 +16,7 @@ urlcolor=blue3, linkcolor=green3, } +\usepackage{tabularx,booktabs} \begin{document} @@ -177,6 +178,62 @@ Note that \verb!codehigh! package will load \verb!ninecolors!% To modify or add languages and themes, please read the source files \verb!codehigh.sty! and \verb!codehigh.lua! for reference. +\section{Fake Verbatim Command} + +\CodeHigh{language=latex/table,style/main=gray9,style/code=gray9,style/demo=white} + +To ease the pain of writing verbatim commands +(such as in \verb|tabularx| and \verb|tabularray| tables), +This package provides \verb|\fakeverb| command. + +This command will remove the backslashes in the following control symbols +before typesetting its content: + +\renewcommand\arraystretch{1.3} +\begin{center} +\begin{tabularx}{0.9\linewidth}{llX} +\toprule +Input & Result & Remark \\ +\midrule +\fakeverb{\\\\} & \fakeverb{\\} & + Need to be escaped only when typesetting other control symbols in this table \\ +\fakeverb{\\\{} & \fakeverb{\{} & + Need to be escaped only when left and right curly braces are unmatched \\ +\fakeverb{\\\}} & \fakeverb{\}} & + Need to be escaped only when left and right curly braces are unmatched \\ +\fakeverb{\\\#} & \fakeverb{\#} & + Always need to be escaped \\ +\fakeverb{\\\^} & \fakeverb{\^} & + Need to be escaped only when there are more than one in a row \\ +\texttt{\textbackslash\textvisiblespace} & \texttt{\textvisiblespace} & + Need to be escaped only when more than one in a row or after control words \\ +\fakeverb{\\\%} & \fakeverb{\%} & + Always need to be escaped \\ +\bottomrule +\end{tabularx} +\end{center} + +The argument of \verb|\fakeverb| command need to be enclosed with curly braces. +Therefore it could be safely used inside \verb|tabularray| tables and other LaTeX commands. + +Here is an example of using \verb!\fakeverb! commands inside \verb|tabularx| environment: + +\begin{demohigh}[language=latex/table] +\begin{tabularx}{0.5\textwidth}{lX} +\hline + Alpha & \fakeverb{\abc{}$&^_^uvw 123} \\ +\hline + Beta & \fakeverb{\bfseries\ \#\%} \\ +\hline +\end{tabularx} +\end{demohigh} + +Here is another example of using \verb!\fakeverb! commands inside \verb|\fbox| command: + +\begin{demohigh}[language=latex/latex2] +Hello\fbox{\fakeverb{$\left\\\{A\right.$\#}}Verb! +\end{demohigh} + \chapter{The Source Code} \dochighinput[language=latex/latex3]{codehigh.sty} |