November 3, 2011 at 2:40 pm
· Filed under Uncategorized
By default, paredit in the Clojure slime-repl doesn’t properly handle literal vectors and maps. This little snippet of elisp seems to fix it.
(defun fix-paredit-repl ()
(interactive)
(local-set-key "{" 'paredit-open-curly)
(local-set-key "}" 'paredit-close-curly)
(modify-syntax-entry ?\{ "(}")
(modify-syntax-entry ?\} "){")
(modify-syntax-entry ?\[ "(]")
(modify-syntax-entry ?\] ")["))
Permalink
June 15, 2011 at 12:58 pm
· Filed under LaTeX
I wanted LaTeX newcommand/renewcommand definitions to show up in the Textmate symbol list, so I could use the Cmd-Shift-T shortcut to jump to them. To accomplish this, I first went to the “LaTeX Language” entry in the bundle editor, and added this block to the “patterns” section:
{ name = 'latex.definition';
match = '(\\)(newcommand|renewcommand)\{[^\}]+\}';
}
Then, I created a new LaTeX Preference with scope selector “latex.definition”, and contents:
{ showInSymbolList = 1;
symbolTransformation = '
s/^\\(newcommand|renewcommand)\{\\(.+)\}/$2/;';
}
Permalink
April 12, 2011 at 3:00 pm
· Filed under Uncategorized
Many academic conferences require that you submit PDF files with all fonts properly embedded. Making sure this happens for your LaTeX document using pdflatex is not difficult. However, some programs used to create figures don’t have an option to embed fonts, and when these figures are included in your LaTeX document, your final PDF ends up short a few fonts.
I’m sure there’s a more elegant way to solve this, but when I last faced it a few years ago, I hacked together an ugly shell script that converts the PDF to PS to EPS back to PDF again. I don’t recall why all these steps were necessary, but at the time this was the quickest thing I could find that worked:
#!/bin/bash
export GS_OPTIONS='-dEmbedAllFonts=true -dPDFSETTINGS=/printer'
cp $1 $1.old
pdftops $1 tmp.ps
ps2eps tmp.ps
epstopdf tmp.eps
mv tmp.pdf $1
rm tmp.ps tmp.eps
As you can see here, it successfully embeds the fonts in a pdf file, without increasing the file size too much. And each of the conversion steps should be lossless, so the final pdf looks exactly the same as the input:
jawolfe@[~/Projects/reports/11-ijcai/graphs]: pdffonts independent.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Helvetica Type 1 no no no 7 0
Symbol Type 1 no no no 8 0
jawolfe@[~/Projects/reports/11-ijcai/graphs]: ./fixfonts independent.pdf
... (ignore the error messages)
jawolfe@[~/Projects/reports/11-ijcai/graphs]: ls -l
total 72
-rwxr--r--@ 1 jawolfe admin 173 Apr 12 15:45 fixfonts*
-rw-r--r-- 1 jawolfe admin 9642 Apr 12 15:45 independent.pdf
-rw-r--r-- 1 jawolfe admin 4102 Apr 12 15:45 independent.pdf.old
jawolfe@[~/Projects/reports/11-ijcai/graphs]: pdffonts independent.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
QHKFIS+Helvetica Type 1C yes yes no 8 0
ONFWFL+Symbol Type 1C yes yes no 10 0
Permalink