diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-16 21:25:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-16 21:25:04 +0000 |
commit | 61e0965a47ab8c42da627a28651ea8b2923803c9 (patch) | |
tree | 3bbdf2c92a522e2a8bd55da7e8db934774e0abd3 /Master/texmf-dist/tex/latex/ffcode | |
parent | 7ad60e30a12e9b939ea107b97b6cc83b5ad063ba (diff) |
ffcode (16nov22)
git-svn-id: svn://tug.org/texlive/trunk@65032 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ffcode')
-rw-r--r-- | Master/texmf-dist/tex/latex/ffcode/ffcode.sty | 78 |
1 files changed, 49 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/ffcode/ffcode.sty b/Master/texmf-dist/tex/latex/ffcode/ffcode.sty index c98d5980af6..ce38bc254fe 100644 --- a/Master/texmf-dist/tex/latex/ffcode/ffcode.sty +++ b/Master/texmf-dist/tex/latex/ffcode/ffcode.sty @@ -31,7 +31,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{ffcode} -[2022-10-30 0.5.1 Fixed Font Code] +[2022-11-16 0.6.0 Fixed Font Code] @@ -49,19 +49,21 @@ -\RequirePackage{xkeyval} -\makeatletter -\DeclareOptionX{nopygments}{\PassOptionsToPackage{draft=true}{minted}} -\newif\ifff@noframes -\DeclareOptionX{noframes}{\ff@noframestrue} -\newif\ifff@nobars -\DeclareOptionX{nobars}{\ff@nobarstrue} -\newif\ifff@nonumbers -\DeclareOptionX{nonumbers}{\ff@nonumberstrue} -\newif\ifff@nocn -\DeclareOptionX{nocn}{\ff@nocntrue} -\ProcessOptionsX\relax -\makeatother +\RequirePackage{pgfopts} +\pgfkeys{ + /ff/.cd, + nopygments/.store in=\ff@nopygments, + noframes/.store in=\ff@noframes, + nonumbers/.store in=\ff@nonumbers, + nobars/.store in=\ff@nobars, + novert/.store in=\ff@novert, + nocn/.store in=\ff@nocn, +} +\ProcessPgfOptions{/ff} + +\makeatletter\ifdefined\ff@nopygments + \PassOptionsToPackage{draft=true}{minted} +\fi\makeatother \RequirePackage{minted} \setminted{breaklines} @@ -69,8 +71,8 @@ \setminted{highlightcolor=gray!25} \usemintedstyle{bw} -\makeatletter\ifff@nonumbers - \ifff@nobars +\makeatletter\ifdefined\ff@nonumbers + \ifdefined\ff@nobars \newminted[ffcode]{text}{} \else \newminted[ffcode]{text}{framesep=6pt, @@ -79,8 +81,8 @@ \else \renewcommand{\theFancyVerbLine}{\textcolor{gray}% {\tiny\oldstylenums{\ttfamily\arabic{FancyVerbLine}}}} - \ifff@nocn - \ifff@nobars + \ifdefined\ff@nocn + \ifdefined\ff@nobars \newminted[ffcode]{text}{ linenos,numbersep=2pt } @@ -91,7 +93,7 @@ } \fi \else - \ifff@nobars + \ifdefined\ff@nobars \newminted[ffcode]{text}{ firstnumber=last,linenos,numbersep=2pt } @@ -105,27 +107,45 @@ \fi\makeatother \makeatletter -\newcommand\ff@print{\begingroup\obeyspaces\ff@printx} -\newcommand\ff@printx[1]{\textnormal{\texttt{#1}}\endgroup} +\newcommand\ff@print[1]{\textnormal{\texttt{#1}}} \makeatother \makeatletter\newcommand\ff@rule {\vrule height 6pt depth 1pt width 0pt} \makeatother -\makeatletter\ifff@noframes - \newcommand\ff[1]{\ff@rule\ff@print{#1}} -\else +\makeatletter +\ifdefined\ff@noframes\else \RequirePackage{tcolorbox} - \newtcbox\ff@box{nobeforeafter,colframe=gray!80!white, + \newtcbox\ff@box{nobeforeafter,colframe=gray!80!white, colback=gray!5!white,boxrule=0.1pt,arc=1pt, boxsep=1.2pt,left=0.5pt,right=0.5pt,top=0.2pt,bottom=0.2pt, tcbox raise base} - \newcommand\ff[1]{\relax\ifmmode% - {\ff@rule\ff@print{#1}}% +\fi +\makeatother + +\makeatletter +\NewDocumentCommand\ff@x{v}{% + \ifdefined\ff@noframes% + \ff@rule\ff@print{#1}% \else% - {\ff@box{\ff@rule\ff@print{#1}}}% - \fi} + \relax\ifmmode% + \ff@rule\ff@print{#1}% + \else% + \ff@box{\ff@rule\ff@print{#1}}% + \fi% + \fi% +} +\makeatother + +\makeatletter +\def\ff{\ff@x} +\makeatother + +\makeatletter\ifdefined\ff@novert\else + \catcode`\|\active + \AtBeginDocument{\catcode`\|\active\protected\def|{\ff@x|}} + \catcode`\| 12 % \fi\makeatother |