Thursday, June 19, 2008

 

DEFINING YOUR OWN COUNTERS AND LABELS in Latex

From my latex notes at http://rasmusen.org/a/latex-rasmusen.txt

This is tricky in Latex, because while you can define new counters, I can't see how you would attach their values to labels. The \label command can only be used in environments that have their own counters (such as \begin{equation}), and you can't fool those environments into adding to a counter without having them print the value on the printed page somewhere. So I used Tex programming, like this. I create a new counter named \fignum and then attach it to a label called \1f, \2f, and so forth, advancing the counter in between. I used \edef rather than \def because \edef inserts the value at the particular time, while \def would repeat the command \number\fignum each time \1f was written.

\newcount\fignum\fignum=1

\edef\1f{\number\fignum}

\advance\fignum by 1

\edef\2f{\number\fignum}

Example: Figure \1f says this. The second part of it, Figure \1fa, says something different. Figures \2f and \2f-a say something still different.

This is plain Tex, not Latex.

You need to write backslash-1-f rather than backslash-f-1. I'm not sure why-- it must be that the number gets interpreted as doing something special to the definition rather than being part of the name.

You have to remember to put your definitions earlier in the document than when you use the term defined. You could put them all the start, actually, but then you might forget to re-order them when you change the order of the diagrams.

I think you can advance the fignum variable by a negative number if you want to.

Labels: ,

 

To view the post on a separate page, click at (the permalink). 0 Comments Links to this post

Tuesday, June 10, 2008

 

Bibtex and Miktex: A bibliography program

I'm not sure if this is worth using or not. Here's how it works with Miktex.


1. For your file myfile.tex, construct a bibliography database file
myfile.bib with a bunch of entries like this, which do not not have to
be in alphabetical order:

 @article{hotelling:1929:ej,
  author = {Hotelling, Harold},
  journal = {Economic Journal},
  month = {mar},
  number = {153},
  pages = {41--57},
  publisher = {Royal Economic Society},
  title = {Stability in Competition},
  volume = {39},
  year = {1929}
}

You can do this from Google Scholar by going to Scholar Preferences and
checking off towards the bottom that you want a Bibtex-format link.
After you set your prferences,  Import into BibTeX will be a link  fror
each item a   Google Scholar search turns up.

2. Pick a style file such as econometrica.bst.  Put that file and the
myfile.bib file into the same directory as myfile.tex.

3. Wherever you want the references in myfile.tex, insert the commands

\bibliographystyle{econometrica} %needs  econometrica.bst file in folder
 \bibliography{myfile} %needs myfile.bib file in folder

 \nocite{*}

 The nocite command makes sure that all the entries in the myfile.bib
file get put into the references. Otherwise, only the ones cited using
bibtex commands get put in. The bibtex citing commands are just extra
commands to remember and make reading latex input files harder, so I
don't think I'll use them.


4. Change the name of myfile.tex to plain myfile.

5. Run myfile  through pdflatex.  That will create myfile.aux.

6. Run myfile through bibtex. That will use myfile.aux and
econometrica.bst and myfile.bib to create myfile.blg, a log file, and
also myfile.bbl, the bibliography formatted nicely.

7. Run myfile through pdflatex again.
My files of latex tips, including this one, is at http://rasmusen.org/a/latex-rasmusen.txt.

Labels:

 

To view the post on a separate page, click at (the permalink). 0 Comments Links to this post

Monday, May 12, 2008

 

Shrinkwrap Contracts

Mark Lemley has a 2006 Minnesota Law Review paper, http://papers.ssrn.com/sol3/papers.cfm?abstract_id=917926 on shrinkwrap contracts that gives updates on what courts have been doing since Easterbrook's opinion.

Labels: ,

 

To view the post on a separate page, click at (the permalink). 0 Comments Links to this post

Monday, April 21, 2008

 

Word Counts in PDF

Translator's Abacus is a free program, downloadable from http://www.globalrendering.com/download.html, that does word counts for pdf and html documents. It is 640K, one file, easy to use, andwell designed.

Labels:

 

To view the post on a separate page, click at (the permalink). 0 Comments Links to this post