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.