# Chapters and verses of current page in header

This question is linked to my other titlesec question

Does any one know how to add the current segment location at the top of any particular page.

What I need is the reference at the top of a typical Bible page showing which text is on the current page.

For example: If the current page contains part or all of Exodus chapter 15 verse 4 to part or all of Exodus chapter 18 verse 9, the text in the page header alongside the page number needs to show "15:4 - 18:9".

In my search so far I've found references to using the ledmac package.

For example, I think problem at the following url is of a similar kind of problem, but I can't see where the solution to my particular problem is given. http://markmail.org/message/rmylweubecvy4nyp#query:+page:1+mid:3fhvswygyu2tnpo6+state:results

He referenced the following url, but that also does not solve the problem, even though in my limited knowledge, I think it's heading in the right direction. http://www.djdekker.net/ledmac/#bible

===============================================

# Additional questions based on Gonzalo's answer:

I am able to get the references in the header with the titlesec package. The remaining problems are evident from my output.

The \section{} appears as a number representing the chapter. The \subsection{} appears as another number representing the verse. The ideal would be to format it in the body to show only the chapter number at the first verse and then the numbers 2 and greater for the rest of the verses. In the past when not using titlesec, I was able to get something looking this way by using the lettrine package/command. Please see below:

Is it possible to produce the same output using this titlesec package? If not, is it possible to modify the following code to move the chapter number appearing in the left margin down a bit to align it with the first verse?

Furthermore the spacing in between the subsection lines (verses) is a little bit too much. How do I make them a little smaller?

Here is my current code:

\documentclass[a5paper]{article}
\usepackage[pagestyles, compact]{titlesec}
\usepackage{lettrine}

\renewcommand\thesubsection{\arabic{subsection}}

% quick redefinition of \section and \subsection to imitate Bible chapters and verses
%\titleformat{\section}[runin]
%  {\normalfont\normalsize\bfseries}{\Large\thesection}{1em}{}

\titleformat{\section}[leftmargin]
{\normalfont\Large
\bfseries\filleft}
{\thesection}{0em}{}
\titlespacing{\section}
{-2pc}{-1pc}{1pc}

\titleformat{\subsection}[runin]
{\normalfont\normalsize\bfseries}{\textsuperscript{\thesubsection}}{1em}{}

% definition of the page style with required headers
\newpagestyle{Biblestyle}{
[]
[\thepage]
{\thepage}
{}
{\toptitlemarks\thesection:\toptitlemarks\thesubsection---\bottitlemarks\thesection:\bottitlemarks\thesubsection}}
\pagestyle{Biblestyle}

\begin{document}
\section{}
\subsection{} In the beginning God created the heaven and the earth.
\subsection{} And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
\subsection{} And God said, Let there be light: and there was light.
\subsection{} And God saw the light, that it was good: and God divided the light from the darkness.
\subsection{} And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day.
\subsection{} And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters.
\subsection{} And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so.
\subsection{} And God called the firmament Heaven. And the evening and the morning were the second day.
\subsection{} And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so.
\subsection{} And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good.
\subsection{} And God said, Let the earth bring forth grass, the herb yielding seed, and the fruit tree yielding fruit after his kind, whose seed is in itself, upon the earth: and it was so.
\subsection{} And the earth brought forth grass, and herb yielding seed after his kind, and the tree yielding fruit, whose seed was in itself, after his kind: and God saw that it was good.
\subsection{} And the evening and the morning were the third day.
\section{}
\subsection{} Thus the heavens and the earth were finished, and all the host of them.
\subsection{} And on the seventh day God ended his work which he had made; and he rested on the seventh day from all his work which he had made.
\subsection{} And God blessed the seventh day, and sanctified it: because that in it he had rested from all his work which God created and made.
\subsection{} These are the generations of the heavens and of the earth when they were created, in the day that the LORD God made the earth and the heavens,
\subsection{} And every plant of the field before it was in the earth, and every herb of the field before it grew: for the LORD God had not caused it to rain upon the earth, and there was not a man to till the ground.
\subsection{} But there went up a mist from the earth, and watered the whole face of the ground.
\subsection{} And the LORD God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living soul.
\subsection{} And the LORD God planted a garden eastward in Eden; and there he put the man whom he had formed.
\subsection{} And out of the ground made the LORD God to grow every tree that is pleasant to the sight, and good for food; the tree of life also in the midst of the garden, and the tree of knowledge of good and evil.
\subsection{} And a river went out of Eden to water the garden; and from thence it was parted, and became into four heads.
\subsection{} The name of the first is Pison: that is it which compasseth the whole land of Havilah, where there is gold;
\subsection{} And the gold of that land is good: there is bdellium and the onyx stone.
\subsection{} And the name of the second river is Gihon: the same is it that compasseth the whole land of Ethiopia.
\subsection{} And the name of the third river is Hiddekel: that is it which goeth toward the east of Assyria. And the fourth river is Euphrates.
\subsection{} And the LORD God took the man, and put him into the garden of Eden to dress it and to keep it.
\section{}
\subsection{} Now the serpent was more subtil than any beast of the field which the LORD God had made. And he said unto the woman, Yea, hath God said, Ye shall not eat of every tree of the garden?
\subsection{} And the woman said unto the serpent, We may eat of the fruit of the trees of the garden:
\subsection{} But of the fruit of the tree which is in the midst of the garden, God hath said, Ye shall not eat of it, neither shall ye touch it, lest ye die.
\subsection{} And the serpent said unto the woman, Ye shall not surely die:
\subsection{} For God doth know that in the day ye eat thereof, then your eyes shall be opened, and ye shall be as gods, knowing good and evil.
\subsection{} And when the woman saw that the tree was good for food, and that it was pleasant to the eyes, and a tree to be desired to make one wise, she took of the fruit thereof, and did eat, and gave also unto her husband with her; and he did eat.
\subsection{} And the eyes of them both were opened, and they knew that they were naked; and they sewed fig leaves together, and made themselves aprons.
\subsection{} And they heard the voice of the LORD God walking in the garden in the cool of the day: and Adam and his wife hid themselves from the presence of the LORD God amongst the trees of the garden.
\subsection{} And the LORD God called unto Adam, and said unto him, Where art thou?
\subsection{} And he said, I heard thy voice in the garden, and I was afraid, because I was naked; and I hid myself.
\subsection{} And he said, Who told thee that thou wast naked? Hast thou eaten of the tree, whereof I commanded thee that thou shouldest not eat?
\subsection{} And the man said, The woman whom thou gavest to be with me, she gave me of the tree, and I did eat.
\subsection{} And the LORD God said unto the woman, What is this that thou hast done? And the woman said, The serpent beguiled me, and I did eat.
\subsection{} And the LORD God said unto the serpent, Because thou hast done this, thou art cursed above all cattle, and above every beast of the field; upon thy belly shalt thou go, and dust shalt thou eat all the days of thy life:
\subsection{} And I will put enmity between thee and the woman, and between thy seed and her seed; it shall bruise thy head, and thou shalt bruise his heel.
\subsection{} Unto the woman he said, I will greatly multiply thy sorrow and thy conception; in sorrow thou shalt bring forth children; and thy desire shall be to thy husband, and he shall rule over thee.
\section{}
\subsection{} And Adam knew Eve his wife; and she conceived, and bare Cain, and said, I have gotten a man from the LORD.
\subsection{} And she again bare his brother Abel. And Abel was a keeper of sheep, but Cain was a tiller of the ground.
\subsection{} And in process of time it came to pass, that Cain brought of the fruit of the ground an offering unto the LORD.
\subsection{} And Abel, he also brought of the firstlings of his flock and of the fat thereof. And the LORD had respect unto Abel and to his offering:
\subsection{} But unto Cain and to his offering he had not respect. And Cain was very wroth, and his countenance fell.
\subsection{} And the LORD said unto Cain, Why art thou wroth? and why is thy countenance fallen?
\subsection{} If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and thou shalt rule over him.
\subsection{} And Cain talked with Abel his brother: and it came to pass, when they were in the field, that Cain rose up against Abel his brother, and slew him.
\subsection{} And the LORD said unto Cain, Where is Abel thy brother? And he said, I know not: Am I my brother's keeper?
\subsection{} And he said, What hast thou done? the voice of thy brother's blood crieth unto me from the ground.
\subsection{} And now art thou cursed from the earth, which hath opened her mouth to receive thy brother's blood from thy hand;
\subsection{} When thou tillest the ground, it shall not henceforth yield unto thee her strength; a fugitive and a vagabond shalt thou be in the earth.

\end{document}

-
Can you give a minimal working example of how you typeset your text currently? – ℝaphink Aug 22 '11 at 12:02
I've added some code/examples based on answer below. Hope it clarifies what I need. – McGafter Aug 23 '11 at 12:31
About your numbering issue & using a lettrine, you can have a look at how I do it in github.com/raphink/geneve_1564/blob/master/geneve_1564.tex, in particular \bverse and \bversenonum. (The PDF is in the upper directory). In particular, I would map verses to paragraphs rather than subsections. – ℝaphink Aug 23 '11 at 12:40
A comment on the content: The LORD is usually typeset in small caps. – ℝaphink Aug 23 '11 at 13:02

Here's a possible solution using the \toptitlemarks, \bottitlemarks mechanism of the titlesec package:

\documentclass[twoside]{article}
\usepackage[pagestyles]{titlesec}

\renewcommand\thesubsection{\arabic{subsection}}

% quick redefinition of \section and \subsection to imitate Bible chapters and verses
\titleformat{\section}[runin]
{\normalfont\normalsize\bfseries}{\Huge\thesection}{1em}{}
\titleformat{\subsection}[runin]
{\normalfont\normalsize\bfseries}{\textsuperscript{\thesubsection}}{1em}{}

% definition of the page style with required headers
\newpagestyle{Biblestyle}{
\bottitlemarks\thesection:\bottitlemarks\thesubsection]
[]
[\thepage]
{\thepage}
{}
{\toptitlemarks\thesection:\toptitlemarks\thesubsection---%
\bottitlemarks\thesection:\bottitlemarks\thesubsection}}
\pagestyle{Biblestyle}

% a command to generate some filler text
\newcommand\Text{Lorem ipsum sit amet, consectetuer elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}

\begin{document}

\section{}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\section{}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text\Text\Text\Text\Text\Text\Text\Text\Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text
\section{}
\subsection{} \Text
\subsection{} \Text
\subsection{} \Text

\end{document}


The subsection mark in the first page is not showing correctly (it's not showing at all), but my code could give you some ideas as how to proceed.

-
Thanks Gonzalo. Your answer is definitely a step in the right direction for me But I still have a few problems I need some help on. Have a look at my original question, I'll add some of your code (modified) and output examples, with an explanation of what I need. – McGafter Aug 23 '11 at 11:53
@Mcgafter: I think it is a good idea if you open a new question with the new requirement about the sectional headings, since this question was about a different topic. You can link this question in the new one, and Raphink can move his answer below to that new question. This would help to keep the site more organized. What do you think? – Gonzalo Medina Aug 23 '11 at 17:09
I've accepted your answer, although Raphink answer was very helpful too. Yet my problem remains therefore I'll start a new question. Thanks. – McGafter Aug 24 '11 at 10:45
@Mcgafter: I've added an answer to your new question. – Gonzalo Medina Aug 24 '11 at 14:22

Here is my suggestion based on your code and Gonzalo's answer:

\documentclass[paper=a6,pagesize=pdftex]{scrbook}
\usepackage[pagestyles, compact]{titlesec}
\usepackage{lettrine}

\renewcommand\thesubsection{\arabic{subsection}}

% quick redefinition of \section and \subsection to imitate Bible chapters and verses
%\titleformat{\section}[runin]
%  {\normalfont\normalsize\bfseries}{\Large\thesection}{1em}{}

\titleformat{\section}[leftmargin]
{\normalfont\Large
\bfseries\filleft}
{\thesection}{0em}{}
\titlespacing{\section}
{-2pc}{-1pc}{1pc}

\titleformat{\subsection}[runin]
{\normalfont\normalsize\bfseries}{\textsuperscript{\thesubsection}}{1em}{}

% definition of the page style with required headers
\newpagestyle{Biblestyle}{
[]
[\thepage]
{\thepage}
{}
{\toptitlemarks\thesection:\toptitlemarks\thesubsection---\bottitlemarks\thesection:\bottitlemarks\thesubsection}}
\pagestyle{Biblestyle}

\newcommand{\bchapter}{%
\setcounter{subsection}{1}%
\lettrine{\thesection}{}~%
}

\newcommand{\bverse}{%
\par
}

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

\renewcommand{\LettrineFontHook}{\bfseries}

\setlength{\parindent}{-2pt}

\begin{document}
\bchapter In the beginning God created the heaven and the earth.
\bverse And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
\bverse And God said, Let there be light: and there was light.
\bverse And God saw the light, that it was good: and God divided the light from the darkness.
\bverse And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day.
\bverse And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters.
\bverse And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so.
\bverse And God called the firmament Heaven. And the evening and the morning were the second day.
\bverse And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so.
\bverse And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good.
\bverse And God said, Let the earth bring forth grass, the herb yielding seed, and the fruit tree yielding fruit after his kind, whose seed is in itself, upon the earth: and it was so.
\bverse And the earth brought forth grass, and herb yielding seed after his kind, and the tree yielding fruit, whose seed was in itself, after his kind: and God saw that it was good.
\bverse And the evening and the morning were the third day.

\bchapter Thus the heavens and the earth were finished, and all the host of them.
\bverse And on the seventh day God ended his work which he had made; and he rested on the seventh day from all his work which he had made.
\bverse And God blessed the seventh day, and sanctified it: because that in it he had rested from all his work which God created and made.
\bverse These are the generations of the heavens and of the earth when they were created, in the day that the LORD God made the earth and the heavens,
\bverse And every plant of the field before it was in the earth, and every herb of the field before it grew: for the LORD God had not caused it to rain upon the earth, and there was not a man to till the ground.
\bverse But there went up a mist from the earth, and watered the whole face of the ground.
\bverse And the LORD God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living soul.
\bverse And the LORD God planted a garden eastward in Eden; and there he put the man whom he had formed.
\bverse And out of the ground made the LORD God to grow every tree that is pleasant to the sight, and good for food; the tree of life also in the midst of the garden, and the tree of knowledge of good and evil.
\bverse And a river went out of Eden to water the garden; and from thence it was parted, and became into four heads.
\bverse The name of the first is Pison: that is it which compasseth the whole land of Havilah, where there is gold;
\bverse And the gold of that land is good: there is bdellium and the onyx stone.
\bverse And the name of the second river is Gihon: the same is it that compasseth the whole land of Ethiopia.
\bverse And the name of the third river is Hiddekel: that is it which goeth toward the east of Assyria. And the fourth river is Euphrates.
\bverse And the LORD God took the man, and put him into the garden of Eden to dress it and to keep it.

\bchapter Now the serpent was more subtil than any beast of the field which the LORD God had made. And he said unto the woman, Yea, hath God said, Ye shall not eat of every tree of the garden?
\bverse And the woman said unto the serpent, We may eat of the fruit of the trees of the garden:
\bverse But of the fruit of the tree which is in the midst of the garden, God hath said, Ye shall not eat of it, neither shall ye touch it, lest ye die.
\bverse And the serpent said unto the woman, Ye shall not surely die:
\bverse For God doth know that in the day ye eat thereof, then your eyes shall be opened, and ye shall be as gods, knowing good and evil.
\bverse And when the woman saw that the tree was good for food, and that it was pleasant to the eyes, and a tree to be desired to make one wise, she took of the fruit thereof, and did eat, and gave also unto her husband with her; and he did eat.
\bverse And the eyes of them both were opened, and they knew that they were naked; and they sewed fig leaves together, and made themselves aprons.
\bverse And they heard the voice of the LORD God walking in the garden in the cool of the day: and Adam and his wife hid themselves from the presence of the LORD God amongst the trees of the garden.
\bverse And the LORD God called unto Adam, and said unto him, Where art thou?
\bverse And he said, I heard thy voice in the garden, and I was afraid, because I was naked; and I hid myself.
\bverse And he said, Who told thee that thou wast naked? Hast thou eaten of the tree, whereof I commanded thee that thou shouldest not eat?
\bverse And the man said, The woman whom thou gavest to be with me, she gave me of the tree, and I did eat.
\bverse And the LORD God said unto the woman, What is this that thou hast done? And the woman said, The serpent beguiled me, and I did eat.
\bverse And the LORD God said unto the serpent, Because thou hast done this, thou art cursed above all cattle, and above every beast of the field; upon thy belly shalt thou go, and dust shalt thou eat all the days of thy life:
\bverse And I will put enmity between thee and the woman, and between thy seed and her seed; it shall bruise thy head, and thou shalt bruise his heel.
\bverse Unto the woman he said, I will greatly multiply thy sorrow and thy conception; in sorrow thou shalt bring forth children; and thy desire shall be to thy husband, and he shall rule over thee.

\bchapter And Adam knew Eve his wife; and she conceived, and bare Cain, and said, I have gotten a man from the LORD.
\bverse And she again bare his brother Abel. And Abel was a keeper of sheep, but Cain was a tiller of the ground.
\bverse And in process of time it came to pass, that Cain brought of the fruit of the ground an offering unto the LORD.
\bverse And Abel, he also brought of the firstlings of his flock and of the fat thereof. And the LORD had respect unto Abel and to his offering:
\bverse But unto Cain and to his offering he had not respect. And Cain was very wroth, and his countenance fell.
\bverse And the LORD said unto Cain, Why art thou wroth? and why is thy countenance fallen?
\bverse If thou doest well, shalt thou not be accepted? and if thou doest not well, sin lieth at the door. And unto thee shall be his desire, and thou shalt rule over him.
\bverse And Cain talked with Abel his brother: and it came to pass, when they were in the field, that Cain rose up against Abel his brother, and slew him.
\bverse And the LORD said unto Cain, Where is Abel thy brother? And he said, I know not: Am I my brother's keeper?
\bverse And he said, What hast thou done? the voice of thy brother's blood crieth unto me from the ground.
\bverse And now art thou cursed from the earth, which hath opened her mouth to receive thy brother's blood from thy hand;
\bverse When thou tillest the ground, it shall not henceforth yield unto thee her strength; a fugitive and a vagabond shalt thou be in the earth.

\end{document}


I switched to scrbook to better control the size of the PDF with pagesize, switched to a6 paper instead of a5 since otherwise the second verse of chapter 1 overrides the lettrine.

-
Thanks Raphink I have managed to get past the second verse overriding the lettrine by doing this and setting the counter to 2 instead of one: \bchapter In the beginning God created the heaven and the earth.\ \textbf{\small{2}}\quad And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters. \bverse And God said, Let there be light: However my toptitlemarks and bottitlemarks are messed up now due to this, I presume: \addtocounter{section}{1}% \setcounter{subsection}{2}% How do you suggest I fix it? – McGafter Aug 23 '11 at 15:55
That is quite ugly though... you might not always have first verses that are too short... – ℝaphink Aug 23 '11 at 16:04
Oh well, that part works at least, and it doesn't look too bad. My biggest problem is the chapter/verse references thats out of sync, due to the counter manipulation. I'm trying to create a new set of counters to run them parallel to the bverse/bchapter ones. – McGafter Aug 23 '11 at 17:01
I'll start a new question based on Gonzalo's comment. Your welcome to copy your answer across, as it is indeed helpful. – McGafter Aug 24 '11 at 10:47
I saw the new question :-) – ℝaphink Aug 24 '11 at 11:20