Graphics, Figures & TablesPlease help with this table!

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Tony20721
Posts: 3
Joined: Wed Mar 23, 2011 11:57 am

Please help with this table!

Post by Tony20721 »

Dear all, I've been trying so desperately for two days in trying to write down the code for the table herewith attached but with no success... how can I do!? I tried the most but it seems to appear unformatted all the time. I am using MiKTeX on windows.
Please! Thank you all for your interest!
Tony
Attachments
table-prblm.jpg
table-prblm.jpg (47.39 KiB) Viewed 1933 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

Please help with this table!

Post by localghost »

Typesetting tables can indeed be painful. The code below reproduces the table in the picture. Get familiar with all the involved packages by studying their manuals. This will enable you to typeset other tables on your own.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[%
  font=small,
  labelfont=bf,
  labelsep=period,
  tableposition=top
]{caption}
\usepackage{mathtools}   % loads »amsmath«
\usepackage{booktabs,multirow}
\usepackage[version=3]{mhchem}
\usepackage{siunitx}

\sisetup{%
  load-configurations=abbreviations
}

\begin{document}
  \begin{table}[!ht]
    \caption{Table caption}\label{tab:let}
    \centering
    \begin{tabular}{%
      l
      S[table-number-alignment=left]
      S[table-number-alignment=center]
      S[table-number-alignment=center]
      S[table-number-alignment=center]
      S[table-number-alignment=center]
      S[table-number-alignment=center]
    }\toprule
      \multirow{3}{*}{\parbox{4em}{\raggedright Charged particle \ce{^MN^Z}}} &
      \multirow{3}{*}{\parbox{8em}{\raggedright $E$ (\si{\MeV\per\atomicmassunit}) $\text{Range}=\SI{262}{\mm}$}} &
      \multicolumn{5}{c}{LET (\si{\keV\per\micro\meter}) at various} \\
      & & \multicolumn{5}{c}{residual ranges in water (\si{\mm})} \\\cmidrule(lr){3-7}
      & & {262} & {150} & {70} & {30} & {1} \\ \midrule
      \ce{^1H^{+1}} & 200.0 & 0.5 & 0.6 & 0.8 & 1.1 & 4.8 \\
      \ce{^4He^{+2}} & 202.0 & 1.8 & 2.2 & 3.1 & 4.4 & 20.0 \\
      \ce{^7Li^{+3}} & 234.3 & 3.7 & 4.6 & 6.2 & 8.9 & 40.0 \\
      \ce{^{11}B^{+5}} & 329.5 & 8.5 & 10.0 & 13.5 & 19.0 & 87.5 \\
      \ce{^{12}C^{+6}} & 390.7 & 11.0 & 13.5 & 17.5 & 24.5 & 112.0 \\
      \ce{^{14}N^{+7}} & 430.5 & 13.5 & 14.5 & 22.5 & 31.5 & 142.0 \\
      \ce{^{12}O^{+8}} & 468.0 & 18.0 & 21.5 & 28.0 & 39.0 & 175.0 \\\bottomrule
    \end{tabular}
  \end{table}
\end{document}

Best regards and welcome to the board
Thorsten
Tony20721
Posts: 3
Joined: Wed Mar 23, 2011 11:57 am

Re: Please help with this table!

Post by Tony20721 »

God bless you, you solved my problem.
I am still a new by so I couldn't find the right indentation.
I will study everything you wrote me.
The only thing is that as I have wrote by far with different packages , when compiling it will not accept packages like
\usepackage[utf8]{inputenc}
and also I will not change the main document class!
Thank you very much!
Tony.
Please where i can find the manuals for each package!?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Please help with this table!

Post by localghost »

Tony20721 wrote:[…] I am still a new by so I couldn't find the right indentation. […]
What do you mean with indentation in this context?
Tony20721 wrote:[…] The only thing is that as I have wrote by far with different packages , when compiling it will not accept packages like

Code: Select all

\usepackage[utf8]{inputenc}
and also I will not change the main document class! […]
You should elaborate that a bit more. The inputenc package is not mandatory if you write in English but helps with inserting special characters in other languages. And the code does not depend on the document class. My example is just a basic structure, especially regarding the class.
Tony20721 wrote:[…] Please where i can find the manuals for each package!?
You can either find them on CTAN or on your local machine via command line.

Code: Select all

texdoc ‹packagename›
Tony20721
Posts: 3
Joined: Wed Mar 23, 2011 11:57 am

Re: Please help with this table!

Post by Tony20721 »

Right idnetations means putting the right words in the right columns and also not making the words slide alogsides as it happened to me trying to type the one you got me right!
I'll see what \usepackage[utf8]{inputenc}allows me to do. Since now it has not recognized many symbols that i wrote in a different way, id does not reconize them!
Thank you so much!
Post Reply