fix(cv-template): compile main_example.tex on apt-packaged moderncv (#242) (#323)

Routes name styling through \namefont (present on every moderncv version) and
hands hyperref to the class via \AtEndPreamble, fixing both 2.3.1 compile
failures; pdfpagemode pinned to UseNone so the hook move cannot flip viewer
behavior. Diagnosis and fix design by camcro0607 (#242); verified on real
Debian bookworm apt moderncv 2.3.1 by ayobamiseun; modern-toolchain and PDF
catalog verification on 2.5.1 at review time.

Co-authored-by: camcro0607 <172529990+camcro0607@users.noreply.github.com>
This commit is contained in:
Oscar Madera
2026-08-15 21:31:41 +02:00
committed by GitHub
co-authored by camcro0607
parent 2ea29b09b9
commit c696b60b77
3 changed files with 63 additions and 20 deletions
+23 -9
View File
@@ -10,28 +10,42 @@
\moderncvstyle{banking}
\moderncvcolor{blue}
% Force both first and last name AND section headings to render in moderncv
% blue (color1). Default banking on lualatex+MiKTeX leaves these black, which
% looks inconsistent with the rest of the blue accent scheme.
\renewcommand*{\firstnamestyle}[1]{{\fontsize{34}{36}\bfseries\upshape\color{color1}#1}}
\renewcommand*{\lastnamestyle}[1]{{\fontsize{34}{36}\bfseries\upshape\color{color1}#1}}
% Force the name and section headings to render in moderncv blue (color1).
% Default banking leaves them black: moderncvstylebanking.sty's \colorlet
% copies (not aliases) the pre-scheme accent colour, so the name colours are
% frozen before \moderncvcolor runs. Re-let them after. \namefont is the hook
% every name-style macro routes through, so this also works on moderncv 2.3.1
% (Debian/Ubuntu apt), which has no \firstnamestyle/\lastnamestyle at all.
\renewcommand*{\namefont}{\fontsize{34}{36}\bfseries\upshape}
\colorlet{firstnamecolor}{color1}
\colorlet{lastnamecolor}{color1}
\colorlet{namecolor}{color1}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\color{color1}#1}}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
% moderncv loads hyperref itself in an \AtEndPreamble hook, so \hypersetup
% must go in an \AtEndPreamble of our own: on moderncv < 2.4 a top-level
% \usepackage{hyperref} clashes with the class's own
% \RequirePackage[unicode]{hyperref}. From 2.4.0 the class passes its options
% through \PassOptionsToPackage instead, which is what removes that clash.
\AtEndPreamble{\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=blue,
pdftitle={[YOUR_NAME] - CV},
pdfpagemode=FullScreen,
}
% Keep pdfpagemode=UseNone: this block runs after moderncv's own
% \AtEndPreamble (moderncv.cls sets pdfpagemode there), so a FullScreen
% value here would win and open every CV in fullscreen presentation mode.
pdfpagemode=UseNone,
}}
\usepackage[scale=0.80]{geometry}
\usepackage{import}
% personal data
\name{[First]}{[Last]}
% If you have no address to list, DELETE this whole line. \address{}{}{} fails
% with "There's no line here to end" on every moderncv version.
\address{[Your Address, City, Country]}{}{}
\phone[mobile]{[+XX XXXXXXXXXX]}
\email{[your.email@example.com]}