Tuesday, August 18, 2015

How to configure XeLatex for US Letter (8.5x11 inches) pdf size?

Most conferences and journals only accept US Letter size formatted PDF. However, most latex compilers produce A4 size PDF by default. You need to explicitly tell the compiler to generate US Letter size.

XeLatex is one of those compilers that allow you to use both PDF and EPS figures. To configure XeLatex for US Letter size, follow this:

  • In whatever editor you are using, find the place where you provide arguments for XeLatex compiler. For texmaker, it is at "Preferences" or "Configure texmaker", depending on your version.
  • Add -papersize=letter to the arguments. The modified arguments should look something like this:
    • xelatex -synctex=1 -papersize=letter   -interaction=nonstopmode %.tex
  • Save and compile your code.

Tuesday, May 26, 2015

Latex Tables: How to Center Text Both Horizontally and Vertically

The normal approach is to use ">{\centering\arraybackslash}m{3cm}" to specify cell format at the top:
\begin{table}
\centering\begin{tabular}{|>{\centering\arraybackslash}m{3cm}|>{\centering\arraybackslash}m{5cm}|} \hline\textbf{Topic} & \textbf{Paragraph} \\\hline \hlineTopic 1 & This is a paragraph. This is a paragraph. This is a paragraph.\\\hline\end{tabular} \end{table}
The text is both vertically and horizontally centered, but, you probably want the Paragraph column to be left aligned. If you use "p" to specify the cell format for the second column, the text will no longer be vertically centered:

\begin{table} \centering\begin{tabular}{|>{\centering\arraybackslash}m{3cm}|p{5cm}|} \hline\textbf{Topic} & \textbf{Paragraph} \\\hline \hlineTopic 1 & This is a paragraph. This is a paragraph.\\\hline\end{tabular} \end{table}
To have a paragraph style text and vertical alignment both at the same time, use  ">{\centering\arraybackslash}m{3cm}" to specify cell format at the top and use \multicolumn{1}{m}{Text} in the table entry:
\begin{table} \centering\begin{tabular}{|>{\centering\arraybackslash}m{3cm}|m{5cm}|} \hline\textbf{Topic} & \textbf{Paragraph} \\\hline \hlineTopic 1 & This is a paragraph. This is a paragraph.\\\hline\end{tabular} \end{table}
Enjoy!
 






Sunday, April 12, 2015

Ubuntu Matlab: Error using VideoFileReader/setup Could not open the specified file.

In order to read video file using vision.VideoFileReader object, you need to initialize it:

video_source = vision.VideoFileReader('test.avi')

Now, to access a (next) frame of the video, you need to run the following command:

frame  = step(videoSource);

If you are doing it for the first time after fresh Matlab installation, you will probably run into the following error:

Error using VideoFileReader/setup 
Could not open the specified file.

This happens because Matlab is unable to find the correct codec to decode the video file. To solve this problem, follow these steps:


  • Install ubuntu-restricted-extras
    • sudo apt-get install ubuntu-restricted-extras
  • Install Gstreamer
    • sudo add-apt-repository ppa:gstreamer-developers/ppa
    • sudo apt-get update
    • sudo apt-get install gstreamer0.10-tools gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad
  • Install gstreamer0.10-ffmpeg 
    • sudo add-apt-repository ppa:mc3man/trusty-media
    • sudo apt-get update 
    • sudo apt-get install gstreamer0.10-ffmpeg
Restart the Matlab and it should work just fine!

Enjoy!



Sunday, March 29, 2015

The curious writing style of Benjamin to manage the overall THEME of the paragraphs and paper!

It is very simple.

Instead of writing full text in the beginning itself, write 2-3 lines summarizing the message you want to convey by each paragraph.  While writing the full text, just expand these lines. Make sure that the content you add to each paragraph adheres to the final message of the paragraph.

To manage the theme of the whole paper, just write the messages of each paragraph and read them all together. You will get a clear idea of whether or not the paragraphs follow a single theme and story. 

Monday, August 19, 2013

How to remove white space from eps and pdf figures!

When we store figures as pdf, they are stored with high quality in a vector format.  But generally the whole page is stored, with lot of white space around the actual figure. There are two ways to remove this space.

1. Convert to eps and remove space from eps

Do NOT use GIMP autocrop feature for removing the space. GIMP converts the images into bitmaps (non-vectored) which is bad quality. 

Follow the steps below to create high quality eps figures and remove space:
  • pdftops file_with_space.pdf file_with_space.eps
  • cat file_with_space.eps | ps2eps > file_without_space.eps

2. Remove space directly from pdf

To do that, use the pearl script given at http://www.ctan.org/tex-archive/support/pdfcrop/. For instructions, read the README file.

Wednesday, July 31, 2013

latexdiff: Excellent tool to view modifications!

It is hard to specifically see the changes in two versions of a paper. It is even harder to spot those changes in the .tex files. To visualize the changes (or differences) between two latex version of a paper, we can use an excellent tool, latexdiff, freely available for linux. It can be installed with a simple command:
  • sudo apt-get install latexdiff 
The output file will have colors and annotations to mark the differences. The name of the output file is derived from the input filenames.

Difference of two local .tex files (latexdiff)

  • latexdiff --flatten --pdf old-file.tex new-file.tex > diffs.tex
(the –flatten argument makes latexdiff recursively operate on any included .tex files.)

Difference of SVN versions (latexdiff-vc)

  • Compare current working copy with earlier version
    • latexdiff-vc --pdf --flatten -r version file.tex > diffs.tex
  • Compare two versions
    • latexdiff-vc --pdf --flatten -r version1 -r version2 file.tex > diffs.tex

A guide to begin work at University of Ottawa

Important Formalities

  1. On the first day you arrive Ottawa, go to City Hall (City of Ottawa) and apply for SIN (Social Insurance Number) and OHIP (Ontario Health Insurance Plan).
    • For SIN, you only need your passport and work permit. Carry your job offer just in case.
    • For OHIP, you need to provide a proof of address. You can carry your lease agreement. 
  2. To be on campus, you need to have medical insurance. Your free insurance (OHIP) only starts after three month. Therefore, you need to apply for private insurance for these three months. You can do that at the HR office. It will cost you around C$171 for three months. Chose the option to pay from your salary.
  3. Come to the department and meet Prof. You need to sign a contract with Prof and submit a to the department office. After approval from the Director, you will get a copy of the contract.
  4. You need to take that copy to the FGPS for registration as postdoctoral researcher.

Other Logistics

Access Card

Go to the department and obtain forms to fill. You need your supervisor to sign those form. You also need to finish WHMIS test before you can get access card. 

Email ID

You will get it automatically after registration.

Staff Card

You will get staff card from HR office.