Latex Tips

Use ‘\tilde’ sparingly in your latex code before \cite, \ref etc. It will avoid annoying line breaking before a reference or an equation number. Similarly we should use ‘\’ after a period (‘.’), where the period symbol is not meant for ‘full stop’. For example, etc., e.g.  Otherwise, latex will interpret it as a full stop and will give more space between the words.

Title case problem with Bibtex

Using Jabref, a front end for bibtex, we can solve this problem quickly.

Q: BibTeX converts uppercase characters to lowercase in my title field. I know this can be prevented by wrapping uppercase letters in braces, e.g. “{T}he life cycle of {A}tlantic salmon”, but this is too much work. Can JabRef help?

A: JabRef has a setting that will automatically wrap all capital letters for certain fields in { } – this will make sure they are preserved in the LaTeX output. Under Options -> Preferences -> General -> File -> “Store the following fields with braces around capital letters”, make sure the title field is included. To do this for several fields, write e.g. “title;abstract” (without the quotes). This setting automatically adds braces when saving the bib file, but you won’t see the braces within JabRef.

source: http://jabref.sourceforge.net/faq.php

Some Latex tips for a IEEE Letter

The template for writing a double column IEEE letter is almost as same as the one for  IEEE transactions. For instance,

\documentclass[a4paper,journal]{IEEEtran}

is enough for writing a letter. But one is required to submit a single column version of the same during review which has tight constraints on number of lines and line spacing (depending on the particular research publication). The following declaration will be enough in general, (refer to IEEEtran for details on individual options)

\documentclass[12pt,draftcls,onecolumn,a4paper,journal]{IEEEtran}
The important one being the option of ‘a4paper‘, because IEEEtran loads letter mode by default rather than the a4 mode. This can mess your space constraints as it takes up more space.

Sometimes, even in this single column version, one needs to adjust the margins, so the number of lines in a page comes under a certain upper limit. Some tweaks in following piece of code should help for that
\newcommand{\CLASSINPUTinnersidemargin}{1in}

\newcommand{\CLASSINPUToutersidemargin}{1in}

\newcommand{\CLASSINPUTtoptextmargin}{1in}

\newcommand{\CLASSINPUTbottomtextmargin}{1in}

They adjust top-bottom and the side margins (it goes without saying this should be included before document class).

Above all, one should always refer to  IEEEtran-HowTo for any doubts in IEEEtran.

Using Latex in WordPress

This is a very much needed thing if we are using wordpress. The default latex syntax in wordpress is simple and straightforward  “dollar latex  YOURCODEdollar” (where dollar should be replaced by its symbol). Internally wordpress puts “YOURCODE” inside a ‘align’ environment. So whatever fits inside ‘align’ environment works. But the functionality of this basic latex support in wordpress is limited and rudimentary.

A popular and more functional alternative is Latex2Wp. Download and install it from here. (Interestingly,  it looks like most mathematicians use this plugin for blogs, for eg. Terence Tao).

Margin Issue in Latex

Today, while submitting my work in TENCON through edas.info, I faced an issue with the bottom margin.

Edas complained that the 3rd page has only 0.92 inch bottom margin where the minimum requirement was 1 inch.

I tried many things ……and wasted my time.

Then I found that TENCON asked for A4 paper and by default ieeetran gives LETTER format.

I simply changed documentclass[conference]{IEEEtran} to documentclass[a4paper,conference]{IEEEtran}, and the problem was solved!

Embedding All Fonts in PDF file

When we submit/send a pdf file, it is a good idea to embedd all fonts used, in the pdf file.

To embed all fonts in your pdf file use this command in terminal and create the pdf file from ps file.

ps2pdf -dEmbedAllFonts=true -dSubsetFonts=true -dEPSCrop=true -dPDFSETTINGS=/prepress FILENAME.ps

This will create a pdf file with name FILENAME.pdf

Nice tables using Latex

Here, we’ll show how to improve the default appearance of a table in LaTeX.

The following commands will produce the default style table in LaTeX. (Refer Table I)

begin{table}[htbp]
caption{Default Table}
label{Tab:SRNRValues}
begin{center}
begin{tabular}{|c|c|c|c|}
hline
multirow{2}{1.5cm}{Method}& multicolumn{3}{p{5cm}|}{centering Measurements} \
cline{2-4} & multicolumn{1}{c|}{Clean} & multicolumn{1}{c|}{SMNR=15 dB} & multicolumn{1}{c|}{SMNR = 10 dB} \ hline
Type1 & 27.54 & 13.23 & 6.80 \
Type2 & 29.55 & 9.61 & 6 \
Type3 & 25.99 & 11.49 & 6.15 \
hline
end{tabular}
end{center}
end{table}

* The following modifications will make the table look more attractive. (Refer Table II).

You need to include additional packages using commands

usepackage{multirow}
usepackage{bigstrut}

renewcommand{multirowsetup}{centering} %to align center inside the table
setlength{tabcolsep}{10pt}
begin{table}[htbp]
caption{A Nice Table}
label{Tab:SRNRValues}
begin{center}
begin{tabular}{|c|c|c|c|}
hline
multirow{2}{1.5cm}{Method}& multicolumn{3}{p{5cm}|}{centering Measurements} bigstrut \
cline{2-4} & multicolumn{1}{c|}{Clean} & multicolumn{1}{c|}{SMNR=15 dB} & multicolumn{1}{c|}{SMNR = 10 dB} bigstrut \ hline
Type1 & 27.54 & 13.23 & 6.80 bigstrut \
Type2 & 29.55 & 9.61 & 6 bigstrut \
Type3 & 25.99 & 11.49 & 6.15 bigstrut \
hline
end{tabular}
end{center}
end{table}