Latex


Latex / Beamer: Variable to get current Section name

Recently, we were trying to write a table of contents for a specific section in a Latex / Beamer presentation. Being too lazy to update the frame title each time the section name might change we needed an automation to do that for us!

Luckily, the following variable does the trick: \secname gets the Section name. \subsecname gets the subsection name for those that might need it.

\begin{frame}
	\frametitle{Outline for \secname}
	\tableofcontents[currentsection, hideothersubsections, sectionstyle=show/show] 
\end{frame}


Latex/Beamer: Undefined control sequence. …meroption{show notes on second screen=right}

When trying to enable the option that shows presentation notes on a different monitor using:

\setbeameroption{show notes on second screen=right}

we got the following error:

Undefined control sequence. …meroption{show notes on second screen=right}
Missing \begin{document}. …meroption{show notes on second screen=right}

To fix this issue we enabled the package pgfpages

\usepackage{pgfpages}

To present this special built PDF presentation across two screens we used dspdfviewer.

dspdfviewer is a pre-rendering and caching (read: fast) full-screen pdf viewer specifically designed for latex-beamer presentations, that were created with the show notes on second screen=right option (\setbeameroption{show notes on second screen=right}).

https://dspdfviewer.danny-edel.de/
http://manpages.ubuntu.com/manpages/focal/man1/dspdfviewer.1.html

Special note: when we were testing dspdfviewer on Ubuntu 20.04LTS we thought that the secondary screen had to be on the left of the primary (because of the build command that specifies that notes need to be on the right). That was actually wrong, as you will see in the following picture even though we built the presentation to have the notes on the “right” dspdfviewer was able to work as expected even when the secondary screen was on top of the primary.


Latex / Beamer: Change footline for Boadilla theme

Having a presentation title that was too long, we wanted to change the middle part of the footline on the Boadilla theme to replace the command for the document title (\insertshorttitle) with the command for document subtitle (\insertshortsubtitle).

To do so, we added the following right before the \begin{document} command.

\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
      \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\ifblank\expandafter{\beamer@shortinstitute}{}{~(\insertshortinstitute)}
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertshortsubtitle%\insertshorttitle
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
      \usebeamertemplate{page number in head/foot}\hspace*{2ex} 
    \end{beamercolorbox}
  }%
  \vskip0pt%
}

When compiling the PDF, the result was as expected but we were getting a lot of errors for Undefined Control Sequence in various objects like the \begin{document} and \end{frame} commands. After modifying the following line (for the author name and institution) from this:

\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\ifblank\expandafter{\beamer@shortinstitute}{}{~~(\insertshortinstitute)}

to this:

\usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)

The errors were gone and the results were again the same. The final block that was properly working with no additional errors is the following:

\setbeamertemplate{footline}
{
  \leavevmode%
  \hbox{%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
      \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertshortsubtitle
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
      \usebeamertemplate{page number in head/foot}\hspace*{2ex} 
    \end{beamercolorbox}
  }%
  \vskip0pt%
}

IEEETran Latex Template – Add Copyrights on left bottom of first page of Conference class 2

Using the conference class in the IEEETran Latex template, it blocks you from using the IEEEpubid command that can be used to add the copyright note on the bottom of the screen.

Attempt 1 – Enable overrides only

We added the IEEEoverridecommandlockouts command right after the documentclass directive, that allows us to use functionality in IEEETran that should be blocked depending on the document class.
Then we used the IEEEpubid command right after the documentclass directive to create and print the copyright note:

\IEEEpubid{978-1-5386-2880-5/17/\$31.00~\copyright~2017 IEEE}

Doing so, resulted in printing the copyright note in the bottom middle of the first page. The conference class is a two column style, the left column got pushed up a bit to make space, while the right did not. In the end, half of the copyright note was overlapping with the second column.

Attempt 2 – Solution – Customize IEEEpubid as well

After documentclass we added the IEEEoverridecommandlockouts command to enable functionality that is blocked for the conference class.
Then we created our own IEEEpudid command that places itself in a column and not a page as follows:

\documentclass[conference]{IEEEtran}
%Enabled blocked functionality
\IEEEoverridecommandlockouts
%Define custom IEEEpubid that will place it self in a column and not a page, suitable from conference class
\IEEEpubid{\makebox[\columnwidth]{978-1-5386-2880-5/17/\$31.00~\copyright~2017 IEEE \hfill} \hspace{\columnsep}\makebox[\columnwidth]{ }}

Finally after the maketitle command we added IEEEpubidadjcol to give more space between the copyright note and the body of first column.

\maketitle
%Add space between copyright and text
\IEEEpubidadjcol