[Tex/LaTex] How to center a verse horizontally

horizontal alignmentverse

I have a Sanskrit Verse that I want to appear at the center of the page. I am using verse environment as shown below.

\begin{verse}
तपः स्वाध्याय निरतम् तपस्वी वाग्विदाम् वरम् | \\
नारदम् परिपप्रच्छ वाल्मीकिः मुनि पुंगवम् ||
\end{verse}

This does not appear at the center of the page, it appears more to the left of the page. Is there a way to make it appear at the center. I attached the screenshot of the output.

enter image description here

Best Answer

Run the example with xelatex or lualatex or use the definition of Verse if you want to run it with pdflatex

\documentclass{article}
\usepackage{fontspec}
\newfontface\Devangari{Devanagari MT}
\usepackage{varwidth}
\newenvironment{Verse}[1][\Devangari]
  {\center#1\varwidth{\linewidth}}
  {\endvarwidth\endcenter}

\usepackage{lipsum}

\begin{document}

\lipsum[1]
\begin{Verse}
तपः स्वाध्याय निरतम् तपस्वी वाग्विदाम् वरम् | \\
नारदम् परिपप्रच्छ वाल्मीकिः मुनि पुंगवम् ||    
\end{Verse}

\begin{Verse}[]
foo bar\\
baz
\end{Verse}

\end{document}

enter image description here

Without defining the Devangari font:

\documentclass{article}
\usepackage{fontspec}
\usepackage{varwidth}
\newenvironment{Verse}
  {\center\varwidth{\linewidth}}
  {\endvarwidth\endcenter}    
\usepackage{lipsum}
\begin{document}

\lipsum[1]
\begin{Verse}
foo bar\\
baz
\end{Verse}

\end{document}