diff --git a/templates/latex.template b/templates/latex.template
index c01f58b45..8d21cf215 100644
--- a/templates/latex.template
+++ b/templates/latex.template
@@ -47,6 +47,8 @@ $if(tables)$
 $endif$
 $if(strikeout)$
 \usepackage[normalem]{ulem}
+% avoid problems with \sout in headers with hyperref:
+\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 $endif$
 $if(subscript)$
 \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
@@ -67,8 +69,6 @@ $if(graphics)$
 \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
 $endif$
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 $if(numbersections)$
diff --git a/tests/biblatex-citations.latex b/tests/biblatex-citations.latex
index 08f49b056..97647cd41 100644
--- a/tests/biblatex-citations.latex
+++ b/tests/biblatex-citations.latex
@@ -5,8 +5,6 @@
 \usepackage{biblatex}
 \bibliography{biblio}
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setcounter{secnumdepth}{0}
diff --git a/tests/latex-reader.latex b/tests/latex-reader.latex
index 26715da7a..135ee57bb 100644
--- a/tests/latex-reader.latex
+++ b/tests/latex-reader.latex
@@ -6,9 +6,9 @@
 
 \newcommand{\textsubscript}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
 \usepackage[breaklinks=true,unicode=true]{hyperref}
+\usepackage[normalem]{ulem}
 % avoid problems with \sout in headers with hyperref:
 \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
-\usepackage[normalem]{ulem}
 \usepackage{enumerate}
 \usepackage{fancyvrb}
 \usepackage{graphicx}
diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex
index 3c5aba598..d34c21090 100644
--- a/tests/lhs-test.latex
+++ b/tests/lhs-test.latex
@@ -3,8 +3,6 @@
 \usepackage[mathletters]{ucs}
 \usepackage[utf8x]{inputenc}
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setcounter{secnumdepth}{0}
diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs
index 238a045ba..29237f820 100644
--- a/tests/lhs-test.latex+lhs
+++ b/tests/lhs-test.latex+lhs
@@ -5,8 +5,6 @@
 \usepackage{listings}
 \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setcounter{secnumdepth}{0}
diff --git a/tests/natbib-citations.latex b/tests/natbib-citations.latex
index fdb4e14fc..f4f5cf452 100644
--- a/tests/natbib-citations.latex
+++ b/tests/natbib-citations.latex
@@ -5,8 +5,6 @@
 \usepackage{natbib}
 \bibliographystyle{plainnat}
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setcounter{secnumdepth}{0}
diff --git a/tests/writer.latex b/tests/writer.latex
index 0337cb56c..e6adff585 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -11,6 +11,8 @@
 }\makeatother
 \usepackage{enumerate}
 \usepackage[normalem]{ulem}
+% avoid problems with \sout in headers with hyperref:
+\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
 \usepackage{url}
 \usepackage{graphicx}
@@ -24,8 +26,6 @@
 \let\Oldincludegraphics\includegraphics
 \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
 \usepackage[breaklinks=true,unicode=true,pdfborder={0 0 0}]{hyperref}
-% avoid problems with \sout in headers with hyperref:
-\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
 \setlength{\parindent}{0pt}
 \setlength{\parskip}{6pt plus 2pt minus 1pt}
 \setcounter{secnumdepth}{0}