Skip to content

Instantly share code, notes, and snippets.

@alexklapheke
alexklapheke / pdf-n-up-margins.sh
Created June 28, 2016 15:36
Trim PDF margins for linguistics papers
pdfnup --clip 'true' --trim '0.2in 0.65in 0.2in 0.4in' --delta '-0.3in 0in' $file # Springer
pdfnup --clip 'true' --trim '1.1in 1.0in 1.1in 1.0in' --delta '-0.4in 0in' $file # Sem & Prag
pdfnup --clip 'true' --trim '0.5in 0.7in 0.5in 0.4in' --delta '0.0in 0in' $file # Ling & Phil
pdfnup --clip 'true' --trim '0.45in 0.9in 0.45in 0.6in' --delta '-0.1in 0in' $file # LLCompass
pdfnup --clip 'true' --trim '0.5in 0.8in 0.4in 0.4in' --delta '-0.8in 0in' $file # Journal of Semantics
pdfnup --clip 'true' --trim '0.7in 0.9in 0.7in 0.5in' --delta '0.5in 0in' $file # Journal of fPhilosophy
pdfnup --clip 'true' --trim '0.8in 0.75in 0.8in 0.3in' --delta '0.25in 0in' $file # Blackwell
pdfnup --clip 'true' --trim '0.8in 0.9in 0.8in 0.4in' --delta '0.25in 0in' $file # Blackwell Handbooks
pdfnup --clip 'true' --trim '1.2in 1.0in 1.2in 1.4in' --delta '-0.2in 0in' $file # SALT
pdfnup --clip 'true' --trim '0.3in 0.6in 0.3in 0.35in' --delta '0.05in 0in' $file # Oxford UP
@alexklapheke
alexklapheke / Makefile
Last active January 8, 2023 17:05
Pandoc Makefile
templatedir = $(HOME)/.pandoc/templates
bibfile = $(HOME)/texmf/bibtex/bib/references.bib
template = custom
number = # --number-sections
toc = --toc
# For knitr:
# Rscript --slave -e "library(knitr);knit('test.Rmd')"
# Rscript --slave -e "library(knitr);pandoc('test.md')"
@alexklapheke
alexklapheke / .vimrc
Last active September 24, 2016 02:37
Minimal .vimrc
" Minimal .vimrc
" Author: Alex Klapheke
" Modified: 17 May 2016
" Paths:
" Unix: /home/alex/.vimrc /home/alex/.vim/
" OS X: /Users/Alex/.vimrc /Users/Alex/.vim/
" Windows: \Users\Alex\_vimrc \Users\Alex\vimfiles\
" Recommended plugins:
@alexklapheke
alexklapheke / q
Last active February 6, 2017 01:28
#!/usr/bin/env bash
# Copyright (C) 2016 Alexander Klapheke
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
@alexklapheke
alexklapheke / parallel.hs
Last active July 8, 2016 20:52
Pandoc filter for parallel texts
#!/usr/bin/runhaskell
import Text.Pandoc.JSON
-- Set parallel texts. Use a <div> for each pair of
-- paragraphs and a horizontal rule to divide them:
--
-- <div class="parallel">
-- Longtemps, je me suis couché de bonne heure.
--
-- * * * * *
--
@alexklapheke
alexklapheke / synsemtools.sty
Last active April 14, 2023 06:13
Some useful commands for syntax & semantics
%-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-%
% %
% Some useful commands for syntax & semantics %
% Author: Alex Klapheke (github/klapheke) %
% Updated: 26 Feb 2017 %
% Licence: GPL v2 %
% Installation: %
% 1. Place in ~/texmf/tex/latex/ %
% 2. $ texhash %
% %
@alexklapheke
alexklapheke / bopomofo.vim
Last active February 18, 2016 23:17
Vim Keymaps
" Vim keymap for Bopomofo. Type standard Pinyin to get its Bopomofo
" equivalent. Use an apostrophe to force the completion of a syllable
" (if not using tone marks). This is necessary for, say re'nao (熱鬧),
" which would be incorrectly rendered as ㄖㄣㄠ (ren'ao).
"
" Maintainer: Alex Klapheke <alexklapheke@gmail.com>
" Last Changed: December 22, 2015
scriptencoding utf-8
let b:keymap_name = "bopomofo"
@alexklapheke
alexklapheke / polish2infix.py
Last active April 2, 2016 22:37
Convert Łukasiewicz's Polish notation to standard logical infix notation.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: polish2infix.py
Author: Alexander Klapheke
Email: alexklapheke@gmail.com
Github: https://github.com/klapheke
Licence: MIT Licence