21 December 2011

37. Making posters in latex


As a scientist you may have discovered how much less swearing occurs when writing articles in latex rather than MS Word or other What You See Isn't Quite What You Wanted  packages (WYSIQWYW -- I guess this is an acronym that won't be taking off anytime soon). The next step is to move from using powerpoint to make posters and presentations, to using latex.

It's never elegant to post the entire code in blog form, but what to do when you can't upload simple files?

The poster style is based on a theme by Rob J Hyndman and is an adapation of i6dv by David Vilar and edited by me.


Here's beamerthemeMyTheme.sty which you should put in the same folder as your post tex file:


\ProvidesPackage{beamerthemeMyTheme} % this style was created by Rob J Hyndman and is an adapation of i6dv by David Vilar. Edited by Someone Else

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\selectcolormodel{cmyk}
\selectcolormodel{rgb}
\mode<presentation>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% custom colors
%\definecolor{i6blue}{cmyk}{1,0.305,0,0.06}
\definecolor{i6bluedark}{rgb}{0.0156,0.2578,0.5625} 
\definecolor{i6colorscheme1}{HTML}{333333}  %333333 e.g. for block title
\definecolor{i6colorblockbg}{HTML}{555555}
\definecolor{i6colorblockfg}{HTML}{FFFFFF} %block title white
\definecolor{i6colorscheme2}{HTML}{000000}  % e.g. title in headline
\definecolor{i6colorscheme3}{HTML}{F0F0F0} % e.g. for poster background
\definecolor{i6colorscheme4}{HTML}{000000} 
\definecolor{i6colorschemeHeadline}{HTML}{000000}  % for headline bg
\definecolor{i6colorschemeFootline}{HTML}{101010}  % for headline bg

% headline colors and fonts
\setbeamercolor{headline}{fg=yellow,bg=i6colorschemeHeadline}
\setbeamercolor{title in headline}{fg=yellow}
\setbeamercolor{author in headline}{fg=white}
\setbeamercolor{institute in headline}{fg=lightgray}
\setbeamercolor{separation line}{bg=i6colorscheme1}

% footline colors and fonts
\setbeamercolor{footline}{fg=white,bg=i6colorschemeHeadline}
\setbeamerfont{footline}{fg=white, size=\normalsize}

% body colors and fonts
\setbeamercolor*{normal text}{fg=black,bg=i6colorscheme3}

% block environment
\setbeamercolor*{block body}{bg=white,fg=black}
\setbeamercolor*{block title}{fg=i6colorblockfg,bg=i6colorblockbg}
\setbeamerfont{block title}{size=\large,series=\bf}

% example environment
\setbeamercolor*{example title}{fg=white,bg=i6colorscheme1}
\setbeamerfont{example title}{size=\large,series=\bf,bg=i6colorscheme1,fg=white}

\setbeamercolor{alerted text}{fg=i6colorscheme1}

\setbeamertemplate{itemize items}[triangle]
\setbeamertemplate{navigation symbols}{}  % no navigation on a poster

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{block begin}{
  \vskip0.5ex %space between boxes
  \begin{beamercolorbox}[rounded=true,shadow=true,leftskip=1ex,colsep*=0.5ex]{block title}%colsep - height block title, leftskip - title text indent
    \usebeamerfont*{block title}{\Large \insertblocktitle}
  \end{beamercolorbox}%
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%space between head and block
  \usebeamerfont{block body}%
%  \begin{beamercolorbox}[rounded=true,shadow=true,colsep*=0.5ex,sep=0.5ex,vmode]{block body}%colsep, sep - vert margin top and bottom
  \begin{beamercolorbox}[rounded=true,shadow=true,colsep*=0.5ex,sep=0.5ex,vmode]{block body}%colsep, sep - vert margin top and bottom
   \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.5ex}\vbox{}%
  }
  \setbeamertemplate{block end}{
  \end{beamercolorbox}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{headline}{  
  \leavevmode

  \begin{beamercolorbox}[wd=\paperwidth]{headline}
\centering
        \vskip4ex % height above text
        \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
        \usebeamercolor{author in headline}{\color{fg}\large{\insertauthor}\\[1ex]}
        \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}
  \end{beamercolorbox}

  \begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
    \rule{0pt}{2pt}
  \end{beamercolorbox}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{footline}{
  \begin{beamercolorbox}[wd=\paperwidth]{upper separation line foot}
    \rule{0pt}{2pt}
  \end{beamercolorbox}
  
  \begin{beamercolorbox}[ht=5ex,leftskip=1cm,rightskip=1cm]{footline}% ht - thickness
    \hfill \raisebox{0.4cm}{\insertfooter} %raisebox - placement of text
    \vskip1ex
  \end{beamercolorbox}

  \begin{beamercolorbox}[wd=\paperwidth]{lower separation line foot}
    \rule{0pt}{0pt}
  \end{beamercolorbox}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<all>

\def\footer#1{\def\insertfooter{#1}}


and here's the poster.tex file:


\documentclass[final]{beamer}
\usetheme{MyTheme}
\usepackage[orientation=portrait,size=a1,scale=1.14,grid,debug]{beamerposter}
\usepackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1.0cm}
\setlength{\TPVertModule}{1.0cm}
\usepackage{ragged2e}
\usepackage{mhchem}
\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}


\title{A hypothetical LaTeX poster}
\author{I Am Me\inst{*} \quad She S Someoneelsei\inst{\dag} \quad A. Third Party\inst{\dag}$^{,}$\inst{\ddag}}
\institute[School of Somethingorother]{
\inst{*}%
School of Somethingorother, My University \quad
\inst{\dag}%
Department of Haxx0r
\inst{\ddag}%
Department of 1337, UC Other
}
\footer{url: http://http://www.blogger.com/ \quad email: me@blogger.com}
\date{}

\begin{document}

\begin{textblock}{6}(0.6,0.6)
\includegraphics[height=4.0cm]{mylogo_light.eps}
\end{textblock}

\begin{textblock}{6}(54.9,0.6)
\includegraphics[height=4.0cm]{ucother_logo.eps}
\end{textblock}

\begin{frame}{} 
\begin{textblock}{28.5}(0.6,6.3)

\begin{block}{Introduction}
\justifying
\begin{center}\begin{minipage}{28cm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum gravida nisi eget lectus commodo luctus. Pellentesque vitae velit ligula. Nullam diam enim.[1,2]
\end{minipage}\end{center}
\begin{center}
\begin{figure}
\includegraphics[width=23.9cm]{screenshot.eps}
\caption{A caption for  \ce{[Fe4(H2O)8L9]^{-}}}
\end{figure}
\end{center}
\begin{center}\begin{minipage}{28cm}
Integer nec felis massa, ac tincidunt tellus. Phasellus ornare urna nec erat eleifend eu egestas arcu sodales. Cras interdum, lectus vitae ultricies rutrum, orci sapien bibendum orci, ut facilisis lectus velit at risus. Maecenas ut nisi mi. Praesent in nunc vitae justo ullamcorper placerat nec id lectus.  \ce{[[Fe4(H2O)8L9]^{-}} cluster[3]ante ipsum primis {\sc nmr}.[4]\\
\tiny{
\begin{enumerate}
\item G. Romanum, J. Eunt, G. Ite, F. Sum, \emph{A. Journal. Int. Ed.} \textbf{2011}, \emph{8}, 1943--1946.\\
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\item A. Graecum, D. Hispanum, F. Molybdenum, R. Verum, H. Ipsum, P. J. Consectetur, G. Lectus, R. Ligula, M. Diam, \emph{Science} \textbf{2011}, \emph{323}, 13--17.
\end{enumerate} }
\end{minipage}\end{center}

\end{block}

\begin{block}{Experimental} \justifying

\begin{center}
\begin{figure}
\includegraphics[width=23.6cm]{screenshot.eps}
\caption{Another figure caption}
\end{figure}
\end{center}

\begin{center}\begin{minipage}{28cm}
Integer nec felis massa, ac tincidunt tellus. In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc tempor pretium blandit. Nulla vulputate odio quis tortor porttitor rhoncus. Vestibulum euismod purus non dolor pharetra non tempus diam pharetra. Nulla nec mauris vitae risus dapibus eleifend eget et ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.  \end{minipage}\end{center}
\end{block}


\begin{block}{Data massage} \justifying
\begin{center}\begin{minipage}{28cm}
In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. Vestibulum ante ipsum primis in faucibus orci. In eget lectus a ante hendrerit gravida ut a massa. Nam euismod nisi vel nulla suscipit fermentum. Quisque vel nulla nibh, at bibendum quam. 

\end{minipage}\end{center}
\end{block}


\end{textblock}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{textblock}{28.5}(30,6.3)

\begin{block}{Data reduction} \justifying
\begin{center}\begin{minipage}{28cm}
 Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.\end{minipage}\end{center}
 
\begin{table}
\begin{tabular}{c c}
\begin{minipage}{14cm} 
\begin{center}
\begin{figure}
\includegraphics[width=10.0cm]{adobe.eps}
\caption{A caption}
\end{figure}
\end{center}
\end{minipage} 
&
\begin{minipage}{14cm}
\begin{figure}
\includegraphics[width=10.0cm]{adobe.eps}
\caption{A caption.}
\end{figure}
\end{minipage}

\end{tabular} \end{table}  
\begin{center}\begin{minipage}{28cm}
Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis.\end{minipage}\end{center}  
 
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Map of $\displaystyle \sum_{i}^{}(A(\lambda_{i})_{obs.}-A(\lambda_{i})_{calc.})^{2}$ as a function of pK$_{\textrm{a}}$s}
\end{figure}
\end{center}

\end{block}

\begin{block}{Fringilla nulla}
\justifying
Donec aliquam fringilla nulla, et ornare urna blandit id. In blandit lacinia massa quis tempus. Cras vel feugiat mi. Nullam risus nunc, aliquam non facilisis sit amet, condimentum id felis. $\displaystyle \frac{1}{T_{2r}}\approx\frac{C_{m}}{C_{aq}} \cdot k$:
\begin{eqnarray}
-\Delta H^{\ddag} \frac{1}{T} + \Delta S ^{\ddag}&=& R \cdot ln (\frac{\pi}{p_{m}}\frac{h}{k_{b}}\frac{1}{T}\Delta \nu) \nonumber
\end{eqnarray}

\begin{table}
\begin{tabular}{c c}
\begin{minipage}{14cm}
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Observed $\Delta$H$^{\ddag}$ as a function of pH.}
\end{figure}
\end{center}
\end{minipage}
&
\begin{minipage}{14cm}
\begin{center}
\begin{figure}
\includegraphics[width=12.6cm]{screenshot.eps}
\caption{Observed $\Delta$S$^{\ddag}$ as a function of pH.}
\end{figure}
\end{center}
\end{minipage}
\end{tabular} \end{table}
\begin{center}\begin{minipage}{28cm}
 Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. 
\end{minipage}\end{center}
\end{block}

\begin{block}{Summary}
\begin{center}\begin{minipage}{28cm}
\begin{itemize}
\item Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. Phasellus nec nisl quam. 
\item Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. Phasellus nec nisl quam. 
\end{itemize}
\end{minipage}\end{center}
\end{block}

\begin{block}{Acknowledgements} \justify
\begin{center}\begin{minipage}{28cm}
Ut ultrices ipsum vitae ipsum sagittis eget egestas dui interdum. \\
Phasellus nec nisl quam. \\
\end{minipage}\end{center}
\end{block}


\end{textblock}
\end{frame}
\end{document}


36. PDF and annotation/editing under linux -- no solutions

Update: There are newer posts here and here.


Galley proofs of scientific articles are typically provided in the form of pdf files with ambiguous passages and editorial suggestions marked. You are then expected to add comments to the pdf indicating whether you agree to changes and/or clarifications. Well, good luck doing that.

It does appear that Acrobat Reader (9.4.x under linux, 10.1.1 under windows) does not support annotation/commenting anymore. See picture for security settings:

I fooled around with pdf2ps + ps2pdf, pdftk allow AllFeatures etc. No luck. Still no annotation in acroread.

PDFedit didn't help much. It looks like an advanced piece of software, but it offers no obvious way of making post-it type comments. The best approximation is adding text to the margins, but it's not what I set out to do.

Sadly, using wine + pdf x-change viewer (http://appdb.winehq.org/objectManager.php?sClass=application&iId=5549) is at the time of writing the best solution. You can download the free version here: http://www.tracker-software.com/product/pdf-xchange-viewer (there's also a 'pro' version)

It really is a straightforward piece of software, and does the trick, so no complaints there. However, it is very unfortunate that such a central piece of functionality is unavailable under linux.

Also, it does seem that acrobat reader is intentionally crippled -- from what I understand there is no obvious reason why commenting isn't allowed (i.e. not the fault of the authors of the pdf) other than because Adobe wants you to shill out money for their 'Pro' version (...interesting how FOSS normally doesn't market itself by adding X or Pro to the name...)


20 December 2011

35. Fixing: gnome alt+f2 broken, returns command not found -- debian testing current bug, description and solution

22/12/2011
An explanation and solution is here: http://forums.linuxmint.com/viewtopic.php?f=198&t=67502&p=510197#p512994

SOLUTION
--------------
My version of the solution above is a follows:

1. First, locate the file to edit

locate utils.js | grep misc

which returns

/usr/share/gnome-shell/js/misc/util.js

2. Next, confirm that argc is present (this is what's causing the problems)

cat /usr/share/gnome-shell/js/misc/util.js | grep argc

which returns

        let [success, argc, argv] = GLib.shell_parse_argv(command_line);
    let success, argc, argv;
        [success, argc, argv] = GLib.shell_parse_argv(command_line);

There are more elegant ways of doing this, but this is how I roll.

3. Edit /usr/share/gnome-shell/js/misc/util.js as root

sudo vim /usr/share/gnome-shell/js/misc/util.js (you can of course use gedit, nano, emacs etc.)

search for argc and remove all instances of of it, so that
[success, argc, argv] turns into to  [success, argv]
etc.

Once you've removed all argc, save and then hit alt+f2 in gnome, type r and enter to restart the shell. Then hit alt+f2 and type e.g. gedit to test it

It now works!

Reading through bug reports it seems it won't be fixed in Debian -- instead we'll have to wait until gnome 3.2 rolls out. Or just follow the instructions above.

-------------------------------
THE OLD POST
20/12/2011

(Current version of gnome-shell is 3.0.2-8+b1)


Hitting alt+f2 to start e.g. gedit or another program used to be straightforward.

During the past week it hasn't worked properly though -- instead the entry of any command has returned a 'command not found'. If you instead of simply typing in gedit type in /usr/bin/gedit, chances are the computer will experience an odd sort of freeze -- the top bar will be unresponsive, the black entry box will remain, the screen will be shaded, but gedit won't open. You will, however, be able to continue using your computer, but it'll be a dark experience.

Symptomatic descriptions of the bug and experiences are available here:
https://bugzilla.redhat.com/show_bug.cgi?id=719675
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/816762