diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-09 21:19:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-09 21:19:22 +0000 |
commit | cb174a113ff3add270e32f9f848c608d3695f630 (patch) | |
tree | 42c857142a3d360980476c7f07b34d80ab63e875 /Master/texmf-dist/tex/latex/ffcode | |
parent | fba6bb5ac55c1b9c5cf69dfcbea4dc3ed8958c60 (diff) |
ffcode (9jan22)
git-svn-id: svn://tug.org/texlive/trunk@61550 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 | 82 |
1 files changed, 53 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/ffcode/ffcode.sty b/Master/texmf-dist/tex/latex/ffcode/ffcode.sty index 1c51720636c..5ebb6a0fc5d 100644 --- a/Master/texmf-dist/tex/latex/ffcode/ffcode.sty +++ b/Master/texmf-dist/tex/latex/ffcode/ffcode.sty @@ -1,6 +1,6 @@ % (The MIT License) % -% Copyright (c) 2021 Yegor Bugayenko +% Copyright (c) 2021-2022 Yegor Bugayenko % % Permission is hereby granted, free of charge, to any person obtaining a copy % of this software and associated documentation files (the 'Software'), to deal @@ -21,55 +21,79 @@ % SOFTWARE. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ffcode}[2021/09/13 0.3.2 Fixed Font Code] - -\RequirePackage{xkeyval} +\ProvidesPackage{ffcode}[2022/01/09 0.4.0 Fixed Font Code] \makeatletter -\newif\ifffcode@nopygments -\DeclareOptionX{nopygments}{\ffcode@nopygmentstrue} -\newif\ifffcode@noframes -\DeclareOptionX{noframes}{\ffcode@noframestrue} -\newif\ifffcode@nonumbers -\DeclareOptionX{nonumbers}{\ffcode@nonumberstrue} -\newif\ifffcode@nocn -\DeclareOptionX{nocn}{\ffcode@nocntrue} +\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 -\makeatletter\ifffcode@nopygments - \RequirePackage[draft=true]{minted} -\else - \RequirePackage{minted} -\fi\makeatother +\RequirePackage{minted} + \setminted{breaklines} \usemintedstyle{bw} -\makeatletter\ifffcode@nonumbers - \newminted[ffcode]{text}{framesep=6pt,framerule=1pt,rulecolor=gray,frame=leftline,escapeinside=||,mathescape,highlightcolor=gray!30} + +\makeatletter\ifff@nonumbers + \ifff@nobars + \newminted[ffcode]{text}{ + escapeinside=||,mathescape,highlightcolor=gray!30 + } + \else + \newminted[ffcode]{text}{ + framesep=6pt,framerule=1pt,rulecolor=gray,frame=leftline, + escapeinside=||,mathescape,highlightcolor=gray!30 + } + \fi \else \renewcommand{\theFancyVerbLine}{\textcolor{gray}{\tiny\oldstylenums{\ttfamily\arabic{FancyVerbLine}}}} - \ifffcode@nocn - \newminted[ffcode]{text}{linenos,numbersep=2pt,framesep=6pt,framerule=1pt,highlightcolor=gray!30,rulecolor=gray,frame=leftline,escapeinside=||,mathescape} + \ifff@nocn + \ifff@nobars + \newminted[ffcode]{text}{ + linenos,numbersep=2pt,highlightcolor=gray!30,escapeinside=||,mathescape + } + \else + \newminted[ffcode]{text}{ + framesep=6pt,framerule=1pt,rulecolor=gray,frame=leftline, + linenos,numbersep=2pt,highlightcolor=gray!30,escapeinside=||,mathescape + } + \fi \else - \newminted[ffcode]{text}{firstnumber=last,linenos,numbersep=2pt,framesep=6pt,framerule=1pt,highlightcolor=gray!30,rulecolor=gray,frame=leftline,escapeinside=||,mathescape} + \ifff@nobars + \newminted[ffcode]{text}{ + firstnumber=last,linenos,numbersep=2pt,highlightcolor=gray!30,escapeinside=||,mathescape + } + \else + \newminted[ffcode]{text}{ + framesep=6pt,framerule=1pt,rulecolor=gray,frame=leftline, + firstnumber=last,linenos,numbersep=2pt,highlightcolor=gray!30,escapeinside=||,mathescape + } + \fi \fi \fi\makeatother \makeatletter -\newcommand\ffcode@print{\begingroup\obeyspaces\ffcode@printx} -\newcommand\ffcode@printx[1]{\texttt{#1}\endgroup} +\newcommand\ff@print{\begingroup\obeyspaces\ff@printx} +\newcommand\ff@printx[1]{\texttt{#1}\endgroup} \makeatother -\makeatletter\newcommand\ffcode@rule{\vrule height 6pt depth 1pt width 0pt} -\makeatletter\ifffcode@noframes - \newcommand\ff[1]{\ffcode@rule\ffcode@print{#1}} +\makeatletter\newcommand\ff@rule{\vrule height 6pt depth 1pt width 0pt} +\makeatletter\ifff@noframes + \newcommand\ff[1]{\ff@rule\ff@print{#1}} \else \RequirePackage{tcolorbox} - \newtcbox\ffcode@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]{\ffcode@box{\ffcode@rule\ffcode@print{#1}}} + \newcommand\ff[1]{\ff@box{\ff@rule\ff@print{#1}}} \fi\makeatother \endinput |