21

I've taken to using browsers as my go-to PDF viewer over the last few years and I've noticed that most TeX documents have an issue with the title as it appears in the browser. The title seems to be automatically determined based on the first text that appears after \begin{document}

I've tried setting optional arguments to \title, comments, etc. I've looked for an answer online but haven't found one.

Is there an intended way to explicitly set this value?

Below is a MWE, note that this isn't specific to beamer-type documents.

  • I've generated the file as test.pdf.
  • The browser tab description is: *1.5cm My Presentation [width=0.6\textheight] My Name My University August 23, 2013 - test.pdf
  • The *1.5cm appear due \vspace*{1.5cm}

Code:

\documentclass[9pt,mathserif,aspectratio=169]{beamer}
\usetheme{Montpellier}
\title{
    \vspace*{1.5cm}\\
    \textsc{\LARGE My Presentation}\\
    \includegraphics[width=0.6\textheight]{example-image}\\
    \large My Name\\
    \large My University\\
    \large \today
}
\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}
\end{document}

Here is what shows up on Chrome: Chrome

Here is what shows up on Firefox: Firefox


Edit: Removed unnecessary \centering from above.

Additional information:

  • Compiled using TeXMaker 5.1.3, calling TeXLive 2022
  • Windows 10, Version 10.0.19045 Build 19045
  • To open PDF: Right-click -> open with -> Chrome / Firefox
8
  • 3
    You will usually see the document title there (sometimes suffixed by the filename), which seems to include some formatting stuff do to your image inclusion. I would recommend to manually overwrite these PDF properties for this reason, for example using \hypersetup{pdftitle={Your PDF title},} after including the hyperref package.
    – epR8GaYuh
    Aug 23, 2023 at 4:59
  • 1
    @epR8GaYuh I tried this and it unfortunately didn't work. I think your suggestion is definitely in line with the solution I'm trying to find though.
    – Kvo
    Aug 23, 2023 at 5:23
  • 2
    @Kvo, so I'd put Win10 on the suspect list for now ... I'm not there yet, for reasons ... and you seem to do more or less what I did. So the OS may be the relevant difference. // Can you compile your test.tex on a different computer, not running under Win10? // BTW: do the property windows on your system match my screenshots below?
    – MS-SPO
    Aug 23, 2023 at 5:29
  • 1
    Wrt @epR8GaYuh s remark to my answer, all you want to do is change the content of the browsers TAB ?
    – MS-SPO
    Aug 23, 2023 at 5:35
  • 2
    I can check later what beamer is doing Aug 23, 2023 at 6:23

4 Answers 4

24

Use the usepdftitle=false option to prevent beamer to use the argument of \title as pdftitle. Then you can set your own title with pdftitle and force it into the top with pdfdisplaydoctitle:

\documentclass[9pt,mathserif,aspectratio=169,usepdftitle=false]{beamer}

\usetheme{Montpellier}
\title{
    \vspace*{1.5cm}\\
    \textsc{\LARGE My Presentation}\\
    \includegraphics[width=0.6\textheight]{example-image}\\
    \large My Name\\
    \large My University\\
    \large \today
}
\hypersetup{pdftitle=blub,pdfdisplaydoctitle}

\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}
\end{document}

enter image description here

1
  • 1
    This works perfectly. Thank you.
    – Kvo
    Aug 24, 2023 at 5:31
14

Instead of messing with the content of the title macro, you could use the appropriate fields (\author, \institute, etc.) for your information. Then beamer can pick up the correct title for the pdf meta data.

The main difference between the default beamer title page and your hacked version is the graphic below the title. With a current beamer v3.70, you could simply add it to the title template. As a bonus point, this will give you correct line spacing.

\documentclass[9pt,mathserif,aspectratio=169]{beamer}
\usetheme{Montpellier}

\title{My Presentation}
\author{My Name}
\institute{My University}

\addtobeamertemplate{title}{}{\includegraphics[width=0.6\textheight]{example-image}}

\setbeamerfont{title}{size=\LARGE,series=\scshape}
\setbeamerfont{author}{size=\large}
\setbeamerfont{institute}{size=\large}
\setbeamerfont{date}{size=\large}

\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}
\end{document}

enter image description here

4

Here's yet an other way to do it: define your own template.

  • beamer prepared many templates and predefined macros for this purpose
  • my answer combines a solution proposed by Stefan Kottwitz and (most of) your data
  • for the graphics beamer provides at least a logo
  • please check the manual for more details
  • for more inspiration kindly check for defbeamertemplate here

FireFox:

result

Document properties:

docProp

Code:

% Adapted from this solution: 
% https://tex.stackexchange.com/a/25318/245790

\documentclass[9pt,mathserif,aspectratio=169]{beamer}
\usetheme{Montpellier}

% ~~~ you need to define your own template "what to place where" ~~~~~
\defbeamertemplate*{title page}{customized}[1][]
{
 \begin{center}
  \usebeamerfont{title}\inserttitle\par
  \usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par
  \bigskip
  \usebeamerfont{author}\insertauthor\par
  \usebeamerfont{institute}\insertinstitute\par
  \usebeamerfont{date}\insertdate\par
  \usebeamercolor[fg]{titlegraphic}\inserttitlegraphic   
 \end{center}

}

% ~~~ here you set the content of aboves variables ~~~~
\title{My Presentation}
\subtitle{related to whatever}
\author{My Name}
\institute{My University}
\date{\today}

% ~~~ there you go ~~~~~~~~~
\begin{document}
    \maketitle
\end{document}
3

I'm not sure, how you compile your document, which operating system you're using or how you call test.pdf to open in your browser (please add this information to your question, not to comments).

1. Analysis

However, with these modifications it compiles using Texmaker (Editor, calling MikTex installation) as beamerFileName.pdf from beamerFileName.tex:

  • \usepackage{graphicx}
  • delete or comment out % \centering (you can't center, what's already centered horizontally)

However, as a non-user of class beamer I'm not sure, if your call of the first frame is ok: I suspect, not.

FireFox: beamerFileName.pdf

ff

Explorer:

explorer

\documentclass[9pt,mathserif,aspectratio=169]{beamer}
\usetheme{Montpellier}
\usepackage{graphicx}
\title{
%    \centering
    \vspace*{1.5cm}\\
    \textsc{\LARGE My Presentation}\\
    \includegraphics[width=0.6\textheight]{example-image}\\
    \large My Name\\
    \large My University\\
    \large \today
}
\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}
\end{document}

2. Properties

However, if I check the files properties in the (file) explorer, the field title holds most of the strange "file name" you report:

propExpl

Similar for the documents properties, you can access via the browser, Acrobat etc.:

docProp

For other documentclasses I'd set these fields via \usepackage{hyperref}, see its manual at ctan.org.

3. Conclusion

For some strange reason your computer seems to rebuild the filename using field title AND test.pdf into a kind of URL.

Mine doesen't, neither be double-clicking on beamerFileName.pdf, nor by envoking Acrobat via Texmakers icon.

9
  • 1
    About (3): There is nothing strange about the PDF viewer suffixing the actual PDF metadata title with the actual filename as the website title. For Firefox, this is just how it is implemented in the PDF viewer (pdf.js). Some standalone PDF viewers like Evince do something similar to quickly see which document you actually opened as well.
    – epR8GaYuh
    Aug 23, 2023 at 5:04
  • 1
    Thanks for the insightful answer. I edited my question but I'll post the requested info here too. Compiled TeXMaker 5.1.3//TeXLive 2022 on Windows 10, Version 10.0.19045. To open the PDF it doesn't matter which way (via the viewer button on TeXMaker, setting default PDF viewer, or the 'open with' in the right-click menu.
    – Kvo
    Aug 23, 2023 at 5:21
  • 1
    @epR8GaYuh, true: looks like I interpreted the tabs in the screenshots as the URL displayed. (Mine does the same, see my screenshots.)
    – MS-SPO
    Aug 23, 2023 at 5:33
  • 1
    You don't need to add \usepackage{graphicx}, beamer will automatically load it. Aug 23, 2023 at 9:45
  • Thank you @samcarter_is_at_topanswers.xyz, good to know.
    – MS-SPO
    Aug 23, 2023 at 11:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .