TransWikia.com

How I can apply margin to a verse?

TeX - LaTeX Asked by Menelaos Vergis on August 3, 2021

I want to create a book of poems and I want to place every poem at the middle of the page. I think that calculating the max width of the poem and placing it at the middle might be tricky so I decided to just apply manually some padding on every verse.

I include my code so far

documentclass[a5paper,pagesize,10pt,bibtotoc,pointlessnumbers,
normalheadings,DIV=9,twoside=false]{scrbook}

% twoside, openright
KOMAoptions{DIV=last}

usepackage{trajan}


usepackage[georgian]{babel}
usepackage{fontspec}



linespread{1.05} 

usepackage{verbatim} % for comments
usepackage{listings} % for comments

usepackage{calc}
usepackage{verse}

usepackage{blindtext}

setmainfont{DejaVu Serif}

newcommand{q}[1]{>>textit{#1}<<}

title{A book title}   
author{Author Name} 
date{today} 

begin{document}




        centering{
            {fontsize{22}{25}selectfont 
        უშენობა}
        }

        vspace{10mm}


begin{verse}
გავაღებ  კარს,
შევხედავ  ცას.
ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს.
გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.

end{verse}


end{document}

3 Answers

You have to use the versewidth feature described in the manual of verse; here's a minimal example.

documentclass[a5paper,pagesize,10pt,bibtotoc,pointlessnumbers,
normalheadings,DIV=9,twoside=false]{scrbook}

% twoside, openright
KOMAoptions{DIV=last}

usepackage[georgian]{babel}
usepackage{fontspec}
setmainfont{DejaVu Serif}

usepackage{verse}

linespread{1.05} 

begin{document}

begin{center}
Huge უშენობა
end{center}

settowidth{versewidth}{გაუფრთხილდეთ  მას,}
begin{verse}[versewidth]
გავაღებ  კარს,
შევხედავ  ცას.
ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს.
გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.
end{verse}

end{document}

Don't use centering like you do: it's wrong.

enter image description here

Correct answer by egreg on August 3, 2021

the environment verse seems to use an internal lap macro. However, you can indent the verse box and using package varwidth if you do not want to look for the longest line for versewidth

documentclass[a5paper,pagesize]{scrbook}
usepackage{trajan}
usepackage[georgian]{babel}
usepackage{fontspec}
setmainfont{DejaVu Serif}
usepackage[showframe]{geometry}

usepackage{verse}
usepackage{varwidth}
letVerseverse
letendVerseendverse
renewcommandverse[1]{%
  {fontsize{22}{25}selectfont#1parvspace{10mm}}
  hspace*{3em}%%%%%%%%%%%%%%%
  varwidth{textwidth}Verse}

renewcommandendverse{endvarwidthendVerse}

begin{document}
begin{center}

begin{verse}{უშენობა}
გავაღებ  კარს,
შევხედავ  ცას.
ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს.
გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.
end{verse}

begin{verse}{უშენობა}
გავაღებ  კარს,
შევხედავ  ცას. ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს. გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.
end{verse}
end{center}

end{document}

enter image description here

Answered by user2478 on August 3, 2021

After loading the verse package also load gmverse.

This package allows:

  1. automatic centering -based on a weighted average of line lengths
  2. no need to use // to end each line, just put a blank line between stanzas. (Great if you are copy/pasting from another source).

It gives great results.

documentclass[a5paper,pagesize]{scrbook}
usepackage{trajan}
usepackage[georgian]{babel}
usepackage{fontspec}
setmainfont{DejaVu Serif}
usepackage[showframe]{geometry}

usepackage{verse,gmverse}

% look, no centering command needed

begin{document}
vocweigh3.  %not needed according to doc, but it doesn't seem to work without it 

poemtitle{უშენობა}
begin{verse}
გავაღებ  კარს,
შევხედავ  ცას.
ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს.
გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.
end{verse}

poemtitle{უშენობა}
begin{verse}
გავაღებ  კარს,
შევხედავ  ცას. ოდესმე  ჩავწვდებით,
ცხოვრების  აზრს. გაუფრთხილდეთ  მას,
რაც  დღეს  გვაქვს.
end{verse}


end{document}

It also uses a poemtitle command to allow setting easily the title style, in the memoir package there is PoemTitle which allows numbered poems. and makes it simple to have an index of first lines.

Answered by DaveG on August 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP