summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ffcode
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-06-14 03:01:12 +0000
committerNorbert Preining <norbert@preining.info>2021-06-14 03:01:12 +0000
commit269940e8e52b921a855083542b9e1109af49af09 (patch)
treeba8b7431f6e4878661215e5a6127aba941f5d711 /macros/latex/contrib/ffcode
parent2ba4b1ac7860085c0b259aacb0d99bd2c730edbc (diff)
CTAN sync 202106140301
Diffstat (limited to 'macros/latex/contrib/ffcode')
-rw-r--r--macros/latex/contrib/ffcode/README.md3
-rw-r--r--macros/latex/contrib/ffcode/ffcode.pdfbin107272 -> 108113 bytes
-rw-r--r--macros/latex/contrib/ffcode/ffcode.sty32
-rw-r--r--macros/latex/contrib/ffcode/ffcode.tex21
4 files changed, 37 insertions, 19 deletions
diff --git a/macros/latex/contrib/ffcode/README.md b/macros/latex/contrib/ffcode/README.md
index 1c95d6ece3..f6944deee4 100644
--- a/macros/latex/contrib/ffcode/README.md
+++ b/macros/latex/contrib/ffcode/README.md
@@ -2,7 +2,8 @@
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/ffcode/blob/master/LICENSE.txt)
This LaTeX package helps you write source code in your academic papers
-and make sure it looks neat.
+and make sure it looks neat. The package uses [`minted`](https://ctan.org/pkg/minted)
+and [`tcolorbox`](https://ctan.org/pkg/tcolorbox) packages.
First, [install it](https://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages)
from [CTAN](https://ctan.org/pkg/ffcode)
diff --git a/macros/latex/contrib/ffcode/ffcode.pdf b/macros/latex/contrib/ffcode/ffcode.pdf
index ee829bd037..9e84d15f60 100644
--- a/macros/latex/contrib/ffcode/ffcode.pdf
+++ b/macros/latex/contrib/ffcode/ffcode.pdf
Binary files differ
diff --git a/macros/latex/contrib/ffcode/ffcode.sty b/macros/latex/contrib/ffcode/ffcode.sty
index 280bc58bd8..f478a0b5d6 100644
--- a/macros/latex/contrib/ffcode/ffcode.sty
+++ b/macros/latex/contrib/ffcode/ffcode.sty
@@ -21,12 +21,16 @@
% SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ffcode}[2021/06/10 0.1.0 Fixed Font Code]
+\ProvidesPackage{ffcode}[2021/06/13 0.2.0 Fixed Font Code]
\RequirePackage{microtype}
\RequirePackage{xkeyval}
\newif\ifnopygments
\DeclareOptionX{nopygments}{\nopygmentstrue}
+\newif\ifnoframes
+\DeclareOptionX{noframes}{\noframestrue}
+\newif\ifnonumbers
+\DeclareOptionX{nonumbers}{\nonumberstrue}
\ProcessOptionsX\relax
\ifnopygments
@@ -36,15 +40,23 @@
\fi
\setminted{breaklines}
\usemintedstyle{bw}
-\renewcommand{\theFancyVerbLine}{\textcolor{gray}{\tiny\oldstylenums{\ttfamily\arabic{FancyVerbLine}}}}
-\newminted[ffcode]{text}{firstnumber=last,linenos,numbersep=2pt,framesep=6pt,framerule=1pt,
- rulecolor=gray,frame=leftline,escapeinside=||,mathescape}
+\ifnonumbers
+ \newminted[ffcode]{text}{framesep=6pt,framerule=1pt,rulecolor=gray,frame=leftline,escapeinside=||,mathescape}
+\else
+ \renewcommand{\theFancyVerbLine}{\textcolor{gray}{\tiny\oldstylenums{\ttfamily\arabic{FancyVerbLine}}}}
+ \newminted[ffcode]{text}{firstnumber=last,linenos,numbersep=2pt,framesep=6pt,framerule=1pt,
+ rulecolor=gray,frame=leftline,escapeinside=||,mathescape}
+\fi
-\RequirePackage{tcolorbox}
- \newtcbox{\codebox}{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]{\codebox{\vrule height 6pt depth 1pt width 0pt\texttt{#1}}}
+\ifnoframes
+ \newcommand{\ff}[1]{\vrule height 6pt depth 1pt width 0pt\texttt{#1}}
+\else
+ \RequirePackage{tcolorbox}
+ \newtcbox{\codebox}{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]{\codebox{\vrule height 6pt depth 1pt width 0pt\texttt{#1}}}
+\fi
\endinput
diff --git a/macros/latex/contrib/ffcode/ffcode.tex b/macros/latex/contrib/ffcode/ffcode.tex
index dcefc53268..e14a39517f 100644
--- a/macros/latex/contrib/ffcode/ffcode.tex
+++ b/macros/latex/contrib/ffcode/ffcode.tex
@@ -27,11 +27,10 @@
\usepackage{ffcode}
\title{\ff{ffcode}: \LaTeX{} Package \\ for Fixed-Font Code Blocks}
\author{Yegor Bugayenko}
-\date{0.1.0 2021/06/10}
+\date{0.2.0 2021/06/13}
\begin{document}
\pagenumbering{gobble}
\raggedbottom
-\setlength{\topskip}{0mm}
\setlength{\parindent}{0pt}
\setlength{\columnsep}{32pt}
\setlength{\parskip}{6pt}
@@ -46,12 +45,13 @@ and the \ff{ffcode} environment):
\setlength{\parskip}{0pt}
\scriptsize
\raggedcolumns
-\begin{verbatim}\documentclass{article}
+\begin{verbatim}
+\documentclass{article}
\usepackage{ffcode}
\begin{document}
The function \ff{fibo()} is recursive:
\begin{ffcode}
-void fibo(int n) {
+int fibo(int n) {
if (n < 2) {
return n; |$\label{ln:ret}$|
}
@@ -67,15 +67,15 @@ The line~\ref{ln:ret} terminates it.
The function \ff{fibo()} is recursive:
\begin{ffcode}
-void fibo(int n) {
- if (n < 2) { |$\label{ln:ret}$|
- return n;
+int fibo(int n) {
+ if (n < 2) {
+ return n; |$\label{ln:ret}$|
}
return fibo(n - 1) + fibo(n - 2);
}
\end{ffcode}
-The line~\ref{ln:ret} terminates it.
+The line no.~\ref{ln:ret} terminates it.
\end{multicols}
You have to run \ff{pdflatex} with the \ff{--shell-escape} flag
@@ -83,6 +83,11 @@ in order to let \ff{minted} (the package we use) to run Pygments
and format the code. If you don't want this to happen,
just use the \ff{nopygments} option.
+If you want to omit the light gray frames around \ff{\char`\\ff}
+texts, use the package option \ff{noframes}.
+
+To omit the line numbers, use the \ff{nonumbers} option of the package.
+
More details about this package you can find
in the \ff{yegor256/ffcode} GitHub repository.