Skip to content

Instantly share code, notes, and snippets.

@wadoon
Created February 3, 2025 06:06
Show Gist options
  • Select an option

  • Save wadoon/109ff865da399110048b3abe09e25851 to your computer and use it in GitHub Desktop.

Select an option

Save wadoon/109ff865da399110048b3abe09e25851 to your computer and use it in GitHub Desktop.
Helmholtz Reporting via Latex

How to make Helmholtz reporting with LaTeX if the final document should be in Word.

Benefits

  • You can write collaboratively using Overleaf
  • Your bibliography is managed. You gain a list of referenced papers.

The process

  1. Use a special preamble to customize everything to the needs:

    1. Set font, page layout etc. (Note, that LaTeX is better in text setting. It is more compact and better readable. Hence, add some millimeters to the bottom margin.)
    2. Customize the Biblatex key definitions, s.t. the three-letter-year format is adhered to.
    3. Customize that from the DOI or URL value the hyperlink is set.
    4. Also, if the DOI or URL is missing, warnings are printed in the document.
  2. Write the report.

  3. Finalize the report using

    htlatex report.tex
    

    This commands renders the report as HTML which can be turned into word by copy-paste. (Pandoc has not worked very well.) If anything is not so perfect, e.g., the heading depth is wrong, it might be easier to just replace the tags inside HTML.

  4. Correct last formatting, especially the heading or hypenation. The hyperlinks were transfered correctly.

\documentclass[a4paper,10pt]{report}
\usepackage[top=2.5cm,left=3cm,right=3cm,bottom=2.5cm]{geometry}
\usepackage[table,xcdraw]{xcolor}
\usepackage{array}
\usepackage{enumitem}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{anyfontsize}
\usepackage{microtype}
%\usepackage{showkeys}
\usepackage{tikz}\usetikzlibrary{calc,fit}
% set font to helvet as a substitute for Arial
\usepackage{helvet}\renewcommand\familydefault{\sfdefault}
% Helmholtz dark and light blue colors
\definecolor{helmholtz}{RGB}{0,40,100}
\definecolor{helmholtz-light}{RGB}{20,200,255}
% cell color: dark and light blue
\newcommand\celldark{\cellcolor[HTML]{0A2864}\color{white}}
\newcommand\celllight{\cellcolor[HTML]{CDEEFB}}
\usepackage[]{hyperref}
\usepackage{todonotes}
\usepackage{multicol}
\usepackage{tabularx,booktabs}
\newcommand{\KeY}{Ke\kern-0.1emY}
\newcommand{\hsd}[2]{\href{https://helmholtz.software/software/#2}{#1}}
% hints
\iffalse% todo on
\newcommand\definetodo[2][blue!50]{
\expandafter\newcommand\csname #2todo\endcsname[1]{%
\begingroup\color{#1}[#2: ##1]\endgroup}
}
\newcommand\awtd[1]{\begingroup\color{orange!50!black}[AW: #1]\endgroup}
\else% todo off
\newcommand\definetodo[2][blue!50]{
\expandafter\newcommand\csname #2todo\endcsname[1]{}%
}
\newcommand\awtd[1]{}
\fi
\newcommand\awhint[1]{\begingroup\color{purple!50}[AW: #1]\endgroup}
\newenvironment{hint}{\begingroup\color{purple!50}\noindent}{\endgroup}
\newcommand{\myparagraph}[1]{\par\textit{#1.}\enspace}
\setlength{\parskip}{6pt}
\setlength{\parindent}{0pt}
\renewcommand{\partname}{Volume}
\usepackage[backend=biber
,style=alphabetic
% ,bibstyle=numeric
% ,citestyle=numeric
,sorting=ynt%nyt
,maxnames=99
%,block=none
,hyperref=true
,abbreviate=true
,isbn=false
,eprint=false
,useeditor=false
%,defernumbers=true
,hyperref
%,refsegment=part
%,giveninits=true
,uniquename=true
,backref=true
,url=true]{biblatex}
% Modify the bilbiography to only print url if no doi is present
\renewbibmacro*{doi+eprint+url}{%
\printfield{doi}%
\newunit\newblock%
\iftoggle{bbx:eprint}{%
\usebibmacro{eprint}%
}{}%
\newunit\newblock%
\iffieldundef{doi}{%
\usebibmacro{url+urldate}}%
{}%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\textcolor{red}{\bfseries ALARM ALARM NO DOI/URL!}
}{}{}%
}
}
\iftrue
\DeclareLabelalphaTemplate{
\labelelement{
\field[final]{shorthand}
\field{label}
\field[strwidth=3,strside=left,names=1,noalphaothers=true,uppercase=true]{labelname}
}
\labelelement{
\field[strwidth=2,strside=right]{year}
}
}
%
\renewbibmacro*{cite}{%
\iffieldundef{doi}{%
\iffieldundef{url}{\textcolor{red}{\printfield{labelalpha}\printfield{extraalpha}}}{%
\href{\thefield{url}}{\printfield{labelalpha}\printfield{extraalpha}}}%
}{%
\href{http://doi.org/\thefield{doi}}{\printfield{labelalpha}\printfield{extraalpha}}}}
\fi
\setcounter{secnumdepth}{3}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment