Make \sections begin on even-numbered pages in documentclass scrartcl

I am using the scrartcl class for a bunch of documents and I would like to start every \section (including \tableofcontents) on even-numbered pages. I am using custom headers, so I would also be grateful if the pages between the end of a section and the start of another one (if they exist) to be relatively blank (i.e., showing the foot and not showing the header).

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code as I did in my edit. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  Stephen Dec 3 '12 at 20:40
Yeah, I use other StackExchange sites, but I don't use to make questions very often and I forgot how to properly make them :P –  Alfredo Hernández Dec 3 '12 at 20:47

Here's one possibility using etoolbox to patch \section to include \cleardoubleevenstandardpage:

\documentclass[twoside=semi]{scrartcl}
\usepackage{etoolbox}

\pretocmd{\section}{\cleardoubleevenstandardpage}{}{}

\begin{document}

\tableofcontents
\section{Test Section One}
\section{Test Section Two}

\end{document}


The value semi for twoside results in a double-sided typesetting with single-sided margins. For the requirement about the "empty" pages, perhaps it would be better to use \cleardoubleevenemptypage:

\documentclass[twoside=semi]{scrartcl}
\usepackage{etoolbox}

\pretocmd{\section}{\cleardoubleevenemptypage}{}{}

\begin{document}

\tableofcontents
\section{Test Section One}
\section{Test Section Two}

\end{document}

-
It works flawlessly, but is there any option to accomplish it without using twoside on the documentclass? Or keeping it but avoiding the typical margins left/right marigns of two-sided documents (i.e., I want all the pages to be aligned in the same way)? –  Alfredo Hernández Dec 3 '12 at 20:29
Ok, I'm using '\usepackage[hmarginratio=1:1]{geometry}' to get odd and even pages using the same margins. But I don't understand how to use '\cleardoubleevenusingstyle{<page style>}'. Where should I put it? –  Alfredo Hernández Dec 3 '12 at 21:07
@AlfredoHernández \cleardoubleevenusingstyle{<page style>} must be used instead of \cleardoubleevenstandardpage in my example code; so, you should use \pretocmd{\section}{\cleardoubleevenusingstyle{<page style>}}{}{} in the preamble (of course, changing <page style> to the desired page style). Also, perhaps using twoside=semi might solve the margin issue without the geometry package. Please see my updated answer. –  Gonzalo Medina Dec 3 '12 at 21:22
Everything works fine, except for the \cleardoubleevenusingstyle{<page style> part. This is how my code looks like: paste.ubuntu.com/1408909 I don't know what I am doing wrong. –  Alfredo Hernández Dec 3 '12 at 21:43
@AlfredoHernández since you want the empty page style, then simply using \cleardoubleevenemptypage is better (see the second example code in my updated answer). Also, the KOMA-Script classes offer their own mechanism to build headers (using scrpage2 instead of fancyhdr); please refer to the documentation. –  Gonzalo Medina Dec 3 '12 at 21:53
show 1 more comment

An example how you can do it without option twoside shows the following MWE (and without changing right and left margins):

%http://tex.stackexchange.com/questions/85382
\documentclass[%
paper=a4
%,twoside
%,open=left
]{scrartcl}  % scrartcl scrreprt

\usepackage{blindtext}

\begin{document}

\tableofcontents

%\ifthispageodd{right}{left}
\ifthispageodd{\newpage}{\newpage~\newpage}
%\chapter{Chapter One}
\section{Test Section One}
\blindtext[3]
\ifthispageodd{\newpage}{\newpage~\newpage}
\section{Test Section Two}
\blindtext[3]
\ifthispageodd{\clearpage}{\cleardoublepage}
%\chapter{Chapter Two}

\end{document}


Macro \ifthispageodd is defined in KOMA-Script. With \newpage I go to the next side, with \newpage~\newpage (~ is important to get a second page!) I insert one blank page.

With package etoolbox you can use the following MWE:

%http://tex.stackexchange.com/questions/85382
\documentclass[%
paper=a4
]{scrartcl}  % scrartcl scrreprt

\usepackage{blindtext}

\usepackage{etoolbox}
\pretocmd{\section}{\ifthispageodd{\newpage}{\newpage~\newpage}}{}{}

\begin{document}

\tableofcontents

\section{Test Section One}
\blindtext[3]
\section{Test Section Two}
\blindtext[3]
\end{document}
`
-