I'm looking for a code to create those two tables, could someone help me?

Asked
Active
Viewed 713 times
1 Answers
5
For this I'd use array I think (it is maths after all and not a table containing text). Additionally I'd use siunitx and its S type columns to align the numbers at the decimal separators. But I'd not use this diagonally separated first cell myself. I'd also not use vertical rules, and the horizontal ones provided by booktabs:
\documentclass[border=3.14]{standalone}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
$\begin{array}{cSSS}
\toprule
& {\omega_1} & {\omega_2} & {\omega_3} \\
\midrule
X(\omega_i) & 1.05 & 2.34 & 0.95 \\
Y(\omega_i) & 2.94 & 1.03 & 3.45 \\
Z(\omega_i) & 10.26 & -1.05 & 1.04 \\
\bottomrule
\end{array}$
\end{document}
EDIT: Though I don't think the following is good looking, I put it here to show the OP how to typeset his first table.
\documentclass[border=3.14]{standalone}
\usepackage{siunitx}
\begin{document}
$\begin{array}{c|SSS}
\omega_i & {\omega_1} & {\omega_2} & {\omega_3} \\
\hline
X(\omega_i) & 1.05 & 2.34 & 0.95 \\
Y(\omega_i) & 2.94 & 1.03 & 3.45 \\
Z(\omega_i) & 10.26 & -1.05 & 1.04 \\
\end{array}$
\end{document}
Skillmon
- 60,462
-
Upvote you. Please can you add the cross and the diagonal tabular? Thank you very much. – Sebastiano May 04 '19 at 09:16
-
@Sebastiano leandris posted a link in his comment to the question regarding the diagonal line. I will not provide it here, as that would just be a duplicate of the answers there. I just posted what I'd prefer from a typographical point of view. The cross thing isn't pretty, vertical rules in tables in general aren't and should be used really really seldom. I will not provide it. But it isn't hard to produce use
c|SSSinstead for thearray's preamble and\hlineinstead of\midrule, drop\topruleand\bottomrule, and you got what you want. – Skillmon May 04 '19 at 09:21 -
@Sebastiano if you want to you can create your own answer for the simple table with just the vertical and horizontal rule. But as I said, the diagonal line would be a duplicate, and I'd refrain from posting it here. – Skillmon May 04 '19 at 09:23
-
No, no I don't remember all the questions about TeX. Forget it. I just wanted to make myself useful to help the user. Thank you very much the same. – Sebastiano May 04 '19 at 09:24
-
@Skillmon Thx for your answer, but your table did not look like those i looking for – Joshua.M May 04 '19 at 10:15
-
1@Joshua.M as I said in the comments above, this answer is about what I'd use and about typographically good looking tables. For the diagonal cell separation there is the link posted by leandris. I'll edit my answer to include the simple case of just one vertical and one horizontal rule. – Skillmon May 04 '19 at 10:17


\begin{tabular}{cccc}or\begin{array}{cccc}. Regarding the diagnoally split cell in the second table, you might want to have a look at: Diagonal lines in table cell – leandriis May 04 '19 at 09:07