Graphics, Figures & TablesHelp in table formatting

Information and discussion about graphics, figures & tables in LaTeX documents.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Help in table formatting

Post by meho_r »

Well, there is a code which shows the issue. I guess xana is interested in making the height of rows 2–4, those containing numbers 1–6, variable (something like tabulary for columns), so that they stretch vertically to match the height of the cell containing the text "ABCABCABC...x10".

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Help in table formatting

Post by localghost »

xana wrote:[...] Can you please tell me what is missing in my code? [...]
The essential parts that make it a minimal working example (MWE) as described in the topic I linked in my first reply to your request. You don't have to bother about the language. This point will be clarified by a full example.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Help in table formatting

Post by meho_r »

I was thinking, maybe redefining \arraystretch solves the problem, at least partially? For infos about this, xana, take a look here.

And here's an example using your first posted code:

Code: Select all

\documentclass{book}
\usepackage{multirow}

\begin{document}

\renewcommand{\arraystretch}{1.8}
\begin{tabular}{|c|c|c|}
\hline
A&B&C\\
\hline
1&2&\multirow{3}{*}{\parbox{6cm}{ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC}}\\\cline{1-2}
3&4&\\\cline{1-2}
5&6&\\\cline{1-2}
\hline
\end{tabular}

\renewcommand{\arraystretch}{2.4}
\begin{tabular}{|c|c|c|}
\hline
A&B&C\\
\hline
1&2&\multirow{3}{*}{\parbox{6cm}{ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC ABCABCABC}}\\\cline{1-2}
3&4&\\\cline{1-2}
5&6&\\\cline{1-2}
\hline
\end{tabular}

\end{document}
Of course, you'll still have to do manual work setting \arraystretch. Maybe after you provide a full MWE localghost suggests a better solution.
xana
Posts: 14
Joined: Mon May 31, 2010 5:31 am

Help in table formatting

Post by xana »

Thank you for all the suggestions.

I already resolve my problem.

I simply added space between the rows and playe with this space.

Code: Select all

\\[12ex]\hline
I managed to align the table correctly . :)

Best regards
xana
Posts: 14
Joined: Mon May 31, 2010 5:31 am

Help in table formatting

Post by xana »

Hello again.

I wanted to itemize sentences in the table. A introduced the following code and the result is that from the example figure.

But i want that the space before the item is smaller and the text to be justified so that it fits right into the cell. How can i do that regarding the code that i posted bellow?

Best regards

Code: Select all

\begin{center}
\footnotesize
\setlongtables
\renewcommand{\arraystretch}{1.5}
\renewcommand{\multirowsetup}{\centering}
\centering
\setlength{\tabcolsep}{2mm}
\begin{longtable}{|>{\centering}m{2.6cm}|>{\centering}m{2.5cm}|>{\centering}m{2.1cm}|>{\centering}m{3cm}|>{\centering}m{3cm}|}
\caption{Vantagens e Desvantagens dos diversos m\'{e}todos de monitoriza\c{c}\~{a}o de glicose.}
 \multirow{5}{2.6cm}{Espectroscopia de infravermelho próximo\linebreak (\emph{NIR - Near Infrared Spectroscopy})} &
                \multirow{5}{2.5cm}{Óptico\linebreak (Espectroscopia de absorção IR)}} &
                Não-invasivo & \multirow{5}{3cm}
                {\begin{itemize}
                    \item {Rapidez da realização das medições;}
                    \item {Espectro não afectado por moléculas de água.}
                \end{itemize}}
                & \multirow{5}{3cm}{Dificuldade de distinção entre os sinais de glicose e os sinais interferentes (ruído);\linebreak Espectro tem maior probabilidade de ser dispersado do que absorvido.}  \\[10ex]\cline{4-4}
                && Invasivo && \\[12ex]\hline
                Espectroscopia de infravermelho médio\linebreak (MIR - Mid-Infrared Spectroscopy) & Óptico\linebreak (Espectroscopia de absorção IR) & Não-invasivo & Não requer a penetração da pele humana para realizar medições aos níveis glicêmicos. & Influências por parte de variações de temperatura;\linebreak Absorção das ondas Mid-IR pelas moléculas de água. \\\hline
Attachments
example.png
example.png (31.81 KiB) Viewed 3040 times
Post Reply