3

The context of what I am doing is formatting a number of prayers. What is needed is to have the text indented a little and in the space created by that indent put a label indicating who is supposed to be saying it. So what I would like is a command like this:

\prayer{V.}{In nomine Patris et Filii et Spiritus Sancti.}
\prayer{R.}{Amen.}

Sometimes the labels are longer, but never more then 3-4 characters.

What I have so far is this, which indents the text, I just have no idea how to get the label where I want it.

\newcommand*{\prayer}[2]{\begin{addmargin}[3em]{0em}#2\end{addmargin}}

Is there any simple solution to what I want to do?

2

Here are two options, depending on the indentation alignment/wrapping you're after:

  1. Using changepage:

    enter image description here

    \documentclass{article}
    
    \usepackage{changepage}
    
    \newcommand{\prayer}[3][4em]{%
      \begin{adjustwidth}{#1}{0pt}
        \makebox[0pt][r]{\makebox[#1][l]{\bfseries #2}}%
        \ignorespaces #3
      \end{adjustwidth}
    }
    
    \begin{document}
    
    \prayer{V.}{In nomine Patris et Filii et Spiritus Sancti.}
    \prayer{R.}{Amen.}
    
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
    dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum. 
    Aliquam sed tellus vel magna imperdiet placerat in vel massa. Suspendisse gravida felis 
    in maximus commodo. Donec pellentesque auctor suscipit. Proin tempus massa ut est accumsan 
    porta. Quisque pulvinar est ac faucibus iaculis. Integer eget urna dapibus, sodales nisi 
    eget, tincidunt leo. Vivamus quis gravida eros. Donec finibus eros leo, at posuere orci 
    euismod eu. Integer a varius dui. Aliquam tincidunt, elit sed condimentum gravida, tortor 
    leo vulputate nibh, ut sagittis mauris risus et metus. Sed nec faucibus tortor, non 
    pulvinar lectus.
    
    \prayer{V.}{In nomine Patris et Filii et Spiritus Sancti.}
    \prayer{ABCD.}{%
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
      dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum.}
    \prayer{R.}{Amen.}
    
    \end{document}
    
  2. Using \makebox:

    enter image description here

    \documentclass{article}
    
    \renewcommand{\prayer}[3][4em]{%
      \par\noindent
      \makebox[#1][l]{\bfseries #2}%
      #3%
    }
    
    \begin{document}
    
    \prayer{V.}{In nomine Patris et Filii et Spiritus Sancti.}
    \prayer{R.}{Amen.}
    
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
    dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum. 
    Aliquam sed tellus vel magna imperdiet placerat in vel massa. Suspendisse gravida felis 
    in maximus commodo. Donec pellentesque auctor suscipit. Proin tempus massa ut est accumsan 
    porta. Quisque pulvinar est ac faucibus iaculis. Integer eget urna dapibus, sodales nisi 
    eget, tincidunt leo. Vivamus quis gravida eros. Donec finibus eros leo, at posuere orci 
    euismod eu. Integer a varius dui. Aliquam tincidunt, elit sed condimentum gravida, tortor 
    leo vulputate nibh, ut sagittis mauris risus et metus. Sed nec faucibus tortor, non 
    pulvinar lectus.
    
    \prayer{V.}{In nomine Patris et Filii et Spiritus Sancti.}
    \prayer{ABCD.}{%
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque nec purus euismod justo 
      dapibus interdum. Quisque non euismod dui. Aenean ornare eleifend libero at condimentum.}
    \prayer{R.}{Amen.}
    
    \end{document}
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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