• No results found

ffcode : L A TEX Package for Fixed-Font Code Blocks

N/A
N/A
Protected

Academic year: 2021

Share "ffcode : L A TEX Package for Fixed-Font Code Blocks"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

ffcode : L A TEX Package for Fixed-Font Code Blocks

Yegor Bugayenko 0.3.2 2021/09/13

This package helps you write source code in your articles and make sure it looks nice. Install it from CTAN and then use like this (pay attention to the \ff command and the ffcode environment):

\documentclass{article}

\usepackage[T1]{fontenc}

\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~\ref{ln:ret} terminates it.

\end{document}

The function fibo() is recursive:

1

int fibo(int n) {

2

if (n < 2) {

3

return n;

4

}

5

return fibo(n - 1) + fibo(n - 2);

6

}

The line no. 3 terminates it.

You have to run pdflatex with the –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 the nopygments option.

A pair of vertical lines decorate a TeX command inside the snippet. If you want to print a single vertical line, use this: |\vert| .

If you want to omit the light gray frames around \ff texts, use the package option noframes .

To omit the line numbers, use the nonumbers option of the package.

(2)

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.

You can highlight some lines in your ffcode environment, or can use any other additional configuration parameters from the minted package:

\begin{ffcode*}{highlightlines={1,4-5}}

while (true) { print("Hello!")

print("Enter your name:") scan(x)

print("You name is " + x) }

\end{ffcode*}

7

while (true) {

8

print("Hello!")

9

print("Enter your name:")

10

scan(x)

11

print("You name is " + x)

12

}

Using this second argument of the ffcode* (with the trailing asterisk), you can provide any other options from the minted package to the snippet.

By the way, the package correctly formats low-height texts, for example, just a dot: .

More details about this package you can find in the yegor256/ffcode GitHub

repository.

Referenties

GERELATEERDE DOCUMENTEN

(In a shooting script, each new camera angle is considered a scene, so the scene lines in the middle of a sequence often simply indicate the main subject of the shot, such as

A nightclub is about to offer its regulars the option of having a microchip implanted in their arm that will make it no longer necessary to carry cash or plastic.. 2 Queuing for

Several issues arise when typesetting these particle names in standard L A TEX: for starters the requirement of sub- and super-scripts and the need to use Greek symbols forces us

The main features of the package are somewhat similar to SageTeX 1 , but here we use Wolfram Language (Mathematica) instead of Sage.. If you have any questions or comments, you

However, remember that texsurgery is a python project whose main focus is on evaluating code inside a jupyter kernel, and this is only achieved by installing the python package

I also would like to thank the devel- oper teams of TeX’s friends especially LaTeX, LuaTeX and XeTeX teams... [12] Package xetexref: Will Robertson, Khaled Hosny, and Karl Berry, X

Since with this option kashida glyph leaders are used to stretch the text, nothing is saved in .aux files.

Since it is sometimes necessary to be able to typeset the glyphs representing the ASCII control characters (typically in programming or interface documents), we have created a new