Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Wednesday, July 21, 2010

Miktex Portable Version

Hey guys,

I guess it has been a very long while since anyone has posted anything on this blog. I don't want to take credit for it (so I won't) but one of the newest PhD students here in the department pointed me to a portable version of the Miktex distribution. The reason why we got interested is because of the recent update of our office computers to Windows 7 and the giant mess it has become to even install or update a package. The good thing about this portable version is that it can be installed on a flash drive and used literally on any computer that has a Windows OS. It even has the TeXworks GUI included so you don't need to install your preferred one (TexnikCenter for most of us). All you have to do is search for it in Google and follow the instructions. So simple!

That's it for today. I hope we can all start sharing some stuff on this blog again.

Benoit

Friday, September 25, 2009

LaTeX to Word (Quick and Dirty)

Although Nelson's method is probably more thorough, I have had some luck recently with GrindEQ for converting LaTeX documents to Word. It does a great job with equations and text. Not the best with figures and citations, but I think it does a fairly good job overall. At least better than converting from pdf to doc or docx.

You can check it out here.

Thursday, September 17, 2009

page counter in beamer presentations

suppose you want to put a page counter in your beamer presentation. Add to the preamble the following:

\usefoottemplate{\hfill \insertframenumber{} / \inserttotalframenumber}


The nice thing about this way of using this method is that it counts each slide once, even if the slide have a transition.

Monday, August 31, 2009

AJAE standard references in Latex and Puthesis

The package economic has a bibliography style based on AJAE standards:
The package is at:
http://www.ctan.org/tex-archive/biblio/bibtex/contrib/economic/
and should be easy to install using mike/live tex standard installers.
To use it with puthesis, add this line to puthesis.cls (I added it where all the bib styles are defined, I do not know if that matters):
\DeclareOption{ajae}{\set@@optionbibstyle{ajae}}.
Then, declare it in the document class:
\documentclass[agecon,ajae,dissertation]{puthesis} (thanks Todd for this hint) and be sure to declare it as bib style in the bibliography section:
\bibliographystyle{ajae}.

Saturday, August 15, 2009

Want to convert your Excel table to LaTeX?

This may be old news, but in my never ending quest to automate table building, I discovered this Excel to LaTeX table converter. It consists of an Add-On to Excel. I've noticed other similar programs online, but this one appears to be the simplest.

-Mesbah

Monday, August 10, 2009

Cover Letters from Purdue in LaTex

Some of us, at some point of our early careers will leave Purdue for higher salary [academic] jobs. First step is applying for a job, which entails writing a nice cover letter that will "sell" us as the top-notch applicants. Long story short, I prepared a template of the cover letter. Purdue logo can be accessed here. Just save it in the same folder with the tex file, and alter school information as needed. Any augmentations and improvements to the provided code are welcome and appreciated.





\documentclass[stdletter]{newlfm}
\newlfmP{letrh=pu,addrtoleft,dateright,sigleft,sigsize=30pt,orderfromdateto,addrfromphone,addrfromfax,headermarginskip=-20pt,dateskipbefore=0pt}

\PhrPhone{Phone}
\PhrFax{Fax}

\newsavebox{\pulogo}
\sbox{\pulogo}{
\parbox[b]{1.75in}{
\vspace{0.5in}
\includegraphics[scale=.4,ext=.png]
{PU_signature}
}
}
\makeletterhead{pu}{\Lheader{\usebox{\pulogo}}}

\newcommand{\person}{name} % substitute with the name of the person you are applying to
\newcommand{\department}{department } % substitute with the Department name you are applying
\newcommand{\university}{university} % substitute with the University name you are applying
\newcommand{\street}{street } % substitute with the actual street address
\renewcommand{\city}{city} % substitute with the actual city
\renewcommand{\state}{state } % substitute with the actual state
\newcommand{\zipcode}{zip-code } % substitute with the actual zip-code

\renewcommand{\position}{position } % substitute with the position title you are applying for
\newcommand{\advertisement}{advertisement } % substitute with the actual source of information
\newcommand{\graduation}{date} % substitute with the expected graduation date

\nameto{\person}
\addrto{
\department \\
\university \\
\street \\
\city, \state \hspace{2pt} \zipcode}

\namefrom{Your Name}
\addrfrom{
Department of Agricultural Economics \\
Purdue University \\
403 W. State St. \\
West Lafayette, IN \hspace{2pt} 47907-2056}
\phonefrom{(765) 494-4191}
\faxfrom{(765) 494-9176}

\begin{document}
\greetto{Dear \person,}
\closeline{Sincerely,}
\begin{newlfm}

Here goes introduction. For example, I am writing to express my interest in the position announcement for an \position in the \department at \university, as advertised on the \advertisement website, etc.

Here goes body.

Here goes conclusion. For example, I would enjoy discussing this position with you in the near future, etc.

\end{newlfm}
\end{document}


Clickable links [hyperref]

This may or may not be news to most of you, but I would imagine that this is something that virtually every writer likes to use every once in a while.

Sunday, August 9, 2009

A couple of nice sources

Here are a couple of references I always find helpful.
  1. LaTeX wikibook - This is a pretty nice general source that just appears to get better and better.
  2. A pretty comprehensive list of math symbols. Good for quick scanning or when you are trying to come up with additional Greek letters.

Thursday, August 6, 2009

Aligning Equations in Latex

Let's say that you have an equation like this:

And want to align it in a pretty way, say:

or:

as opposite to the sloppy:

Then, you can use the environment split within the package amsmath, just as in the example in the box below. By the way, the sloppy way is the last bit of code in the example.


\documentclass{article} \usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
x = a + b + c
\end{split}
\end{equation}

\begin{equation}
\begin{split}
x = {} & a \\
+ & b \\
+ & c \\
\end{split}
\end{equation}

\begin{equation}
\begin{split}
x = {} & a + b \\
+ & c \\
\end{split}
\end{equation}

\begin{equation}
\begin{array}{l}
x = a+ b \\
+ c \\
\end{array}
\end{equation}
\end{document}


Saturday, August 1, 2009

From Latex to MS Word

Latex is not necessarily a standard format, e.g., the working paper series of many places require MS word documents. There are good and expensive converters --- Latex to MS Word and vice-versa --- as well as a host of free tools (see here). One possibility that I have found to work particularly well is first to convert from Latex to HTML, and then from HTML to MS Word --- or the processor of your choice. Here is how:

1. From Latex to HTML: Use TeX4ht (LaTeX and TeX for Hypertext). TeX4ht is part of the Miktex distribution so chances are that it's already in your machine. Just run a command like this:

> htlatex filename "html,word" "symbol/!" "-cvalidate

if it's the first time, it will install by itself, and then start the conversion. This command is tuned towards MS Word. Such a format relies on bitmaps for mathematical formulas. For the right conversion of formula/pictures to bitmaps Tex4ht needs imagemagik (which by the way, is very useful for converting across different formats). I had to modify tex4ht.env in the following way:

#Gconvert -trim +repage -density 110x110 -transparent "#FFFFFF" zz%%4.ps %%3 Gc:"\Program Files\ImageMagick-6.5.1-Q16\convert" -trim +repage -density 110x110 -transparent "#FFFFFF" zz%%4.ps %%3


2. From HTML to MS Word: Open your html document in MS Word and be careful to follow these instructions to be sure that your images (math and figures, basically) get embedded. If you do not do this, they'll get lost if you only keep the .doc file. Don't blame that on me.

3. For Ubuntu users:
$ sudo apt-get install tex4ht
$ sudo apt-get install dvipng
Use the same command above:
$ htlatex filename "html,word" "symbol/!" "-cvalidate"

And step 2 is unchanged.

Friday, July 31, 2009

Tracking changes in Latex files

Sometimes it is useful to compare two versions of the same Latex document in a way that highlights changes, just as the track changes module of MSWord would do (e.g., when working with collaborators, after revising a paper, or just if you are in doubt of which document is the most recent.) It turns out that issuing the command (for Windows users, it is already included in the Miktex distribution of latex) :

> latexdiff-so version1.tex
version2.tex > diff.tex

from the DOS command line interface, will compare the original document "version1" against the modified "version2" and output a document highlighting changes as "diff".

The only requirement that you will have is a Perl interpreter that, for Windows users, can be obtained by installing the suite Rtools (incidentally, this furnishes you with all you need to build native R in MS Windows.)

Important! For running the command above you must have Perl in the Windows Path. The Rtool default installation asks you for permission for such a modification --- if you do not have administrator's privileges, you have to do this by hand using the user's path in the environmental variables option of the MS Windows system dialog.

Thursday, July 30, 2009

Currently Using

Maybe it would be a good idea for all of us to share what freeware we currently use/endorse. Feel free to post yours in the comment section.

1. TeXnicCenter
2. R through JGR (Jaguar) - I prefer to TinnR just because I like it.
3. JabRef - I can't say enough good things about this citation manager.
4. Zotero Firefox extension - This is a really easy way to get references in BibTex form. It does a great job of recognizing sources on a page full of things. Like an entire page of google scholar results or an amazon.com search.

Also, I'm sure almost everyone knows you can output references in BibTex format from googlar scholar (under scholar preferences), but if not, I thought it was worth mentioning.

Viewing Latex changes as PDFs in real time

The Adobe PDF reader locks in the file that is open such it is not editable unless you close it. That's the reason of the error "I can't write yourfile.pdf" when you compile from a shell before closing the pdf view; or why the document is closed before compilation when you use something like TeXnicenter. A lean, portable (no need for admin. rights), pdf viewer that allows you to compile and having an automatic preview of your work is Sumatra PDF, available at:

http://blog.kowalczyk.info/software/sumatrapdf/index.html

Simply open your document using Sumatra, edit and compile using your favorite way, and you will have the changes right in front of you without the need to navigating the entire document to see if the changes took place.