Skip to content

Instantly share code, notes, and snippets.

View pgundlach's full-sized avatar
💭
Working on boxes and glue

Patrick Gundlach pgundlach

💭
Working on boxes and glue
View GitHub Profile
@pgundlach
pgundlach / eu2fxl.fd
Created March 27, 2010 16:27
EU2 encoding file for Linux Libertine
\ProvidesFile{eu2fxl.fd}[2010/03/05 v0.0 Font defs for Linux Libertine for LuaTeX's EU2 encoding]
\DeclareFontFamily{EU2}{fxl}{}
\DeclareFontShape{EU2}{fxl}{m}{n} { <-> "fxlr:+tlig;+tsub;+liga;+rlig;"}{}
\DeclareFontShape{EU2}{fxl}{m}{it} { <-> "fxlri:+tlig;+tsub;+liga;+rlig;"}{}
\DeclareFontShape{EU2}{fxl}{b}{n} { <-> "fxlb:+tlig;+tsub;+liga;+rlig;"}{}
\DeclareFontShape{EU2}{fxl}{b}{it} { <-> "fxlbi:+tlig;+tsub;+liga;+rlig;"}{}
\DeclareFontShape{EU2}{fxl}{m}{sl} { <-> "fxlri:+tlig;+tsub;+liga;+rlig;" }{}
\DeclareFontShape{EU2}{fxl}{bx}{n} { <-> "fxlb:+tlig;+tsub;+liga;+rlig;" }{}
\DeclareFontShape{EU2}{fxl}{bx}{it} { <-> "fxlbi:+tlig;+tsub;+liga;+rlig;"}{}
@pgundlach
pgundlach / beispiel.tex
Created April 3, 2010 19:56
Fontloader für LuaTeX (http://www.luatex.de)
\pdfadjustspacing=2
\directlua{
dofile("fontloader.lua")
}
\def\ladefont#1#2{\directlua{
local ok,f = define_font("#1",65536 * 12)
if ok then
local num = font.define(f)
@pgundlach
pgundlach / numbers2latex.scpt
Created May 1, 2010 14:43
numbers2latex table converter
-- Numbers to LaTeX converter
-- this small AppleScript takes the first table in the first sheet of the first
-- Numbers document and turns it into a LaTeX table (well, sort of).
-- It will be copied to the clipboard.
-- This is a 5-minute quick hack and mostly unsupported, but if you like it or
-- if you have any enhancements (not feature request :-)), plese send them to
-- gundlach <at> speedata.de
tell application "Numbers"
@pgundlach
pgundlach / viznodelist.lua
Last active January 10, 2022 01:43
LuaTeX nodelist visualization
--
-- viznodelist.lua
-- speedata publisher
--
-- Written 2010-2020 by Patrick Gundlach.
-- This file is released in the spirit of the well known MIT license
-- (see https://opensource.org/licenses/MIT for more information)
--
-- visualizes nodelists using graphviz
@pgundlach
pgundlach / myprogram.lua
Created July 3, 2011 07:41
Sample Lua Document to create a two page PDF document with hyperlinks
do
-- this will hold the items that go onto the page
local pagelist
-- Call tex.shipout() with the contents of the pagelist
function shipout()
local vbox,b = node.vpack(pagelist) -- we ignore the badness 'b'
tex.box[666] = vbox
tex.shipout(666)
@pgundlach
pgundlach / mkparagraph.lua
Created July 4, 2011 11:20
Small example of creating a node list and let TeX do the linebraking
function mknodes( text )
local current_font = font.current()
local font_parameters = font.getfont(current_font).parameters
local n, head, last
-- we should insert the paragraph indentation at the beginning
head = node.new("glue")
head.spec = node.new("glue_spec")
head.spec.width = 20 * 2^16
last = head
@pgundlach
pgundlach / emacs.pdf
Created September 8, 2011 11:39
ConTeXt refcard
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pgundlach
pgundlach / sample.tex
Created September 13, 2011 20:56
tex.se sample
\documentclass{article}
\begin{document}
\parindent = 2cm
\setlength{\parfillskip}{0pt plus\dimexpr\textwidth-2\parindent}
A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel.
The charm of existence in this spot, which was created for the bliss of souls like mine.
@pgundlach
pgundlach / ltxbarcode.lua
Created December 23, 2011 09:48
barcodes with LuaTeX
module(...,package.seeall)
local add_checksum_if_necessary, mkpattern, split_number, calculate_unit, pattern_to_wd_dp
function generate_barcode( str )
-- If we only pass 12 digits, the 13th will be added
str = add_checksum_if_necessary(str)
-- The smallest bar/gap is 1/7th the width of a digit.
@pgundlach
pgundlach / ltxbarcode.lua
Created March 14, 2012 10:25
Strichcodes mit LuaTeX
module(...,package.seeall)
local add_checksum_if_necessary, mkpattern, split_number, calculate_unit, pattern_to_wd_dp
function generate_barcode(str)
-- Wenn nur 12 Ziffern übergeben werden, fügen wir die 13 hinzu
str = add_checksum_if_necessary(str)
-- Die kleinste Lücke / Strich ist ein siebtel der Breite einer Ziffer und damit