summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ffcode
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/ffcode')
-rw-r--r--macros/latex/contrib/ffcode/DEPENDS.txt2
-rw-r--r--macros/latex/contrib/ffcode/README.md9
-rw-r--r--macros/latex/contrib/ffcode/ffcode.dtx201
-rw-r--r--macros/latex/contrib/ffcode/ffcode.ins8
-rw-r--r--macros/latex/contrib/ffcode/ffcode.pdfbin395644 -> 487461 bytes
5 files changed, 71 insertions, 149 deletions
diff --git a/macros/latex/contrib/ffcode/DEPENDS.txt b/macros/latex/contrib/ffcode/DEPENDS.txt
index 52a46fbc48..935840f850 100644
--- a/macros/latex/contrib/ffcode/DEPENDS.txt
+++ b/macros/latex/contrib/ffcode/DEPENDS.txt
@@ -1,5 +1,3 @@
hard xkeyval
hard minted
hard tcolorbox
-hard pgf
-hard environ
diff --git a/macros/latex/contrib/ffcode/README.md b/macros/latex/contrib/ffcode/README.md
index fe0332ddfe..f62fa0aa99 100644
--- a/macros/latex/contrib/ffcode/README.md
+++ b/macros/latex/contrib/ffcode/README.md
@@ -23,11 +23,10 @@ void r() {
\end{document}
```
-The full example and all commands are available in the
-[`ffcode.tex`](https://github.com/yegor256/ffcode/blob/master/ffcode.tex) file.
+Otherwise, you can download [`ffcode.sty`](https://raw.githubusercontent.com/yegor256/ffcode/gh-pages/ffcode/ffcode.sty) and add to your project.
-If you want to contribute yourself, make a fork, then create a branch,
-then run `make` in the root directory.
+If you want to contribute yourself, make a fork, then create a branch,
+then run `l3build ctan` in the root directory.
It should compile everything without errors. If not, submit an issue and wait.
-Otherwise, make your changes and then run `make` again. If the build is
+Otherwise, make your changes and then run `l3build ctan` again. If the build is
still clean, submit a pull request.
diff --git a/macros/latex/contrib/ffcode/ffcode.dtx b/macros/latex/contrib/ffcode/ffcode.dtx
index c6d717c7b5..e3c430c8de 100644
--- a/macros/latex/contrib/ffcode/ffcode.dtx
+++ b/macros/latex/contrib/ffcode/ffcode.dtx
@@ -50,18 +50,20 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{ffcode}
%<*package>
-[03.10.2022 0.5.0 Fixed Font Code]
+[2022-10-30 0.5.1 Fixed Font Code]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage[tt=false,type1=true]{libertine}
\usepackage{microtype}
+\AddToHook{env/verbatim/begin}{\microtypesetup{protrusion=false}}
\usepackage{href-ul}
\usepackage{ffcode}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{xcolor}
+\usepackage[dtx,runs=2]{docshots}
\PageIndex
\EnableCrossrefs
\CodelineIndex
@@ -86,86 +88,51 @@
% and make sure it looks nice. Install it from CTAN and then
% use like this (pay attention to |\ff| command
% and |ffcode| environment):
-% \begin{multicols}{2}
-% \setlength{\parskip}{0pt}
-% \raggedcolumns
-%\iffalse
-%<*verb>
-%\fi
-\begin{verbatim}
-\documentclass{article}
-\usepackage{ffcode}
-\begin{document}
-The function \ff{fibo()}
-is recursive:
-\begin{ffcode}
-int fibo(int n) {
- if (n < 2) {
- return n; |$\label{ln:ret}$|
- }
- return fibo(n-1)+fibo(n-2);
-}
-\end{ffcode}
-The line no.~\ref{ln:ret}
-terminates it.
-\end{document}
-\end{verbatim}
-%\iffalse
-%</verb>
-%\fi
-%
-% \columnbreak
-%
-% The function \ff{fibo()} is recursive:
-%
-%\iffalse
-%<*verb>
-%\fi
-\begin{ffcode}
-int fibo(int n) {
- if (n < 2) {
- return n; |$\label{ln:ret}$|
- }
- return fibo(n-1)+fibo(n-2);
-}
-\end{ffcode}
-%\iffalse
-%</verb>
-%\fi
-%
-% The line no.~\ref{ln:ret} terminates it.
-% \end{multicols}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{ffcode}
+% \pagestyle{empty}
+% \begin{document}
+% The function \ff{fibo()}
+% is recursive:
+% \begin{ffcode}
+% int fibo(int n) {
+% if (n < 2) {
+% return n; |$\label{ln:ret}$|
+% }
+% return fibo(n-1)+fibo(n-2);
+% }
+% \end{ffcode}
+% The line no.~\ref{ln:ret}
+% terminates it.
+% \end{document}
+% \end{docshot}
% \section{Package Options}
-% \begin{macro}{nopygments}
+% \DescribeMacro{nopygments}
% You have to run |pdflatex| with |--shell-escape| flag
% in order to let |minted| (the package we use) to run Pygments
% and format the code. If you don't want this to happen,
% just use |nopygments| option.
-% \end{macro}
-% \begin{macro}{noframes}
+% \DescribeMacro{noframes}
% If you want to omit the light gray frames around |\ff|
% texts, use the package option |noframes|.
-% \end{macro}
-% \begin{macro}{nobars}
+% \DescribeMacro{nobars}
% To omit the vertical gray bar at the left side of each snippet,
% use |nobars| option of the package.
-% \end{macro}
-% \begin{macro}{nonumbers}
+% \DescribeMacro{nonumbers}
% To omit the line numbers, use |nonumbers| option of the package.
-% \end{macro}
-% \begin{macro}{nocn}
+% \DescribeMacro{nocn}
% By default, the numbering is continuous: line numbers start at the
% first snippet and increment until the end of the document. If you
% want them to start from one at each snippet, use |nocn|
% (stands for ``no continuous numbering'')
% option of the package.
-% \end{macro}
% \section{Typesetting}
@@ -178,86 +145,40 @@ int fibo(int n) {
% The command |\ff| behaves differently in math mode --- it doesn't
% add gray frames:
-% \begin{multicols}{2}
-% \setlength{\parskip}{0pt}
-% \raggedcolumns
-%\iffalse
-%<*verb>
-%\fi
-\begin{verbatim}
-\documentclass{article}
-\usepackage{ffcode}
-\begin{document}
-\begin{equation}
-x = \int_\ff{home}^N f(x).
-\end{equation}
-\end{document}
-\end{verbatim}
-%\iffalse
-%</verb>
-%\fi
-%
-% \columnbreak
-%
-%\iffalse
-%<*verb>
-%\fi
-% \begin{equation}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage{ffcode}
+% \usepackage{mathtools}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{equation*}
% x = \int_\ff{home}^N f(x).
-% \end{equation}
-%\iffalse
-%</verb>
-%\fi
-% \end{multicols}
+% \end{equation*}
+% \end{document}
+% \end{docshot}
% \section{Line Highlighting}
% You can highlight some lines in your |ffcode| environment,
% or can use any other additional configuration parameters from
% |minted| package:
-
-% \begin{multicols}{2}
-% \setlength{\parskip}{0pt}
-% \raggedcolumns
-%\iffalse
-%<*verb>
-%\fi
-\begin{verbatim}
-\documentclass{article}
-\usepackage{ffcode}
-\begin{document}
-\begin{ffcode*}
- {highlightlines={1,4-5}}
-while (true) {
- print("Hello!")
- print("Enter your name:")
- scan(x)
- print("You name is " + x)
-}
-\end{ffcode*}
-\end{document}
-\end{verbatim}
-%\iffalse
-%</verb>
-%\fi
-%
-% \columnbreak
-%
-%\iffalse
-%<*verb>
-%\fi
-\begin{ffcode*}{highlightlines={7,10-11}}
-while (true) {
- print("Hello!")
- print("Enter your name:")
- scan(x)
- print("You name is " + x)
-}
-\end{ffcode*}
-%\iffalse
-%</verb>
-%\fi
-% \end{multicols}
+% \begin{docshot}
+% \documentclass{article}
+% \usepackage[paperwidth=3in]{geometry}
+% \usepackage{ffcode}
+% \pagestyle{empty}
+% \begin{document}
+% \begin{ffcode*}
+% {highlightlines={1,4-5}}
+% while (true) {
+% print("Hello!")
+% print("Enter your name:")
+% scan(x)
+% print("You name is " + x)
+% }
+% \end{ffcode*}
+% \end{document}
+% \end{docshot}
% Using this second argument of |ffcode*| (with the trailing asterisk),
% you can provide any other options from |minted| package to the
@@ -266,8 +187,7 @@ while (true) {
% \StopEventually{}
% \section{Implementation}
-
-% \changes{v0.2.0}{2021/07/10}{Initial version}
+% \changes{v0.1.0}{2021/06/10}{Initial version}
% First, we parse package options:
% \begin{macrocode}
@@ -276,10 +196,14 @@ while (true) {
\DeclareOptionX{nopygments}{\PassOptionsToPackage{draft=true}{minted}}
\newif\ifff@noframes
\DeclareOptionX{noframes}{\ff@noframestrue}
+% \changes{v0.4.0}{2022/01/09}{Package option "nobars" added.}
\newif\ifff@nobars
\DeclareOptionX{nobars}{\ff@nobarstrue}
+% \changes{v0.2.0}{2021/06/13}{Package options "nonumbers"
+% and "noframes" added.}
\newif\ifff@nonumbers
\DeclareOptionX{nonumbers}{\ff@nonumberstrue}
+% \changes{v0.3.0}{2021/09/07}{Package option "nocn" added.}
\newif\ifff@nocn
\DeclareOptionX{nocn}{\ff@nocntrue}
\ProcessOptionsX\relax
@@ -306,7 +230,7 @@ while (true) {
framerule=1pt,rulecolor=gray,frame=leftline}
\fi
\else
- \renewcommand{\theFancyVerbLine}{\textcolor{gray}
+ \renewcommand{\theFancyVerbLine}{\textcolor{gray}%
{\tiny\oldstylenums{\ttfamily\arabic{FancyVerbLine}}}}
\ifff@nocn
\ifff@nobars
@@ -337,10 +261,11 @@ while (true) {
% \begin{macro}{\ff@print}
% Then, we define supplementary commands |\ff@print| and |\ff@printx|:
+% \changes{v0.5.1}{2022/10/30}{Now, the command "ff" ignores italic and bold and always prints "texttt" as it should be.}
% \begin{macrocode}
\makeatletter
\newcommand\ff@print{\begingroup\obeyspaces\ff@printx}
-\newcommand\ff@printx[1]{\texttt{#1}\endgroup}
+\newcommand\ff@printx[1]{\textnormal{\texttt{#1}}\endgroup}
\makeatother
% \end{macrocode}
% \end{macro}
@@ -368,7 +293,7 @@ while (true) {
\newcommand\ff[1]{\relax\ifmmode%
{\ff@rule\ff@print{#1}}%
\else%
- {\ff@box{\ff@rule\ff@print{#1}}}
+ {\ff@box{\ff@rule\ff@print{#1}}}%
\fi}
\fi\makeatother
% \end{macrocode}
diff --git a/macros/latex/contrib/ffcode/ffcode.ins b/macros/latex/contrib/ffcode/ffcode.ins
index 758b0a2a81..9e7c56593e 100644
--- a/macros/latex/contrib/ffcode/ffcode.ins
+++ b/macros/latex/contrib/ffcode/ffcode.ins
@@ -48,8 +48,8 @@ SOFTWARE.
\endpreamble
\generate{\file{ffcode.sty}{\from{ffcode.dtx}{package}}}
\obeyspaces
-\Msg{*** To finish the installation you have to move the ".sty"}
-\Msg{*** file into a directory searched by TeX. To produce the}
-\Msg{*** documentation run the file ".dtx" through LaTeX. If any}
-\Msg{*** questions, submit a new GitHub issue.}
+\Msg{To finish the installation you have to move the ".sty"}
+\Msg{file into a directory searched by TeX. To produce the}
+\Msg{documentation run the file ".dtx" through LaTeX. If any}
+\Msg{questions, submit a new GitHub issue.}
\endbatchfile
diff --git a/macros/latex/contrib/ffcode/ffcode.pdf b/macros/latex/contrib/ffcode/ffcode.pdf
index 1533df9d95..a24f23e4b0 100644
--- a/macros/latex/contrib/ffcode/ffcode.pdf
+++ b/macros/latex/contrib/ffcode/ffcode.pdf
Binary files differ