Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is a follow-up question to: How to center a verse horizontally

I am using the solution given by @Herbert. Is there a way to put a color box around selected few verses I desire?

share|improve this question
    
Have a look to the package adjustbox. –  Marco Daniel Jan 30 '12 at 18:55

1 Answer 1

up vote 1 down vote accepted

You can use the mdframed package to put a box the full width, or specify the margins to have it indented:

enter image description here

\documentclass{article}
\usepackage{fontspec}
\usepackage{lipsum}
\usepackage[framemethod=tikz,xcolor=true]{mdframed}
\usepackage{varwidth}

\newenvironment{Verse}
  {\center\varwidth{\linewidth}}
  {\endvarwidth\endcenter}    

\begin{document}

\lipsum[1]

\begin{mdframed}[
    tikzsetting={draw=red,ultra thick},skipabove=5pt,
]
\begin{Verse}
foo bar\\
baz
\end{Verse}
\end{mdframed}
\begin{mdframed}[
    tikzsetting={draw=red,ultra thick},skipabove=5pt,
    rightmargin=2cm,leftmargin=2cm
]
\begin{Verse}
foo bar\\
baz
\end{Verse}
\end{mdframed}
\end{document}
share|improve this answer
    
You can also use userdefinedwidth. The possibilities by varwidth are not supported. –  Marco Daniel Jan 30 '12 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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