[Tex/LaTex] \hspace before \section

spacing

I would like to add a space before a section heading.

I have tried:

\hspace[*]{5pt}\setkomafont{section}{\fontsize{45}{40}\selectfont  
\fontspec{Mathilde}}

unsuccessfully. I realise that Latex usually discards white space at the start of a line e.g. a section heading.

I would appreciate any pointers how I may achieve a space before a section heading of 0.5 inches.

\documentclass[11pt,english,british,twoside,openany]{scrbook}
\usepackage{mystyle}

\begin{document}

\title{\mytitle}
\author{}
\date{}

\frontmatter
\maketitle
\begin{titlepage}
\begin{flushright}
{\huge \mytitle}
\par\end{flushright}{\huge \par}
\end{titlepage}

\begin{titlepage}
\noindent\includegraphics[width=4in,height=2in]{../img/titr_ben_sig}
\vspace*{0.5in}
\begin{flushright}
\Huge{Tears in the Rain}
\par\end{flushright}{\Huge \par}

\clearpage
\thispagestyle{empty}

\begin{center}
\emph{Copyright}
\end{center}
\begin{center}
\textcopyright{ 2014 Ben Francis All rights reserved.}
\end{center}
\vspace*{0.5in}
\begin{center}
\begin{minipage}[t]{0.5\paperwidth}
\end{minipage}
\end{center}
\vspace*{0.5in}
\begin{center}
ISBN:
\end{center}
\vspace*{0.2in}
\begin{center}
A CIP Record for this book is available from the British
Library.
\end{center}
\vspace*{0.1in}
\begin{center}
Typeset in \LaTeXe
\end{center}
\end{titlepage}

\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\tableofcontents

\input{matter.tex}

\end{document}[/MWE]

My style file is:

[MWE]
\ProvidesPackage{mystyle}
\usepackage{lettrine}
%\usepackage{blindtext}
\usepackage[automark,headsepline,footsepline=.25pt]{scrlayer-scrpage}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{graphicx}
\graphicspath{ {../img/} }
\usepackage{wrapfig}
\usepackage[british]{babel}
\pagestyle{scrheadings}
\addtokomafont{pageheadfoot}{\slshape}
\addtokomafont{pagehead}{\normalsize}
\addtokomafont{pagefoot}{\normalsize}
\addtokomafont{disposition}{\rmfamily}% rm for chapter headings
%\addtokomafont{trajon pro}{\rmfamily}
%\ohead{\pagemark} %Page Number
%\ihead{\mytitle} %Book Title
\chead{\textbf {Ben Francis}}
\ofoot{} %Author Name
\ifoot{} % Chapter Number
\lehead{\textbf \pagemark}
%\cehead{Ben Francis}
\rohead{\textbf \pagemark}
\cohead{\textbf {\mytitle}}
\setkomafont{section}{\textit}{\normalsize}
\renewcommand\thepart{\Alph{part}}
\usepackage{fontspec}
\linespread{1.05}
\parindent=0.25in
\parskip=2pt
%removes overrun on outside margin
\usepackage{hyphenat}
\tolerance=1000
\hyphenpenalty=1000
\setmainfont{Linux Libertine O} %clear font, typographers quote marks
\renewcommand*{\partpagestyle}{empty}
\usepackage{geometry}
\geometry{paperwidth=5.06in,paperheight=7.81in,
verbose,
tmargin=0.75in,
bmargin=0.75in,
inner=0.75in,
outer=0.5in,
headheight=0.1in,
headsep=0.15in,
footskip=0.45in,
twoside}
\newcommand{\mytitle}{Tears in the Rain} 
\newcommand{\emptx}[1]{\textit{#1}}

%Add space above chapter titles
\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\normalsize}
\titlespacing*{\chapter}{0pt}{25pt}{1pt}%Second number changes space
%amount

\hspace[*]{5pt}\setkomafont{section}{\fontsize{45}{40}\selectfont
\fontspec{Mathilde}}
\setkomafont{subsection}{\small}
\setkomafont{subsubsection}{\small}
\setkomafont{paragraph}{\normalsize}
\setkomafont{subparagraph}{\normalsize}

Best Answer

Use \RedeclareSectionCommand to set the indent of the section title. Using this command you can also change the font:

\RedeclareSectionCommand[
  indent=.5in,
  font=\fontsize{45}{40}\selectfont\mdseries\mathilde
]{section}

Note that I have reduced your code for the following example:

enter image description here

Code:

\documentclass{scrbook}
\usepackage{lipsum}

\linespread{1.05}
\setlength\parindent{.25in}

\usepackage{fontspec}
\newfontfamily\mathilde{Mathilde}

\addtokomafont{disposition}{\rmfamily}

    \RedeclareSectionCommand[
      indent=.5in,
      font=\fontsize{45}{40}\selectfont\mdseries\mathilde
    ]{section}

\begin{document}
\section{Section}
\lipsum[1-20]
\end{document}

Additional remarks:

  • It is not recommended to use titlesec with a KOMA-Script class. You will get warnings. Use \RedeclareSectionCommand and other KOMA-Script possibilities instead.
  • Do not set a \parskip manually. KOMA-Script classes know a parskip option with different values. Note that it is unusual to use a \parindent and a \parskip. If you really want set \parindent to 2pt use the KOMA-Script command \setparsizes{.25in}{2pt}{0pt plus 1fil}. But this \parskip may cause your problem in Book Layout in Latex.
  • Use \addtokomafont and \setkomafont to change the font of the header and the page number in the header.