Skip to content

Instantly share code, notes, and snippets.

View phi-gamma's full-sized avatar
💤
Does nothing unless polled.

Philipp Gesang phi-gamma

💤
Does nothing unless polled.
View GitHub Profile
\unprotect
\let\@EA\expandafter%% Precaution in case Hans removes it.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% implementation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% We-F¢ll have a minimal setup macro as an interface.
\def\setupsortstructure{%
\dosingleempty\do_setup_sort_structure%
}
@phi-gamma
phi-gamma / word_count.lua
Created May 6, 2012 13:03
Word count with LuaTEX
packagedata = packagedata or { } -- namespace proposal for packages
local word_count = { threshold = 3, }
packagedata.word_count = packagedata.word_count or word_count
dofile(kpse.find_file"char-def.lua") -- unicode tables
dofile(kpse.find_file"lualibs-table.lua") -- old Context table code
local utf = unicode.utf8
local node = node
local type = type
@phi-gamma
phi-gamma / whatever.tex
Created May 16, 2012 11:43
flushleft structure numbers
\setuphead [chapter,section] [alternative=leftalignmargin]
\setupmargindata [left] [align=flushleft]
\setuplayout [leftmargin=1cm]
\unprotect
%%% simplified from strc-ren.mkiv
\unexpanded\def\placeheadleftalignmarginalternative#1#2{%
\vbox{%
\localheadsetup\begstrut\dontleavehmode
\ifconditional\headshownumber\inleftmargin{#1}\fi
{#2}%
@phi-gamma
phi-gamma / PKGBUILD
Created May 19, 2012 14:05
PKGBUILD for polipo-git
# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.
# See http://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines
# for more information on packaging from GIT sources.
# Maintainer: Your Name <jhernberg@alchemy.lu>
pkgname=polipo-git
@phi-gamma
phi-gamma / structure_images.tex
Created June 7, 2012 13:28
refined structure fullsize image macros
% macros=mkvi
%
% pretty dummy graphics
\useMPlibrary
[dum]
% fake text
\usemodule
[visual]
@phi-gamma
phi-gamma / features.wiki
Created June 16, 2012 13:02
it’s not a bug, it’s a feature! -- section for the ConTeXt wiki

If ConTeXt appears to behave in a counterintuitive way, chances are that it’s actually your intuitions that lack calibration.

Controlling Page Break Before Headings

If you add the option page=yes to a heading setup, this will cause ConTeXt to break the page. Ordinarily this works as expected, unless, however, the heading immediately follows a previous section with no text in between. The rationale behind this is that consecutive headings are conceived of collectively as one single structural element.

@phi-gamma
phi-gamma / test.tex
Created August 3, 2012 12:25
Adobe Source Pro for ConTeXt
\def\lorem#1{%
\bgroup
\type{#1}\hskip\emwidth
#1
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.\par
\egroup
}
\def\weights{\sans,\italic,\bold,\bolditalic}
% macros=mkvi
\unprotect
%% 1. Declare a counter and increment it with every paragraph start.
\newcount\parcount \parcount0
\appendtoks \advance\parcount1 \to \everypar
\startluacode
local context = context
local jobdatasets = job.datasets
@phi-gamma
phi-gamma / stylealt.tex
Created October 17, 2012 14:26
[example] basic style handler usage (for ConTeXt wiki)
% macros=mkvi
\unprotect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\installnamespace {look}
\installcommandhandler \????look {look} \????look
\appendtoks
\setuevalue{\currentlook}{\do_look{\currentlook}}
\to \everydefinelook
@phi-gamma
phi-gamma / test-blank.tex
Last active December 15, 2015 17:59
ConTeXt MkIV typescript for the Adobe Blank font.
\def\lorem#1{%
\bgroup
\type{#1}\hskip\emwidth
#1
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.\par
\egroup
}
\def\weights{\sans,\italic,\bold,\bolditalic}