Showing posts with label tricks. Show all posts
Showing posts with label tricks. Show all posts

Wednesday, September 08, 2010

How to put "1 of ..." page numbers on a LaTeX letter

Someone e-mailed me recently to ask how to add "1 of LAST_PAGE" page numbers to a LaTeX letter document. I generated the sample LaTeX document fancy_letter_numbering.tex to show how it's done using the fancyhdr and lastpage packages.

Here is my response, which gives more details:
I have attached a sample letter with "1 of ..." page numbering throughout. fancyhdr works with "letter" just as well as it works with "article." You just have to treat "\opening" just like you do "\maketitle."

In particular, put this up in your preamble:
\usepackage{lastpage}
\usepackage{fancyhdr}
\fancyhead{}
\fancyfoot{}
\cfoot{\thepage{}~of~\pageref{LastPage}}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
Then, after each "\opening" (in the case of a single letter, there will only be one), put the line:
\thispagestyle{fancy}
Otherwise you will get page numbers on every page except for the first one.
Of course, you will have to run LaTeX (or PDFLaTeX) at least twice to place the "LastPage" label properly and generate the correct page refeference.

[ Additionally, you may further customize the headings and footers making use of all of the nice features that come with the fancyhdr package. ]

Wednesday, August 29, 2007

Viewing man pages and text files in Skim

As discussed on the Skim wiki, it is possible to view man pages (and more) nicely formatted as a PDF in Skim.

If you use bash, try adding these lines to your .bashrc:
function skimcat () { cat $* | enscript -p - | open -f -a Skim; }
function manp () { man -t $* | open -f -a Skim; }
Alternatively, if you use tcsh, try adding these lines to your .cshrc:
alias skimcat="cat \!* | enscript -p - | open -f -a Skim"
alias manp="man -t \!* | open -f -a Skim"
Then you'll be able to do skimcat to cat files to Skim, and you'll be able to use manp to view man pages formatted in Skim.

NOTE: You can actually pipe anything that is PostScript (or PDF) formatted to Skim (via the open command shown above).

Tuesday, July 24, 2007

Google School: Synonyms and Info

From Google School:

Google School: Rank Wikipedia articles in your results
If you want to get general background on something with Google, append the word "info" or "information" to your search term.

If your words appear in the title of a Wikipedia page, Google will list that article at the top of your results, for a convenient way to search both Google and the Wikipedia at once. --Gina Trapani


Also, from Lifehacker: 88 Tech Tricks to Turbocharge Your Day, by Gina Trapani:

Synonyms (Chapter 9, p. 223)
Search for synonyms using the tilde (~) next to keywords. This comes in handy when you are searching for a concept rather than for a specific word or sequence. For example:
  • ~nutrition ~information muffins returns exact matches as well as matches on Muffins Food Facts and Muffins Vitamin Information.
  • ~car turns up information on trucks and vehicles.
  • A search for ~pen yields pencils, graphite, and sketch.