LaTeX forum ⇒ Graphics, Figures & TablesExcel-like tables of experimental data Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
Cham
Posts: 732
Joined: Sat Apr 02, 2011 4:06 pm

Re: Excel-like tables of experimental data

Postby Cham » Fri Jan 15, 2016 9:41 pm

Sorry if I sounded under stress. I was actually excited, since I solved most of my problems ! 8-)

Now, I believe that the align environment is very natural, to align the tables to their left.

So the only thing missing is that double line which is too long. Instead of using the \hhline, I would prefer to keep the small gap. I think it looks nice. However, how to adapt the line to the upper block ?

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3550
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jan 15, 2016 9:43 pm

Align is a math environment to align, for example, equal signs vertically in different lines.

Did you try my proposal?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 732
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Jan 15, 2016 9:48 pm

Not yet. And I'm not familiar with minipage.

Can you offer an example, just to align two tables ?

And what about the double lines (with a gap) without using hhline ?

User avatar
Johannes_B
Site Moderator
Posts: 3550
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jan 15, 2016 9:55 pm

Why do you want to avoid package hhline? It was developed just for that purpose of doing what you want to do.

You don't need anything to have the tables aligned, minipages just to make the upper and lower stuck together. You can center the minipage.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 732
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Jan 15, 2016 10:09 pm

Sorry, I don't understand about the minipage. Can you be more specific ?

An example would help.

User avatar
Johannes_B
Site Moderator
Posts: 3550
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jan 15, 2016 10:56 pm

  1. \documentclass[10pt,twoside]{revtex4}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[french]{babel}
  5. \usepackage{microtype}
  6. \usepackage{hhline}
  7. \usepackage{showframe}
  8. \usepackage{multirow}
  9. \usepackage{amsmath}
  10. \usepackage[separate-uncertainty=true]{siunitx}
  11. \sisetup{output-decimal-marker = {,}}
  12.  
  13. \begin{document}
  14.  
  15. \section*{A table of results}
  16.  
  17. \begin{center}
  18. \noindent
  19. \begin{minipage}{.8\linewidth}
  20. \renewcommand{\arraystretch}{1.5}
  21. \begin{tabular}{l|c|c|c|c|c|}
  22. \cline{2-6}
  23. & \multicolumn{5}{c|}{Tableau 2. Caractéristiques physiques d'un petit cylindre de métal} \\ \cline{2-6}
  24. & \multicolumn{1}{>{\centering}p{6em}|}{$d$}
  25. & \multicolumn{1}{>{\centering}p{6em}|}{$\Delta d$}
  26. & \multicolumn{1}{>{\centering}p{6em}|}{$\ell$}
  27. & \multicolumn{1}{>{\centering}p{6em}|}{$\Delta\ell$}
  28. & \multicolumn{1}{>{\centering}p{6em}|}{$m$}
  29. \\ \cline{2-6}
  30. & \multicolumn{2}{c|}{\si{\mm}}
  31. & \multicolumn{2}{c|}{\si{\mm}}
  32. & \si{\g}
  33. \\ \cline{2-6}
  34. & \multicolumn{2}{c|}{–}
  35. & \multicolumn{2}{c|}{–}
  36. & 0,1 \\
  37. % \hline\hline
  38. \hhline{b-=====}
  39. % \hline
  40. \multicolumn{1}{|l|}{Règle} & 15 & 1 & 22 & 1 & \multirow{3}{*}{49,3} \\ \cline{1-5}
  41. \multicolumn{1}{|l|}{Pied à coulisse} & 15,4 & 0,1 & 22,6 & 0,1 & \\ \cline{1-5}
  42. \multicolumn{1}{|l|}{Palmer} & 15,42 & 0,03 & 22,57 & 0,02 & \\ \hline
  43. \end{tabular} \\[10pt]
  44.  
  45. \begin{tabular}{|l|}
  46. \hline
  47. \multicolumn{1}{|c|}{Légende} \\ \hline
  48. $d$ est le diamètre du cylindre. \\
  49. $\ell$ est la longueur du cylindre. \\
  50. $m$ est la masse du cylindre, selon la balance à fléaux. \\ \hline
  51. \end{tabular}
  52. \end{minipage}
  53. \end{center}
  54.  
  55. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 732
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Jan 15, 2016 11:29 pm

Thanks a lot, Johannes, it's really appreciated !

I'll study this later today.

EDIT : Just a simple question : the align environment works too, even if it was designed for maths. Why the mini page is a better way to align the tables ?

User avatar
Johannes_B
Site Moderator
Posts: 3550
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jan 15, 2016 11:58 pm

Maths is for maths.

I know your documents are math-heavy. If you have a long set of aligned equations, you might want to allow this set to break pages. This will affext all sets of equations, even the two tabular environments. Hence, they might split to different pages, which makes a legend (non-sticky) kind of useless.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 732
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Sat Jan 16, 2016 12:02 am

So does that mean that the minipage will not break the legend from its main table ?

Also, if I want to display several tables (say two relatively small tables), is it a good idea to define both of them inside the same mini page, so their legends are all aligned together to the left ?

User avatar
Johannes_B
Site Moderator
Posts: 3550
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Jan 16, 2016 12:22 am

If the table and the legend are within a minpage, they won't split. As far as LaTeX is concerned, the minipage is like one letter, like a bix X or a big y.

If you want to keep both tables together, put them in one minipage. If you want the tables and legends to stick together, but let the tables (tabular and legend) split, but the constructs in different minipages.

Since a table (data, information, a box for latex) can be quite large, they are usually put in a floating environment (called table, yes; this is confusing) to ensure the usual nice flow of text.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: Bing [Bot] and 5 guests