Skip to main content

Posts

Showing posts with the label LaTeX

Latex following Edward Tufte

I was putting some sparklines at an web app I am designing. I am using the "Sparkline PHP Graphing Library" which is a well written PHP library for generating the famous sparklines created by Edward Tufte . So I was wondering which another advice I could pick up from Master Tufte... I went googling arround for Edward Tufte and a bunch of links came up but, the one which most called my attention was a Tufte-inspired LaTeX class for producing handouts, papers, and books. The samples provided by the web site are really well designed.

Converting charset enconding of a bunch o .tex files

A friend of mine came to me asking for a simple way to convert the charset encoding of a bunch o LaTeX files. He had all his files in the UFT-8 encoding and he wanted to convert all of them to "latin-1" (ISO-8859-1). So, I saved all the files he sent me in the same folder, opened a terminal shell window and typed the following command line: ls -1 *.tex | while read line ; do iconv -f utf-8 -t iso-8859-1 $line -o "latin1_"$line; done And voilĂ  , they were now encoded with ISO-8859-1.

Pettry rendered LaTeX equations using PHP

When I was writing a simple scientific webapp, during my undergrads studies, I needed to generate some equations to be shown by the app. I was already familiar with LaTeX equation formatting syntax, so I decided to use this nice peace of software. So, after "googling" a little, I found the imgtex , written by Koji Nakamaru , which is a fast CGI script, written in perl. What I did, was port it to PHP. To run it, you must have a LaTeX distribution and the dvipng software both installed on the same machine which you will run the PHP script. Here is the PHP code: To use this code, you just have to pass the LaTeX commands through GET to the PHP. For example, adding the following string to your URL: http://localhost/imgtex.php?res=300&cmd=x=\frac{-b\pm\sqrt{-4ac}}{2a} The res variable sets the resolution for the generated image and the cmd specifies the LaTeX command. This way, the above URL will produce the following image: