0

I need to include a two-line verse in a table cell and need to force both lines to be aligned such that they begin at the same point (is this horizontal alignment?) In the MWE below, the cell with multi-line text that needs to be fixed is in the second row. What's the best way to fix this?

\documentclass{article}

\begin{document}
\begin{tabular}{|l|c|l|}
\hline
\textit{\textbf{sūktisaṃkhyā}} & \textit{\textbf{sūktiḥ}} & \textit{\textbf{ślokasaṃkhyā}}\\
\hline
1. & anavadyatṛṇādino mṛgānmṛgayāghāya na bhūbhṛtāṃ ghnatām & 10\\
\hline
2. & \begin{tabular}{@{}c@{}}acirādupakarturācaredathavātmaupayikīmupakriyām |\\pṛthuritthamathāṇurastu sā na viśeṣe viduṣāmiha grahaḥ||\\\end{tabular}& 14\\
\hline
3. & vyavadhāvapi vā vidhoḥ kalāṃ mṛḍacūḍānilayāṃ na veda kaḥ & 19\\
\hline
4. & bruvate hi phalena sādhavo na tu kaṇṭhena nijopayogitām & 48 \\
\hline
5. & dhanināmitaraḥ satāṃ punarguṇavatsannidhireva sannidhiḥ & 53 \\
\hline
6. & svata eva satāṃ parārthatā grahaṇānāṃ hi yathā yathārthatā & 61 \\
\hline

\end{tabular}
\end{document}

MWE

6
  • 2
    Use \begin{tabular}{@{}l@{}}, i.e. l for the column instead of c.. – Pieter van Oostrum Mar 28 at 19:30
  • 1
    or these two verses, the simplest for me would be loading the makecell package and coding \makecell[l]{acirādupakarturācaredathavātmaupayikīmupakriyām |\\pṛthuritthamathāṇurastu sā na viśeṣe viduṣāmiha grahaḥ||}. – Bernard Mar 28 at 19:33
  • Hi @Bernard is it possible to retain the text's alignment within the cell as center and yet force alignment of the two lines, like what \being{center}...\end{center} does? – linuxfan Mar 28 at 19:38
  • @PietervanOostrum Your suggestion works. Thanks – linuxfan Mar 28 at 19:42
  • That would be a bit morelong to code, but yes: load eqparbox and write each line in an \eqmakebox, like this: \eqmakebox[V][l] {acirādupakarturācaredathavātmaupayikīmupakriyām |}, and the same for the second verse. – Bernard Mar 28 at 19:43
2

The simplest solution uses \Centerstack from stackengine. I had to load geometry and modify the value of \tabcolsep to remove the overfull \hbox message: your table is too wide for the default margins. I also took the opportunity to add some vertical padding to cells with the cellspace paackage.

\documentclass{article}
\usepackage{geometry} 
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}
\usepackage[usestackEOL]{stackengine}

\begin{document}

\centering\setlength{\tabcolsep}{3pt}
\begin{tabular}{|l|Sc|l|}
\hline
\textit{\textbf{sūktisaṃkhyā}} & \textit{\textbf{sūktiḥ}} & \textit{\textbf{ślokasaṃkhyā}}\\
\hline
1. & anavadyatṛṇādino mṛgānmṛgayāghāya na bhūbhṛtāṃ ghnatām & 10\\
\hline
2. & \Centerstack[l]{acirādupakarturācaredathavātmaupayikīmupakriyām |\\pṛthuritthamathāṇurastu sā na viśeṣe viduṣāmiha grahaḥ||}& 14\\
\hline
3. & vyavadhāvapi vā vidhoḥ kalāṃ mṛḍacūḍānilayāṃ na veda kaḥ & 19\\
\hline
4. & bruvate hi phalena sādhavo na tu kaṇṭhena nijopayogitām & 48 \\
\hline
5. & dhanināmitaraḥ satāṃ punarguṇavatsannidhireva sannidhiḥ & 53 \\
\hline
6. & svata eva satāṃ parārthatā grahaṇānāṃ hi yathā yathārthatā & 61 \\
\hline

\end{tabular}

\end{document} 

enter image description here

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.