Friday, November 26, 2010
Roll your own Ubuntu with UCK
Ubuntu Customization Kit lets you build your own Ubuntu install CD. Read more http://www.tuxradar.com/content/build-your-own-linux-distribution-easy-way
Friday, October 29, 2010
Simple LaTeX build and preview or "How I learned to stop worrying and love latexmk"
I have always loved LaTeX and liked latexmk to manage the compiling. latexmk checks to be sure that the proper compilers are run an appropriate number of times.
I also knew that it could be used with the -pvc option that leaves it in "continuous preview mode" which means it monitors the file and everytime you save it it recompiles automatically. This is a cool feature but it involved initializing a previewer that would check to refresh itself and I never gave it enough time to get it working.
Just tonight though I learned that latexmk can also have a configuration file in your home folder (i.e. ~ or /home/yourname) which can have all the necessary information for this setup all ready to go.
In your home folder create a file called ".latexmkrc" (no quotes). In it, put exactly this:
Of course you need to be sure that you have a LaTeX environment installed as well as the latexmk script and xpdf. I recommend using the latexmk that is available from CTAN rather than the one in your package manager (in fact I always manage my own LaTeX implementation, its not hard using the tools available from CTAN and using the tlmgr script included with TeXlive).
Anyway when you run latexmk yourfile.tex (yep you don't even need to use -pdf), it will compile and open xpdf to preview. Then the next time you save your document in your editor, the previewer will automatically reflect the saved (and compiled!) changes.
Cool eh?
NB: This might finally be the thing that finally breaks me of my old editor TeXlipse (still awesome, but might not play well with other things that change the workspace).
I also knew that it could be used with the -pvc option that leaves it in "continuous preview mode" which means it monitors the file and everytime you save it it recompiles automatically. This is a cool feature but it involved initializing a previewer that would check to refresh itself and I never gave it enough time to get it working.
Just tonight though I learned that latexmk can also have a configuration file in your home folder (i.e. ~ or /home/yourname) which can have all the necessary information for this setup all ready to go.
In your home folder create a file called ".latexmkrc" (no quotes). In it, put exactly this:
$pdf_mode = 1;
$preview_continuous_mode = 1;
$pdf_previewer = "start xpdf -remote %R %O %S";
$pdf_update_method = 4;
$pdf_update_command = "xpdf -remote %R -reload";
Of course you need to be sure that you have a LaTeX environment installed as well as the latexmk script and xpdf. I recommend using the latexmk that is available from CTAN rather than the one in your package manager (in fact I always manage my own LaTeX implementation, its not hard using the tools available from CTAN and using the tlmgr script included with TeXlive).
Anyway when you run latexmk yourfile.tex (yep you don't even need to use -pdf), it will compile and open xpdf to preview. Then the next time you save your document in your editor, the previewer will automatically reflect the saved (and compiled!) changes.
Cool eh?
NB: This might finally be the thing that finally breaks me of my old editor TeXlipse (still awesome, but might not play well with other things that change the workspace).
Wednesday, October 6, 2010
ruby script "cheat" for cheat sheets
If you find yourself looking for cheat sheets for all your programming needs try the little gem "cheat". Note that for Ubuntu (this blog features mostly Ubuntu specific instructions) you need to symlink cheat into /usr/bin/. Install ruby and gems if not already installed first.
Then lets say you just can't remember that Perl special variable so you can just do:
and see what you get!
$ sudo apt-get install ruby1.8 rubygems1.8
$ sudo gem install cheat
$ sudo ln -s /var/lib/gems/1.8/bin/cheat /usr/bin/
Then lets say you just can't remember that Perl special variable so you can just do:
$ cheat perl
and see what you get!
Tuesday, October 5, 2010
Ubuntu Maverick TERM variable
So on going up to Maverick Meerkat, I discovered that Tilda (my perferred terminal emulator) was suddenly throwing wierd errors, i.e. on running "clear" rather than a blank terminal window, I get "TERM environment variable not set."
The problem seems to affect many terminal emulators but the solution is simple, as I posted on a bug tracker:
On Ubuntu I think the easiest way to fix this problem, both workaround and packaged as a solution, is to make a simple script in /etc/profile.d/ . I called mine set_term.sh (must end in .sh). The file need only have in itexport TERM=xtermand then either run "source /etc/profile" or reboot. This will set the $TERM variable for all users on each boot without hardcoding the variable as some of the other programs I listed above have done. In one command, for those who need it run:echo "export TERM=xterm" | sudo tee /etc/profile.d/set_term.sh && source /etc/profile
Monday, September 27, 2010
Zenity for popups to user
After ssh-ing in then export DISPLAY=:X where X is the user display, then zenity is a program that can display GTK popups to the user in question. Fun for the whole family.
Friday, September 10, 2010
Inkscape's PDF+LaTeX
Holy crap this is excellent. I have been looking for a way to use SVG in LaTeX and this is better than I could have hoped for, I don't get to \includegraphics{myfile.svg} but when I include the PDF that Inkscape generates it can have LaTeX source for text!
I found this from an ubuntuforums post. It has in it this link to a PDF on Inkscape's site which gives the usage and some extras. The Inkscape wiki page is here.
I would still like to directly use SVG images but oh well. Eventually when I can get a good TikZ exporter from an SVG editor this may all be moot, but for now this is excellent.
Tuesday, December 15, 2009
Batch convert PNG to EPS
I like to produce documents in LaTeX, but I like to get the output in PDF. Luckily there is pdflatex which does this quite nicely. Unfortunately latex (using eps images) and pdflatex (using many other formats) cannot use the same image files. Therefore as I am trying to publish a paper in a journal, and they want eps images, I need to convert all my png to eps.
In trying to find a converter that does this nicely, I have found many things that don't do it exactly right. However I found a script by Thomas Henlich that will use several converters and creates great output. You can get it from his site here.
To do all the rest of the dirty work of converting everything in one directory in png format to another in eps I created this script. You need to have perl to run the script. You need Henlich's script (in your $PATH) and you need its dependancies. Be sure that it is executable and follow its directions. Hopefully it helps.
In trying to find a converter that does this nicely, I have found many things that don't do it exactly right. However I found a script by Thomas Henlich that will use several converters and creates great output. You can get it from his site here.
To do all the rest of the dirty work of converting everything in one directory in png format to another in eps I created this script. You need to have perl to run the script. You need Henlich's script (in your $PATH) and you need its dependancies. Be sure that it is executable and follow its directions. Hopefully it helps.
Subscribe to:
Posts (Atom)