1

enter image description herehow I can fix the fourth row?

  \begin{table}[!h]\label{Table}
  \caption{random symmetrized instances.}
  \begin{tabularx}{\textwidth}{c>{\centering}Xc}
  \toprule
      Name  &   The generators of the symmetry group & Dimension  \\
  \midrule
  NS1     &   $(1,7,12,16,19,21,6)$, $(2,8,13,17,20,5,11)$, $(3,9,14,18,4,10,15)$,
  $(4,6,5)$, $(9,11,10)$, $(13,15,14)$, $(16,18,17)$, $(19,20,21)$  &  21 \\
  \midrule
  NS2   &   $ ( 1, 2, 7)( 3,11,27)( 4,14,31)( 5,18,32)( 6,20,36)( 8,24,39)( 9,25,28)
    (10,26,42)(12,15,16)(13,30,40)(17,19,21)(22,35,44)(23,33,29)(34,43,37)
    (38,45,41), ( 1, 3, 5, 6, 7,22,13,23)( 2, 8, 9,10)( 4,15,16,17,14,21,19,12
     )(11,28,29,38,44,25,20,37)(18,33,34,24,40,36,41,39)(26,43,35,32,42,45,27,
     30), ( 1, 4)( 3,12)( 5,19)( 6,21)( 7,14)( 8,10)(11,20)(13,16)(15,23)
    (17,22)(18,33)(24,41)(25,28)(26,43)(27,32)(29,44)(30,35)(34,39)(36,40)
    (42,45) $  & 5\\
  \bottomrule
  \end{tabularx}
\end{table}
  • 2
    What's the purpose of math mode in the second column of the table? – leandriis Feb 23 at 11:58
  • @leandriis - It may be that the OP enjoys getting a bit of extra whitespace after each math-mode instance of ,. Of course, that's just a wild guess. – Mico Feb 23 at 13:21
2

The issue is that the text in the problematic row is all in one big math-mode block, and automatic line-breaks cannot be inserted inside a single math-mode block. If you want to pick where it's allowed to insert a line-break yourself, you can just insert an extra closing $ there, followed by a whitespace, followed by a new $ to start the new math-mode block. That's what I did in the following code, and it ends up looking alright (I just looked at where I'd personally like to see line-breaks, and broke up the math-mode blocks there):

  \begin{table}[!h]\label{Table}
  \caption{random symmetrized instances.}
  \begin{tabularx}{\textwidth}{c>{\centering}Xc}
  \toprule
      Name  &   The generators of the symmetry group & Dimension  \\
  \midrule
  NS1     &   $(1,7,12,16,19,21,6)$, $(2,8,13,17,20,5,11)$, $(3,9,14,18,4,10,15)$,
  $(4,6,5)$, $(9,11,10)$, $(13,15,14)$, $(16,18,17)$, $(19,20,21)$  &  21 \\
  \midrule
  NS2   &   $ ( 1, 2, 7)( 3,11,27)( 4,14,31)( 5,18,32)( 6,20,36)( 8,24,39)( 9,25,28)$
    $(10,26,42)(12,15,16)(13,30,40)(17,19,21)(22,35,44)(23,33,29)$ $(34,43,37)
    (38,45,41), ( 1, 3, 5, 6, 7,22,13,23)( 2, 8, 9,10)$ $( 4,15,16,17,14,21,19,12
     )(11,28,29,38,44,25,20,37)$ $(18,33,34,24,40,36,41,39)(26,43,35,32,42,45,27,
     30), ( 1, 4)( 3,12)$ $( 5,19)( 6,21)( 7,14)( 8,10)(11,20)(13,16)(15,23)
    (17,22)(18,33)(24,41)$ $(25,28)(26,43)(27,32)(29,44)(30,35)(34,39)(36,40)
    (42,45) $  & 5\\
  \bottomrule
  \end{tabularx}
\end{table}

Alternatively, you could split up even more by surround every single pair of parentheses in their own $ symbols. This allows for the line-break points to be determined automatically, instead of being handpicked by you, and might end up looking better. It does create visible whitespace between every consecutive pair of parentheses though, which may be undesirable.

|improve this answer|||||
  • it doesn't work – user9272398 Feb 27 at 18:20
  • 2
    @user9272398 It does when I try it right here. If it doesn't for you, I guess that may be due to other packages you loaded, or maybe it depends on the documentclass... difficult to tell. You'll have to create a full minimal working example to reproduce – Dennis Soemers Feb 27 at 18:25
2

The material in the tabularx emvironment features a formatting inconsistency: In the NS1 row, each parenthesis-delimited group of numbers (a) does not contain whitespace inside the group and (b) is followed by , ("comma-space"). This is not the case, for some reason, in the NS2 row.

I suggest modifying the NS2 row so that its input is formatted the same way as in the NS1 row. That way, line breaks will occur only after closing parentheses.

I also believe that the table would look better if the middle column were typeset ragged-right rather than centered.

Off-topic: I you want to be able to cross-reference this table using \ref-type commands, the \label instruction must come after, not before, the \caption instruction.

In the following code, I've also omitted all inline-math initiators and terminators, mainly as they don't seem to be needed. If you need a bit of extra space after each comma inside the parenthesis-delimited groups, feel free to change (1,7,12,16,19,21,6), to $(1,7,12,16,19,21,6)$,, etc.

enter image description here

\documentclass{article}
\usepackage{tabularx,booktabs}
\newcolumntype{L}{>{\raggedright}X}

\begin{document}
  \begin{table}[!h]
  \caption{Random symmetrized instances.}\label{Table}
  \begin{tabularx}{\textwidth}{@{} l L l @{}}
  \toprule
  Name  & The generators of the symmetry group & Dimension \\
  \midrule
  NS1 
  & (1,7,12,16,19,21,6), (2,8,13,17,20,5,11), (3,9,14,18,4,10,15), (4,6,5), (9,11,10), (13,15,14), (16,18,17), (19,20,21)
  &  21 \\
  \midrule
  NS2 
  & (1,2,7), (3,11,27), (4,14,31), (5,18,32), (6,20,36), (8,24,39), (9,25,28), (10,26,42), (12,15,16), (13,30,40), (17,19,21), (22,35,44), (23,33,29), (34,43,37), (38,45,41), (1,3,5,6,7,22,13,23), (2,8,9,10), (4,15,16,17,14,21,19,12), (11,28,29,38,44,25,20,37), (18,33,34,24,40,36,41,39), (26,43,35,32,42,45,27,30), (1,4), (3,12), (5,19), (6,21), (7,14), (8,10), (11,20), (13,16), (15,23), (17,22), (18,33), (24,41), (25,28), (26,43), (27,32), (29,44), (30,35), (34,39), (36,40), (42,45) 
  & 5\\
  \bottomrule
  \end{tabularx}
\end{table}
\end{document}
|improve this answer|||||
  • it didn't solve my problem – user9272398 Feb 27 at 18:18
  • I don't have , between cycles – user9272398 Feb 27 at 18:18
  • @user9272398 - I will readily confess to not understanding any of the mathematics that underlie your table. All I did was to notice that, in your code, there are commas between cycles in the NS1 row but, for reasons I won't pretend to understand, not in the NS2 row. My humble suggestion was that if you can (re)introduce commas in the NS2 row, then your formatting issues vanish immediately. However, your comment would appear to suggest that this suggestion is not appropriate. My abject apologies. Do you want me to delete this answer as it evidently isn't of any use to you? – Mico Feb 27 at 18:51

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.