Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

My title marks are not working as I want them to. I had to move away from using the native section and subsectionand therefore my title marks does not work. I had a look at the extramarks feature of the titelps package but can't figure it out especially to use alongside the titlesec package.

On page 3 of this MWE this is the idea of what I want: Correct

However, this is what I get because the section and subsection does not register: Problem

How do I add Section and Subsection into the title marks? Or else how do I force section and subsection to still increment and actually work in the title marks?

This question relates to the discussion in one of my old questions. Calculating the exact width of text and the lettrine

Please run in XeLaTeX.

\documentclass[pagesize=pdftex, fontsize=12]{scrbook}
\usepackage[paperwidth=15.6cm, paperheight=23.4cm, top=2cm,bottom=1cm, left=1cm, right=1cm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lettrine}
\usepackage{xltxtra}
\usepackage{tocloft}
\usepackage{etoolbox}
\usepackage[toc]{multitoc}
\usepackage{setspace}
\usepackage{needspace}
\usepackage{calc}
\usepackage{fix2col} %fixes numbering of the sections in the header for two columns

\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Times New Roman}

\usepackage{polyglossia} 
    \setmainlanguage{spanish} 

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}

\setcounter{tocdepth}{0}
\setcounter{secnumdepth}{2}

% sets the marks to be used (section and subsection)
\setmarks{section}{subsection}

% definition of the page style with required headers
\newpagestyle{Biblestyle}{
  \setheadrule{.02pt}
  \sethead[\thepage][\chaptertitle][\firsttitlemarks\thesection:\ifthesubsection{\firsttitlemarks\thesubsection}{1}---\bottitlemarks\thesection:\bottitlemarks\thesubsection]{\firsttitlemarks\thesection:\ifthesubsection{\firsttitlemarks\thesubsection}{1}---\bottitlemarks\thesection:\bottitlemarks\thesubsection}{\chaptertitle}{\thepage}
}

\addtokomafont{disposition}{\rmfamily\mdseries}

\newcommand{\newtocname}{\LARGE{TABLA DE LOS LIBROS DEL}}
\renewcommand*\cfttoctitlefont{\huge\hfill}
\renewcommand*\cftaftertoctitle{\hfill}
\renewcommand{\cftchapdotsep}{\cftdot}
\renewcommand{\cftpartfont}{\bfseries}
\renewcommand{\cftchapfont}{\mdseries}
\cftpagenumbersoff{part}
\renewcommand{\cftchappagefont}{\hfill\mdseries}
\setlength{\cftbeforetoctitleskip}{-4.7em}
\setlength{\cftaftertoctitleskip}{1pt}
\setlength{\cftbeforechapskip}{.1em}
\setlength{\cftbeforepartskip}{.1em}
\setlength{\columnsep}{3em}
\setlength\columnseprule{.4pt}

\newcommand{\Sectionnumber}{%
  \sbox\Sectionbox{\smash{\raisebox{-\baselineskip}{%
    \fontsize{2.2\baselineskip}{0}\selectfont\theSection}}\enspace}}

\newcounter{Section}
\newcounter{Subsection}[Section]
\newlength{\Sectionwidth}
\newif\ifFirstSubsection
\newsavebox{\Sectionbox}

\makeatletter
\newcommand{\Section}{%
  \par\vskip\z@ \@plus 2\p@
  \FirstSubsectiontrue\clubpenalty\@M
  \refstepcounter{Section}\stepcounter{Subsection}%
  \Sectionnumber\setlength{\Sectionwidth}{\wd\Sectionbox}%
  \hangindent\Sectionwidth\hangafter-2
  \leavevmode\llap{\box\Sectionbox}\ignorespaces}
\newcommand{\Subsection}{%
  \par\clubpenalty\@clubpenalty
  \ifFirstSubsection
    \ifnum\prevgraf=\@ne\nobreak\hspace*{\Sectionwidth}\fi
    \FirstSubsectionfalse
  \fi
  \refstepcounter{Subsection}\textbf{\theSubsection}\enspace\ignorespaces}
\makeatother

\parindent=0pt
\parskip=0pt

\begin{document}
\frontmatter
\renewcommand{\contentsname}{\newtocname}
\tableofcontents

\mainmatter
\setlength\columnseprule{0pt}
\pagestyle{Biblestyle}

\twocolumn[\vspace{-0.5cm}\center{\textbf{\Huge{Génesis}}}\vspace{0.5cm}]

\addtocounter{chapter}{1}
\renewcommand{\chaptertitle}{Génesis}
\setcounter{section}{0}

\Section EN el principio crió Dios los cielos y la tierra.
\Subsection Y la tierra estaba desordenada y vacía, y las tinieblas estaban sobre la haz del abismo, y el Espíritu de Dios se movía sobre la haz de las aguas.
\Subsection Y dijo Dios: Sea la luz: y fué la luz.
\Subsection Y vió Dios que la luz era buena: y apartó Dios la luz de las tinieblas.

\Section Y FUERON acabados los cielos y la tierra, y todo su ornamento.
\Subsection Y acabó Dios en el día séptimo su obra que hizo, y reposó el día séptimo de toda su obra que había hecho.
\Subsection Y bendijo Dios al día séptimo, y santificólo, porque en él reposó de toda su obra que había Dios criado y hecho.
\end{document}
share|improve this question
2  
Your sectioning commands should issue mark-commands which stores the wanted content (\markboth{left mark}{right mark} or \markright{right mark}). And your header should use this content with \leftmark or \rightmark (or \firstleftmark etc from the extramarks package). –  Ulrike Fischer Dec 10 '12 at 13:03
add comment

2 Answers 2

Perhapsthis will help you. For me, I use titlesec package, as follows:

\usepackage[compact]{titlesec}
\titleformat{\section}{\Large\scshape}{Section \thesection}{1ex}{}

Which creates "Section 1.x Bla Bla Bla" for the section headings, where the spacing between 1.x and Bla Bla is 1ex.

If you want a prefix "SS" infront of the subsection (in this case, large small caps, seperated by 1ex):

\titleformat{\subsection}{\large\scshape}{SS \thesubsection}{1ex}{}

This will result in "SS 1.x.x Bla Bla Bla" as the subsection headings.

share|improve this answer
add comment
up vote 0 down vote accepted

As Fermat said:

I have discovered a truly marvelous proof of this, which this margin is too narrow to contain.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.