6

I'm trying to make a kind of breviary containing psalms indented like e.g. here
What I managed so far is indenting by hand every two other verses. It goes like this:

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}

\noindent O God, you are my God, for you I long; *\\
for you my soul is thirsting.\\
\indent My body pines for you *\\
\indent like a dry, weary land without water.\\
So I gaze on you in the sanctuary *\\
to see your strength and your glory.\\
\indent For your love is better than life, *\\
\indent my lips will speak your praise.\\
So I will bless you all my life, *\\
in your name I will lift up my hands.\\
\indent My soul shall be filled as with a banquet, *\\
\indent my mouth shall praise you with joy.\\
On my bed I remember you. *\\
On you I muse through the night\\
\indent for you have been my help; *\\
\indent in the shadow of your wings I rejoice.\\
My soul clings to you; *\\
your right hand holds me fast.\\
\indent Glory to the Father, and to the Son, *\\
\indent and to the Holy Spirit:\\
as it was in the beginning, is now, *\\
and will be for ever. Amen.

\end{document}

It looks fine but takes a lot of nonsense work.
Does anyone know how to automatize the job? Thanks in advance.

5
  • look for \hangindent but do you intend those * to be typeset?(just checking) Commented Mar 21, 2017 at 14:04
  • 1
    Welcome to TeX.SX! It's not really and answer, but rather a suggestion. Keep your content separate from layout. You don't want that particular line to be indented, you want the first 2 out of 4 lines to be indented (e.g. what happen if you typesetted Ps. 118(9) and you realize you forgot line 3 and 4?!). You could also have a look at Package to typeset Poems (even if does not directly solve the indentation issue).
    – ebosi
    Commented Mar 21, 2017 at 14:05
  • 1
    You could also adapt solutions suggested in Formatting verse: How to change indent for all even lines?
    – ebosi
    Commented Mar 21, 2017 at 14:12
  • Instead of modifying your existing query to create what is, in essence, an entirely new and separate query, you should have posted a new query, in which you would focus attention on just the new part.
    – Mico
    Commented Mar 24, 2017 at 20:38
  • Right, here is the new question
    – Precluch
    Commented Mar 24, 2017 at 21:08

2 Answers 2

7

enter image description here

\documentclass[12pt,a4paper,oneside]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}


\begingroup
\setlength\parskip{0pt}
\def\par{\ifvmode\noindent\else\endgraf\fi}
\obeylines


O God, you are my God, for you I long; *

for you my soul is thirsting.
My body pines for you *
like a dry, weary land without water.

So I gaze on you in the sanctuary *

to see your strength and your glory.
For your love is better than life, *
my lips will speak your praise.

So I will bless you all my life, *

in your name I will lift up my hands.
My soul shall be filled as with a banquet, *
my mouth shall praise you with joy.

On my bed I remember you. *

On you I muse through the night
for you have been my help; *
in the shadow of your wings I rejoice.

My soul clings to you; *

your right hand holds me fast.
Glory to the Father, and to the Son, *
and to the Holy Spirit:

as it was in the beginning, is now, *

and will be for ever. Amen.

\endgroup

\end{document}
15
  • 1
    Could you please explain how it works? Even if the 'trick' is only two commands, I'm hardly understanding its functioning!
    – ebosi
    Commented Mar 21, 2017 at 14:45
  • 3
    @ebo \obeylines makes the end of line an active character with definition \par which means that every line is a paragraph (so you can not use \hangindent) however you can indent everything (leftskip then detect in the local definition of \par that you had a blank line and if so back-space up to remove the \leftskip indentation. Commented Mar 21, 2017 at 14:49
  • 1
    While this code may answer the question, providing additional context regarding why and/or how this code answers the question improves its long-term value. Commented Mar 21, 2017 at 14:49
  • @ChrisChudzicki why? Commented Mar 21, 2017 at 14:51
  • 2
    @DavidCarlisle I was first confused with the "1/blank/2-3-4/blank" scheme for clustering lines. But thanks to your explanations I got it. It should be understood as: "if a line of text has a blank line above, then it's not indented" and thus be read as "blank-1/blank-2/3/4".
    – ebosi
    Commented Mar 21, 2017 at 14:58
1

Using the scripture package. Internally, this uses the same technique as David's answer, but with extra features and configuration options.

\documentclass[12pt,a4paper]{article}
\usepackage{scripture}
\scripturesetup{
  poetry/leftmargin=0pt
}
\begin{document}
\begin{scripture}
  \begin{poetry}
    O God, you are my God, for you I long; *

    for you my soul is thirsting.
    My body pines for you *
    like a dry, weary land without water.

    So I gaze on you in the sanctuary *

    to see your strength and your glory.
    For your love is better than life, *
    my lips will speak your praise.

    So I will bless you all my life, *

    in your name I will lift up my hands.
    My soul shall be filled as with a banquet, *
    my mouth shall praise you with joy.

    On my bed I remember you. *

    On you I muse through the night
    for you have been my help; *
    in the shadow of your wings I rejoice.

    My soul clings to you; *

    your right hand holds me fast.
    Glory to the Father, and to the Son, *
    and to the Holy Spirit:

    as it was in the beginning, is now, *

    and will be for ever. Amen.
  \end{poetry}
\end{scripture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .