2

I would like to introduce 3 labelled equations inside a table. One of the equations goes inside a multirow. It should look like this:

enter image description here

I tried the following code and I get an error. When the equation inside the multirow is deleted and, instead, a text (xxx) is written, the error disappears.

Do you have an idea, how I can solve it? Thank you in advance.

    \RequirePackage[patch]{kvoptions} 
\documentclass{DissOnlineLatex}
\usepackage{tabulary}
\usepackage{multirow}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}[h!]
\caption{example}
\begin{center}
    \begin{tabulary}{1.0\textwidth}{|C|C|C|C|C|}
        \hline
        \textbf{a} & \textbf{b} &\textbf{c} & {\textbf{d}} & {\textbf{e}}\\
        \hline
        \hline
        1 & blabla & aaa & \multirow{2}{*}{x} & \begin{equation} m  = \frac{n}{z} \label{eq:bla2} \end{equation} \\
        \cline{1-3}\cline{5-5}\\        
        2 & bloblo & bbb & & \begin{equation} m2  = \frac{n2}{z2} \label{eq:bla3} \end{equation} \\
        \hline                          
    \end{tabulary}
\end{center}
\label{table:blabla}
\end{table}
\end{document}

% x -->  a  = \frac{b}{c} \label{eq:bla1} \end{equation}
  • could you please make it a compilable MWE? – Raaja Jan 9 at 16:20
2

for what you like to obtain the tabulary table environment is not good choice ... try with tabularx instead:

enter image description here

(red lines indicate text borders)

\documentclass{article}
\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------
\begin{document}
\begin{table}[htb]
\caption{example}
\label{table:blabla}
\setlength\abovedisplayskip{0pt}
\setlength\belowdisplayskip{0pt}
\centering
    \begin{tabularx}{\textwidth}{|c|c|c|C|C|}
        \hline
\textbf{a} & \textbf{b} &\textbf{c} & {\textbf{d}} & {\textbf{e}}\\
        \hline
        \hline
1 & blabla & aaa &
    \multirow{6.5}{=}{\begin{equation}
                    a = \frac{b}{c} \label{eq:bla2}
                    \end{equation}}
                    &   \begin{equation}
                        m  = \frac{n}{z} \label{eq:bla2}
                        \end{equation} \\
        \cline{1-3}\cline{5-5}
2 & bloblo & bbb &  & \begin{equation}
                        m2  = \frac{n2}{z2} \label{eq:bla2} \end{equation} \\
        \hline
    \end{tabularx}
\end{table}
\end{document}

edit: or maybe you will more prefer the following table looks:

enter image description here

for above images are made two changes in above mwe:

  • after \begin{table} is added line \renewcommand\tabularxcolumn[1]{m{#1}}
  • number of spanned lines in multirow is reduced: \multirow{4}{=}{ .... }

note:

  • in question always provide complete but small document beginning with \documentclasss... and ending with \end{document} which reproduce your problem. with this you will help all who would be willing help you. it is not fun to reconstruct missing part of your code knowing that it already exist at you ...
  • many time the source of problems are in used document packages, your defined commands (if existes) and similar

  • newer add \\ after ˙\hlineor\cline`. it cause spurious vertical space in table

  • displayed equations in table had to be paragraph style cells (like p{...}˙ orXfromtabularx`), which should have enough with to place equation in it.
  • for multirow in case that it contain displayed equation, you should prescribe ith width or use option = if the column, where is multirow cell has defined width.
  • Thanks a lot Zarko! However, I do not understand what you mean with: to complete my mwe please first extend your code sniped to complete small document! --------- I have problems compiling your code, I get the following error: "missing # inserted in alignment preamble". I already have \usepackage{tabularx}. Maybe it has todo with your comment. – CRH Jan 9 at 17:08
  • @CRH, please add to your code fragment document preamble and other missed parts, that it can be compiled as it is. such document we call mwe (minimal working example). see comment below your question. – Zarko Jan 9 at 17:29
  • I added the whole code in my question above. Now it should be compilable). – CRH Jan 9 at 17:31
  • @CRH, thank you very much. Now i complete my code (since i now know preamble of your document). – Zarko Jan 9 at 17:33
  • I didn't know the preamble was so important. Actually instead of article I have the following. I'm gonna change it in the question right now. \RequirePackage[patch]{kvoptions} \documentclass{DissOnlineLatex} – CRH Jan 9 at 17:36

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.