Sections in table cells?

1,115

You can use \section{} or similar commands inside l,r and c columns but inside of a \parbox (that is the same that use a p column):

\documentclass{article}
\begin{document}
\begin{tabular}{*{3}{p{2cm}c}}
    \section{11} bla bla bla ... & 12 & 13 & 14\\
    21 & 22 & \section*{23}  & 24\\
    31 & 32 & 33 & \parbox{2cm}{\section{34}}\\
    41 & 42 & 43 & 44\\
\end{tabular}
\end{document}
Share:
1,115

Related videos on Youtube

Admin
Author by

Admin

Updated on May 05, 2020

Comments

  • Admin
    Admin over 3 years

    I'm working on a tool to export wiki content to LaTeX. In some cases the wiki syntax used generates sections inside table cells.

    In HTML this translates to the following for example:

    <table>
       <tbody>
          <tr>
             <td>
                <div>
                   <h1>Extend your wiki</h1>
                   <p>...</p>
                </div>
             </td>
             <td>
                <div>
                   <h1>Create your application</span></h1>
                   <p>...</p>
                </div>
             </td>
          </tr>
       </tbody>
    </table>
    

    I couldn't find anything about sections in table cells when googling and my conclusion so far is that it's not possible in LaTeX.

    Could someone confirm this?

    I'd need to find how I can transform this kind of structure in LaTeX. I guess the only solution that comes to mind would be to generate text in the same style as sections but without them being sections. They won't appear in TOC not be referenceable as sections but I don't see any other choice (unless it's possible in LaTeX ofc).

    Thank you

    • TeXnician
      TeXnician over 5 years
      Welcome to TeX.SX! A real section in a table cell is not possible. But how do you convert your documents?