6

I have created a special environment (called 'psalm') that splits the text into verses, formats them, and enumerates them. I would like to also make the numbers of the verses appear in \textcolor{BrickRed} with the rest of the text remaining black. How would you change either the counter's code or the environment's code to make this happen? Below is my MWE:

\documentclass[12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames]{xcolor}
\newcounter{qcounter}

\newenvironment{psalm}{ %   %%%% Begin environment code
    \begin{list}{\arabic{qcounter}}{ %  
\usecounter{qcounter}
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{0.2in}%
\setlength{\listparindent}{-0.1in}%
\setlength{\itemindent}{-0.1in}%
    } 
}{        
    \end{list}
} %%%%% End wrapup environment code

\begin{document}

\begin{psalm}
\item Glory be to the Father, and tó the Són, *\\ and to the Hóly Ghóst;
\item As it was in the beginning, † is now, and éver sháll be, *\\ world wíthout énd. 
 Amen.
\end{psalm}\end{document}
Richard
  • 251
  • Are the psalm numbers supposed to be about half-way outside of the left-hand margin of the text block, or is that an unintended aspect of your code? Please advise. – Mico May 18 '18 at 16:45
  • I think he used \setlength{\leftmargin}{0.2in}% to correct it. Though 0.275in looks better to me. – AML May 18 '18 at 16:55
  • You could call it unintended, but really I just put numbers in one place rather than another (by which I mean in the end product, which has a lot more code than you're seeing, the verse numbers are in the right place). – Richard May 18 '18 at 16:56
  • Yeah that's correct. – Richard May 18 '18 at 16:57

2 Answers2

6

Switch to an enumerate environment and set your requirement. See this answer and this answer as references. And add leftmargin=* to make it align with the left margin.

\documentclass[12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage[dvipsnames]{xcolor}
%\usepackage[showframe]{geometry}

\newenvironment{psalm}{ %   %%%% Begin environment code
\begin{enumerate}[leftmargin=*, label=\textcolor{BrickRed}{\arabic*}]}
{\end{enumerate}} %%%%% End wrapup environment code

\begin{document}

\begin{psalm}
\item Glory be to the Father, and tó the Són, *\\ and to the Hóly Ghóst;
\item As it was in the beginning, † is now, and éver sháll be, *\\ world wíthout énd. 
 Amen.
\end{psalm}
\end{document}

enter image description here

AML
  • 2,265
4

Here's a solution which sets up a custom enumerate-like environment that uses the machinery of the enumitem package. The list occupies the full width of the textblock, and the item numbers do not protrude into the left-hand margin.

enter image description here

\documentclass[12pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[dvipsnames]{xcolor}

\usepackage{enumitem}
\newlist{psalm}{enumerate}{1}
\setlist[psalm]{label=\color{BrickRed}\arabic*,
                ref=\arabic*, % for cross-referencing
                wide=0pt, leftmargin=*,
                %nosep, % optional: no extra vert. space between psalms
                }

\begin{document}

\begin{psalm}
\item Glory be to the Father, and tó the Són, *\\ and to the Hóly Ghóst;
\item As it was in the beginning, † is now, and éver sháll be, *\\ world wíthout énd. Amen.
\end{psalm}
\end{document}
Mico
  • 506,678
  • This is a good way of bypassing the margin numbers though I'll have to change the page's geometry to make it fit properly; the boldface for numbers, however, is unnecessary. – Richard May 18 '18 at 17:13
  • @Richard - Ok, I'll remove the \bfseries instruction. – Mico May 18 '18 at 17:15