Thursday, March 3, 2011

Author per chapter (a.k.a. Proceedings)

I never understood why there is no proper Latex class for typesetting proceedings or journals when Latex or Xetex is getting increasingly popular among scientists. The biggest trouble you will have whey you will try to typeset something like this is to get the authors' names into the Table of Contents and into the headers while having each author's contribution to the volume as a chapter which shall not appear numbered anywhere.

The best (and only) template I could find was eConf Full-Text Proceeding Instructions and Templates but even these were nowhere near to what I needed because this requires you to typeset your Table of Contents manually. Yuck!

After much googling I found that there really is no good solution for typesetting a compiled volume where every \chapter would have its own author. The most useful posts in discussions recommended using the memoir.cls and modifying it as needed.

It looks like nobody has ever published his take on modyfiying the memoir.cls for typesetting proceedings or journal volumes where each chapter would have its author and the names of these authors would appear in the ToC and the headers. Therefore I publish here something which you can use right away for typesetting proceedings with authored chapters. To achieve this, my modified memoir.cls (called proceedings.cls) does following things:

  1. Disables chapter numbering and also removes the "0." before section number
  2. Writes the author and his home institute under the chapter title
  3. Does not typeset the page number on the initial page of the chapter
  4. Shows the short version of the chapter title in even head
  5. Shows the author's name in the odd head
  6. Shows the author's name above the chapter's title in the table of contents

You can have a look at an example pdf which shows such a minimal dummy proceedings containing two papers. The pdf was generated by xelatexing this source document. To compile it yourself, you will need my modified version of the document class memoir.cls which I called proceedings.cls. Put them all in one directory and compile with xelatex (at least that's what I did).

I had to refrain from using the normal \chapter command. My proceedings.cls provides you the \Chapter command (defined in lines 2844–2857) which must be used as

\Chapter{<Author's name>}{<Author's home institute>}{<Full title of the paper>}{<Short title to appear in the header>}

You will probably need to modify it when setting the vertical space between the Author's name and the Chapter title in the Table of Contents and on the title page of the paper.

I got rid of the chapter numbering the hard way by deleting it of the documentclass's commands \thechapter and \thesection (lines 2580 and 2581 of proceedings.cls)

If you would like to change anything about the headers or footers, you change that in the pagestyle proceedings which I defined in lines 2024–2039 of the proceedings.cls

I know that my solution is far from elegant because internally it uses the \chapter* command which makes chapters which don't appear in the table of contents and right after that it "manually" adds the chapter's title with the author's name to ToC. I also know that rather than replacing the chapter number with {} it would be more elegant not to let typeset it at all. I also wish I could have a command like e.g. \chapterauthor which would be used as a place holder in the definition of the header and get updated with every \Chapter (or even \chapter) rather than redefining the whole header with every new \Chapter.

Alas, I have spent so many days with this that right now I am not going to spend any more time with this. If you are an experienced document class designer please do it better, publish it somewhere, and let me know. Thank you.

Unexperienced Xetex users may use and modify the proceedings.cls as they need. If you have questions where and how to modify certain things in it please ask me directly or in the comments.

Wednesday, January 6, 2010

Subscript and superscript in text mode

I often need to write various thing in subscript and superscript which have nothing to do with maths so I don't want to have them written in math mode. For LaTeX users there is no easy way to write subscript and superscript in text mode.
XeTeX, however, has prepared some macros for this. Assuming you have \usepackage{xltxtra} in the preamble, you can use the commands


if you want something like C_2 you write C\textsubscript{2}. Of course if you use this a lot, it is much more convenient two write some shorthand command to use instead these long ones.

Those of you who still write in LaTeX may find a solution here.

Thursday, July 23, 2009

Typesetting tilde or backslash

Typesetting a tilde in Latex or Xetex is not so easy. It's a reserved character (non breakable fixed width space) and \~ produces a diacritic. Typing this diacritic alone, i.e. \~{} still produces a tilde which is small and high above the base line. When you follow most of the recommendations in Latex books, you probably write tilde by $\sim$ or any other more complicated variant thereof to work in both text and math environment. This produces a tilde nice and big, not too high above the baseline. What you also see is the recommendation to write tilde in the verbatim mode. For me these two are still not acceptable because they usually switch the font and you really see that the font of it looks alien to the surrounding text. Why should I switch the font when I want to write a tilde in the text mode? I want to get a nice tilde in the normal font which is not a diacritic. Font designers strived to match the appearance of the tilde glyph to the rest of the font so why shouldn't I use it?

Fortunately, there is a macro for typing the kind of tilde I need: \textasciitilde{}. It is just not generally known. This produces a tilde in the text mode which uses the tilde glyph from the font just as the font designers shaped it. It's similar to the command \textbackslash{} which is more widely known for typsetting backslash in text mode.

When you are in text mode, use these commands and spread the word.

Wednesday, May 20, 2009

Phantomas command

Recently I have found that there is a useful TeX command \phantom{Phantom Text} which behaves just like it would typeset its argument except that nothing is typeset and there is a blank space of the corresponding dimensions.

When I have been using it I imagined it would be sometimes even more useful to have a command which can put some other stuff in the reserved space instead of the phantom stuff.

Luckily, some smart guys have already written such a command.

Here is a modified version of their minimal example which illustrates nicely the use of this command:

\usepackage{calc} % for the \phantomas command

% The following command is a better version of \phantom and requires the "calc" package
% Credits: Jean-Côme Charpentier & Scott Pakin
% Source: comp.text.tex, "Phantom-ish command"
% usage: \phantomas[l]{phantom words which will be overwritten}{with these words}
% the optional parameter [l] says that the words "with these words" will appear aligned left to the reserved space
% another optional parameter is [r] for aligning the words right
% if no optional parameter is given, the words will be centred in the reserved space


A long entry another long entry and our last long entry\par
\phantomas{A long entry}{centred} \phantomas[l]{another long entry}{on the left}
\phantomas[r]{and our last long entry}{on the right}

$\sin^2 x + \cos^2 x = 1$\par
$\phantomas{\sin^2 x + \cos^2 x}{f(x)} = 1$\par
$\phantomas[l]{\sin^2 x + \cos^2 x}{f(x)} = 1$\par
$\phantomas[r]{\sin^2 x + \cos^2 x}{f(x)} = 1$


Wednesday, February 25, 2009

First gloss line in italics (gb4e)

The solution is in the gb4e manual on page 7:

% first gloss line in italics:

Table lines starting with square bracket

this one does not compile:

a & b \\
[c] & d \\

if required, one can specify the vertical gap between lines in a table using

LaTeX removed the newline and whitespace to interpret the table as having a \\[c] entry, and there exists no length "c".

So the solution is to write the initial square bracket into curly braces. This way it is not interpreted as the beginning of the optional argument of the newline command.

a & b \\
{[}c] & d \\

Thanks to Werner Grundlingh for showing me the problem source.

Thursday, April 10, 2008

Filetype recognition in Vim

If your LaTeX suite does not want to load when you create a new.tex file, it is probably due to the following line missing in the _vimrc file:

" Prevents Vim 7.0 from setting filetype to 'plaintex'
let g:tex_flavor='latex'

Thanks to Phase Portrait.