Friday, July 24, 2015

bash split pdf

$ sudo apt-get update
$ sudo apt-get install pdftk
EDIT: since pdftk became deprecated, do:
sudo snap install pdftk

Then, to make a new pdf with just pages 1, 2, 4, and 5 from the old pdf, do this:

$ pdftk myoldfile.pdf cat 1 2 4 5 output mynewfile.pdf
Note that cat and output are special pdftk keywords. cat specifies the operation to perform on the input file. output signals that what follows is the name of the output pdf file.
You can specify page ranges like this:
$ pdftk myoldfile.pdf cat 1-2 4-5 output mynewfile.pdf 
 
http://linuxcommando.blogspot.ca/2013/02/splitting-up-is-easy-for-pdf-file.html 

Find LaTeX multiply-defined labels

perl -nE 'say $1 if /(\\label[^}]*})/' *.tex | sort | uniq -c | sort -n
 
 http://www.mawode.com/blog/blog/2012/03/21/finding-duplicate-latex-labels/

Thursday, July 9, 2015

MATLAB uniform ticks (uniformticks) and printing

The following script can make the axes nicer. Example:

%% render uniform ticks digits on Y axis
function uniformticks_y(deci) ; % input number of decimals as string
command = ['%0.' mat2str(deci) 'f|'] ;
ticks = get(gca, 'Ytick') ;
set(gca, 'YTickLabel', sprintf(command, ticks));

However, changing the graph manually in the GUI can upset the nice axes settings. Simply rerun the script from the console without closing the graphs.