2

I have to create a table similar to this: enter image description here

my problem is in creating the leftmost colum, My attempt is this:

\begin{table}
           \begin{tabular}{|c|c|c|c|}
     \caption{\emph{{Assegnazione dei chemical shifts}}
        \hline
        Unità & Assegnazioni & $\delta - ^1$ H (ppm) & $\delta - ^{13}$C (ppm) \\
        \hline
        \multirow{6}{*}{Ramnosio-3-solfato-Glucuronico} & R1 & 4.81 & 101.14\\
        & R2 & 4.28 & 68.92 \\
        & R3 & 4.65 & 78.68 \\
        & R4 & 3.83 & 71.45\\
        & R5 & 4.08 & 67.94\\
        & R6(CH$_3$) & 1.27 & 16.57\\ 

        \hline

        \multirow{6}{*}{Ramnosio-3-solfato-Iduronico} & R’1 & 4.80 & 99.78 \\
        & R’2 & 4.27 & 68.91 \\
        & R’3 &  4.68 &  78.29\\
        & R’4 & 3.84 & 75.95 \\
        & R’5 & 4.11 & 67.55\\
        & R’6(CH$_3$) & 1.34 & 16.76

        \end{tabular}
\end{table}

which solved the issue. I need just a caption now 'cause I get:

LaTeX Error: \caption outside float.

4

While it is certainly possible to recreate the "look" of the screenshot you posted by using \multirow statements -- see the code and the left-hand part of the screenshot below for an example -- I'd like to encourage you to move away from this not- particularly-appealing approach toward creating a table.

As the example on the right-hand side of the screenshot demonstrates, one can create a much more aesthetically appealing table by omitting all vertical lines and most horizontal lines, using the macros of the booktabs package for the remaining few horizontal lines and, yes, not using \multirow. It's simply not necessary to shift the words "Glucoronic" and "Iduronico" down in order for people to understand how the table "works".

enter image description here

\documentclass{article}
\usepackage{multirow,array,booktabs}
\begin{document}

\begin{center}
\setlength{\extrarowheight}{2pt}
\begin{tabular}{|c|c|}
\hline
Unit{\`a} & Assegnazioni \\ \hline
\multirow{6}{*}{Glucoronico}
   & R1 \\ \cline{2-2}
   & R2 \\ \cline{2-2}
   & R3 \\ \cline{2-2}
   & R4 \\ \cline{2-2}
   & R5 \\ \cline{2-2}
   & R6 \\ \hline
\multirow{6}{*}{Iduronico}
   & R'1 \\ \cline{2-2}
   & R'2 \\ \cline{2-2}
   & R'3 \\ \cline{2-2}
   & R'4 \\ \cline{2-2}
   & R'5 \\ \cline{2-2}
   & R'6 \\ \hline
\end{tabular}
\hspace{1cm}
\setlength{\extrarowheight}{1pt}
\begin{tabular}{@{} lc @{}}
\toprule
Unit{\`a} & Assegnazioni \\ 
\midrule
Glucoronico
   & R1 \\
   & R2 \\
   & R3 \\
   & R4 \\
   & R5 \\ 
   & R6 \\ 
\midrule
Iduronico
   & R'1 \\
   & R'2 \\
   & R'3 \\
   & R'4 \\
   & R'5 \\
   & R'6 \\
\bottomrule
\end{tabular}

\end{center}
\end{document} 

Addendum to address the OP's follow-up question: To create a caption, encase the tabular environment in a table environment and add a \caption{...} statement. Depending on whether you want the caption to be above or below the tabular material, the \caption statement should come either right before or right after the tabular environment. In the following example, the caption is placed above the tabular material.

I would also like to suggest that you (a) use the line-drawing macros of the booktabs package, (b) use the \ce macro of the mhchem package to typeset chemical formulas, (c) use the facilities of the siunitx package to align numbers in a column on their decimal markers, and (d) use math-mode to typeset the material in the second column.

enter image description here

\documentclass{article}
\usepackage[italian]{babel} % optional, but recommended
\usepackage[T1]{fontenc}
\usepackage{array,booktabs,siunitx,mhchem}
\newcolumntype{L}{>{$}l<{$}} % left-aligned col., automatic math mode
\usepackage[skip=0.333\baselineskip]{caption} % optional

\begin{document}
\begin{table}[htbp]
\caption{\dots}
\centering
\begin{tabular}{@{} lLcS[table-format=3.2] @{}}
\toprule
Unità & $Assegnazioni$ & $\delta$-\ce{^{1}H} & {$\delta$-\ce{^{13}C}} \\
& & (ppm) & {(ppm)}\\
\midrule
Ramnosio-3-solfato-Glucuronico 
& R_1 & 4.81 & 101.14\\
& R_2 & 4.28 & 68.92 \\
& R_3 & 4.65 & 78.68 \\
& R_4 & 3.83 & 71.45\\
& R_5 & 4.08 & 67.94\\
& R_6\ (\ce{CH3}) & 1.27 & 16.57\\
\midrule
Ramnosio-3-solfato-Iduronico
& R'_1 & 4.80 & 99.78 \\
& R'_2 & 4.27 & 68.91 \\
& R'_3 & 4.68 & 78.29 \\
& R'_4 & 3.84 & 75.95 \\
& R'_5 & 4.11 & 67.55 \\
& R'_6\ (\ce{CH3}) & 1.34 & 16.76\\
\bottomrule
\end{tabular}
\end{table}

\end{document}
  • 1
    great can you show me also how to add a caption? – Giuliano Malatesta Apr 4 at 8:10
  • @GiulianoMalatesta - Please see the addendum I just posted. – Mico Apr 4 at 8:49
  • it seems that there is a runaway argument:Runaway argument? {\emph {{Assegnazione dei c.s. $^1$H e $^{13}$C delle risonanze dell'\ETC. ! File ended while scanning use of \@xdblarg. – Giuliano Malatesta Apr 4 at 9:02
  • 1
    @Mico A great and comprehensive response. I always wish you the best. – Sebastiano Apr 4 at 9:10
  • 1
    @Sebastiano - Many thanks for the compliment! – Mico Apr 4 at 10:00

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.