diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-28 21:00:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-28 21:00:08 +0000 |
commit | 20229ac1b0cf251211d2acde80293548ec753ce3 (patch) | |
tree | a55f4cda8212691f2bd881986fb976d3755a04e7 /Master/texmf-dist/source/latex/ffcode | |
parent | a253c35e1f044cd42907d3a626b7fece17995317 (diff) |
ffcode (28nov22)
git-svn-id: svn://tug.org/texlive/trunk@65132 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/ffcode')
-rw-r--r-- | Master/texmf-dist/source/latex/ffcode/ffcode.dtx | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/Master/texmf-dist/source/latex/ffcode/ffcode.dtx b/Master/texmf-dist/source/latex/ffcode/ffcode.dtx index e50bb899eb3..2107516f3e0 100644 --- a/Master/texmf-dist/source/latex/ffcode/ffcode.dtx +++ b/Master/texmf-dist/source/latex/ffcode/ffcode.dtx @@ -50,7 +50,7 @@ %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{ffcode} %<*package> -[2022-11-16 0.6.0 Fixed Font Code] +[2022-11-28 0.7.0 Fixed Font Code] %</package> %<*driver> \documentclass{ltxdoc} @@ -97,7 +97,7 @@ % \begin{ffcode} % int fibo(int n) { % if (n < 2) { -% return n; |$\label{ln:ret}$| +% return n; |\label{ln:ret}| % } % return fibo(n-1)+fibo(n-2); % } @@ -133,6 +133,38 @@ % (stands for ``no continuous numbering'') % option of the package. +% \DescribeMacro{bold} +% You can make your |\ff| pieces look bolder than usual, which may be pretty convenient for some document classes +% (pay attention to the usage of the \href{https://ctan.org/pkg/lmodern}{lmodern} package, without it the bold won't work, as explained \href{https://tex.stackexchange.com/a/215489/1449}{here}): +% \docshotOptions{firstline=4,lastline=10} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=3in]{geometry} +% \pagestyle{empty} +% \usepackage{lmodern} +% \usepackage[bold,noframes]{ffcode} +% \begin{document} +% Sometimes it's necessary to make +% code pieces look bolder, like +% the |fibo()| function in this text. +% \end{document} +% \end{docshot} + +% \DescribeMacro{sf} +% You can change the font family of |\ff| pieces to |\sffamily|: +% \docshotOptions{firstline=4,lastline=9} +% \begin{docshot} +% \documentclass{article} +% \usepackage[paperwidth=3in]{geometry} +% \pagestyle{empty} +% \usepackage[sf,bold,noframes]{ffcode} +% \begin{document} +% Sometimes you may want them to look +% not strictly fixed-width, but more +% elegant, like the |fibo()| here. +% \end{document} +% \end{docshot} + % \section{Typesetting} % By the way, the package correctly formats low-height texts, for example, just @@ -196,10 +228,14 @@ % \changes{v0.4.0}{2022/01/09}{Package option \texttt{nobars} added.} % \changes{v0.6.0}{2021/11/14}{We use \texttt{pgfopts} instead of \texttt{xkeyval}.} % \changes{v0.6.0}{2021/11/14}{Package option \texttt{novert} added, to disable redefinition of vertical bar.} +% \changes{v0.7.0}{2021/11/28}{Package option \texttt{bold} added, to make all \texttt{\char`\\ff} pieces look bolder than usual.} +% \changes{v0.7.0}{2021/11/28}{Package option \texttt{sf} added, to make all \texttt{\char`\\ff} pieces be printed as \texttt{\char`\\sffamily}.} % \begin{macrocode} \RequirePackage{pgfopts} \pgfkeys{ /ff/.cd, + bold/.store in=\ff@bold, + sf/.store in=\ff@sf, nopygments/.store in=\ff@nopygments, noframes/.store in=\ff@noframes, nonumbers/.store in=\ff@nonumbers, @@ -271,7 +307,13 @@ % \changes{v0.5.1}{2022/10/30}{Now, the command \texttt{ff} ignores italic and bold and always prints \texttt{\char`\\texttt} as it should be.} % \begin{macrocode} \makeatletter -\newcommand\ff@print[1]{\textnormal{\texttt{#1}}} +\newcommand\ff@print[1]{% + \textnormal{% + \ifdefined\ff@sf\sffamily\else\ttfamily\fi% + \ifdefined\ff@bold\fontseries{b}\selectfont\fi% + #1% + }% +} \makeatother % \end{macrocode} % \end{macro} |