Thursday, April 9, 2009

latex bibtex name format

For formatting of author names, let’s locate the FUNCTION format.names. You will see inside the function there is something like

"{ff~}{vv~}{ll}{, jj}" format.name$

This governs how a name is formatted. ff stands for first name, vv for von part, ll for last name, and jj for suffix, such as Sr. and Jr. This format says that the first name is followed immediately (separated by only a space but not a line-break) by the von part, which in turn is immediately followed by last name. After the last name comes a comma and a space, then the suffix. As another example, see the acm style:

"{vv~}{ll}{, jj}{, f.}" format.name$

This format indicates that the von part is presented in the front, immediately followed by last name, then a comma, a space and the suffix. First name goes in the very last, followed by a period. Note that ff means to display the first name fully, while f means that only the initial letter of the first name is displayed.

You will notice that in the acm style, all the letters of a name, except the initial letter, are typeset in smallcaps. This is because in the FUNCTION format.authors, there is a line of code

author format.names scapify

where scapify is another function that small-capifies the lower case letters.

Links:
http://chenfuture.wordpress.com/category/latex/
http://www-lmmb.ncifcrf.gov/~toms/latex.html

Friday, February 27, 2009

table

One of my last posts was on how to define the width of a column in a table (see here).

The parbox (p), which is used by Latex when you define the column width, will by default align its content on the left. This can be changed, but is a bit tricky.

The keyword is:

1.
\raggedleft,
2.
\centering or
3.
\raggedright

Raggedleft will align text on the right-hand side, leaving whatever white space is remaining (ragged) on the left.
For a better understanding, let’s define right alignment of the text as a new column type “x”, which can than be used in the very same way as pre-defined column types.
Defining a new column type needs the following package:

1.
\usepackage{array}

and than:

1.
\newcolumntype{x}[1]{%
2.
>{\raggedleft\hspace{0pt}}p{#1}%

The argument is the width of the column.

Now simply use “x{2cm}” instead of “p{2cm}”, for columns which align text on the right. By changing \raggedleft to \centering, you can align text in the centre.

Example:

1.
\begin{table}\centering
2.
\begin{tabular}{|l|x{4.5cm}|x{4.5cm}|}\hline
3.
Nb. & Advantage & Disadvantage\tabularnewline\hline
4.
1 & a & b \tabularnewline\hline
5.
2 & b & a \tabularnewline\hline
6.
\end{tabular}
7.
\end{table}

Note:
An important last thing to mention, you cannot end lines with “\\”, as you defined your own column type. Therefore, I am using \tabularnewline in the example. If you want to save time, you might define your own command as follows:

1.
\newcommand{\tn}{\tabularnewline}

Or even:

1.
\newcommand{\tnhl}{\tabularnewline\hline}

Monday, January 12, 2009

links for latex

http://en.wikibooks.org/wiki/LaTeX/Introduction

Space in LaTeX

pt point (1 in = 72.27 pt)
pc pica (1 pc = 12 pt)
in inch (1 in = 25.4 mm)
bp big point (1 in = 72 bp)
cm centimetre (1 cm = 10 mm)
mm millimetre
dd didot point (1157 dd = 1238 pt)
cc cicero (1 cc = 12 dd)
sp scaled point (65536 sp = 1 pt)

LaTeX will automatically indent paragraphs (with the exception of the first paragraph of a new section). One can prevent LaTeX from indenting a paragraph though by beginning the paragraph with the control sequence \noindent.

Conversely, the control sequence \indent forces LaTeX to indent the paragraph.

%%%%%%% others in MATH mode %%%%%%%%%%%
  • \- LaTeX may hyphenate the word at that point.
  • \; Include a thick space in math mode.
  • \: Include a medium space in math mode.
  • \, Include a thin space in math mode.
  • \! Include a negative thin space in math mode