5

I'm a beginner in LaTeX formatting text software.

Can somone help me create this table using LaTeX:

latex table

Here is my code:

\begin{table}[H]
\renewcommand\tablename{Tableau~2.2}
\caption{\textbf{Valeurs typiques des paramètres d'un moteur à courant continu.}}
\begin{tabular}{|c|c||c|c||c|c|} 
\hline
&\multirow{3}{*}{Paramètre}&  \multicolumn{4}{c|}{Valeur typique}\\
\hline
&~&\multicolumn{4}{c|}{Puissance $P_{m} (kW)$}\\
\cline{2-5}
\hline
&~&5&25&100&500\\
\hline
Moteur&N(tr/min)&1800&1800&1800&18000 \\
&V(V) &240&440&440&1800 \\
&$R_{a} (m \Omega)$&615&430&71&14\\
&$L_{a} (mH)$&4,5&5,5&1,8&0,19\\
&$K_{m} (V.s)$&1,2&2,0&2,1&3,0\\
&$\tau_{f} (kW)$&100&250&400&520\\
&$P_{fm} (KW)$&0,35&1,1,1&1,8&5,2\\
&$J_{m}(kg.m^{2}$&0,05&0,2&0,83&10,3\\
&$\tau_{a}(ms)$&7&13&25&14\\
&$\tau_{m}(ms)$&21&22&13&16\\
&$\eta(\%)$&80&85&91&94\\
\hline
Entraînement&$R_{a} (m \Omega)$&1230&860&142&28\\
&$L_{a} (mH)$&4,9&6,0&2,0&0,21\\
&$J_{m}(kg.m^{2}$&0,30&1,2&5,0&62\\
&$\tau_{a}(ms)$&4,1&7,0&14,1&7,5\\
&$\tau_{m}(ms)$&250&258&156&192\\
\hline
\end{tabular}
\end{table}

Thanks for your help,

8
  • Welcome to TeX.SE! Can you please show the code you tried so far?
    – Mensch
    Nov 20, 2021 at 15:05
  • i post it thanks for your help
    – MrFlutter
    Nov 20, 2021 at 15:07
  • question is edited can somone help to answer thaanks
    – MrFlutter
    Nov 20, 2021 at 15:40
  • 1
    You're mostly done. What aspects are you missing? I see that you have \hline overwriting \cline. Other than that, it looks like you're just needing to rotate the boxes, and you can try some ideas from tex.stackexchange.com/q/40465/107497. Or is there something else that you're missing?
    – Teepeemm
    Nov 20, 2021 at 15:46
  • the problem is that when i rotate the text it gives spaces in other colum lines
    – MrFlutter
    Nov 20, 2021 at 15:54

2 Answers 2

5

Welcome on TeX.SX! There you go (sorry for the little joke):

\documentclass{article}
\usepackage{rotating, multirow}

\begin{document}

\rotatebox{-2}{%
\renewcommand{\arraystretch}{1.25}
\begin{tabular}{|c|l|r|r|r|r|} 
\hline
\multirow{3}{*}{} & \multirow{3}{*}{Paramètre} & \multicolumn{4}{c|}{Valeur typique}\\
\cline{3-6}
& &\multicolumn{4}{c|}{Puissance $P_{m}$ (kW)}\\
\cline{3-6}
& & 5 & 25 & 100 & 500\\
\hline
\multirow{11}{*}{\rotatebox{90}{Moteur}} & $N$ (tr/min) & 1800 & 1800 & 1800 & 18000 \\
& $V$ (V) & 240 & 440 & 440 & 1800 \\
& $R_{a}$ (m$\Omega$) & 615 & 430 & 71 & 14 \\
& $L_{a}$ (mH) & 4,5 & 5,5 & 1,8 & 0,19 \\
& $K_{m}$ (V $\cdot$ s) & 1,2 & 2,0 & 2,1 & 3,0 \\
& $\tau_{f}$ (kW) & 100 & 250 & 400 & 520 \\
& $P_{fm}$ (KW) & 0,35 & 1,1 & 1,8 & 5,2 \\
& $J_{m}$ (kg $\cdot$ m\textsuperscript{2}) & 0,05 & 0,2 & 0,83 & 10,3 \\
& $\tau_{a}$ (ms) & 7 & 13 & 25 & 14 \\
& $\tau_{m}$ (ms) & 21 & 22 & 13 & 16 \\
& $\eta$ (\%) & 80 & 85 & 91 & 94 \\
\hline
\multirow{5}{*}{\rotatebox{90}{Entraînement}} & $R_{a}$ (m$\Omega$) & 1230 & 860 & 142 & 28 \\
& $L_{a}$ (mH) & 4,9 & 6,0 & 2,0 & 0,21 \\
& $J_{m}$ (kg $\cdot$ m\textsuperscript{2}) & 0,30 & 1,2 & 5,0 & 62 \\
& $\tau_{a}$ (ms) & 4,1 & 7,0 & 14,1 & 7,5 \\
& $\tau_{m}$ (ms) & 250 & 258 & 156 & 192 \\
\hline
\end{tabular}%
}

\end{document}

enter image description here

To make everything fit, I suggest you increase the row spacing a bit using \renewcommand{\arraystretch}{1.25}.

5
  • 4
    You're cruel :D
    – CarLaTeX
    Nov 20, 2021 at 16:09
  • 4
    Now thats customer focus .... love it.
    – Ingmar
    Nov 20, 2021 at 16:12
  • Thaanks a loot you are a lifesaver
    – MrFlutter
    Nov 20, 2021 at 16:13
  • @MrFlutter You just need to remove the outer \rotatebox of course. Nov 20, 2021 at 16:28
  • 2
    You missed the gap in the last vertical line.:-) Nov 20, 2021 at 19:55
4

My understanding of the usual recommendations is that it's far easier to scan similar values down than across. Consequently, I would recommend transposing your table. For example, now I see how each of the parameters changes with $P_m$ and that Entraînement is repeating 5 of the parameters (although I'm not quite sure about the translation, so you may need to separate Entraînement into a separate table). I've also incorporated the package booktabs, which allows for slightly different thicknesses of the rules. You may also want to consider the package siunitx which can automatically align your numbers on the , instead of needing to pad them with trailing zeros (and can make typing the units a bit easier). In my quick attempt, however, siunitx made the table too wide (and it's already a bit too wide with the default settings).

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}
\caption{Valeurs typiques des paramètres d'un moteur à courant continu pour une puissance donnée ($P_m$).}
\centering
\begin{tabular}{ r r r r r r r r r r r r } 
\toprule
$P_m$ & $N$ & $V$ & $R_a$ & $L_a$ & $K_m$ & $\tau_f$ & $P_{fm}$ & $J_m$ & $\tau_a$ & $\tau_m$ & $\eta$ \\
kW & tr/min & V & m$\Omega$ & mH & V$\cdot$s & kW & kW & kg$\cdot$m\textsuperscript2 & ms & ms & \% \\
\midrule
5 & 1800 & 240 & 615 & 4,50 & 1,2 & 100 & 0,35 & 0,05 & 7,0 & 21 & 80 \\
25 & 1800 & 440 & 430 & 5,50 & 2,0 & 250 & 1,10 & 0,20 & 13,0 & 22 & 85 \\
100 & 1800 & 440 & 71 & 1,80 & 2,1 & 400 & 1,80 & 0,83 & 25,0 & 13 & 91 \\
500 & 18000 & 1800 & 14 & 0,19 & 3,0 & 520 & 5,20 & 10,30 & 14,0 & 16 & 94 \\
\midrule
\multicolumn{12}{c}{Entraînement}\\
\midrule
5 &&& 1230 & 4,90 &&&& 0,30 & 4,1 & 250 \\
25 &&& 860 & 6,00 &&&& 1,20 & 7,0 & 258 \\
100 &&& 142 & 2,00 &&&& 5,00 & 14,1 & 156 \\
500 &&& 28 & 0,21 &&&& 62,00 & 7,5 & 192\\
\bottomrule
\end{tabular}
\end{table}

\end{document}

code output

1
  • Thanks dude for your help
    – MrFlutter
    Nov 21, 2021 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .