答案1
- 似乎是时候开始阅读一些关于餐桌布置的介绍材料了
latex
,例如LaTeX/表格 - 在我看来,你问题中显示的表格非常丑陋
- 关于漂亮桌子的设计,请参阅哪些表格是真实存在的
考虑到以上链接,我提出以下解决方案:
\documentclass{article} \usepackage{siunitx} \usepackage{booktabs, tabularx} \newcommand\mcx[1]{\multicolumn{1}{@{}>{\centering\arraybackslash}X@{}}{#1}} \begin{document} \begin{tabularx}{\linewidth}{@{} l *{5}{S[table-format=2.2, group-separator={,}]} @{}} \toprule Unités d'enseignements & \mcx{Coeff. ECTS} & \mcx{Moyenne} & \mcx{Moy. de la classe} & \mcx{Min} & \mcx{Max} \\ \midrule Français & 2,0 & 11,40 & 9,76 & 7,00 & 14,60 \\ Anglais & 3,0 & 15,25 & 13,41 & 8,65 & 17,08 \\ $\vdots$ & & & & & \\ Challenge C & 2,0 & 16,00 & 13,21 & 8,00 & 19,00 \\ \midrule \multicolumn{2}{@{}l}{MOYENNE DU SEMESTRE I} & 11,27 & 10,96 & 8,90 & 13,02 \\ \bottomrule \end{tabularx} \end{document}
答案2
我想你想要这样的东西:
\documentclass[a4paper]{article}
%\usepackage[hmarginratio=1:1,left=1cm,right=1cm]{geometry}
\usepackage[utf8]{inputenc}
%... accepts latin accentuation
%%%%%%%%%%%%%%%%%%%% For table environment %%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{multirow} %
\usepackage{color, colortbl} %
\definecolor{Gray}{gray}{0.9} %
\usepackage{float} %
%... required for tables and figures in the multi-column %
%... environment - they need to be placed in specific locations %
%... with the [H] (e.g. \begin{table}[H]) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tw}{\textwidth}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{||p{.4\tw}||p{.12\tw}||p{.12\tw}||p{.12\tw}||p{.12\tw}||p{.12\tw}||}%
%... p{<width>} controls the column width
%... each | means vertical border
\hline\hline %-> Generates double horizontal top of the row
\rowcolor{Gray} %-> Makes the next raw become gray
%-> First row contents:
\textbf{Unités d'enseignements} &
\textbf{Coefficient/ ECTS} &
\textbf{Moyenne} &
\textbf{Moy. de la classe} &
\textbf{Min} &
\textbf{max} %
\\ %... returns to second row
\hline\hline %-> Generates double horizontal top of the row
%
%-> Second row contents:
Français &
2,0 &
11,40 &
9,76 &
7,00 &
14,60 %
\\ %... returns to third row
\hline %-> Generates horizontal top of the row
%-> Third row contents:
Anglais &
3,0 &
15,25 &
13,41 &
8,65 &
17,08 %
\\ %... returns to fourth row
\hline\hline %-> Generates double horizontal top of the row
\rowcolor{Gray} %-> Makes the next raw become gray
%-> Merging cells of adjacent columns:
\multicolumn{2}{||p{.575\tw}}{\textbf{MOYENNE DU SEMESTRE I}} &
\textbf{11,27} &
10,96 &
8,90 &
13,02 %
\\ %
\hline\hline %-> Generates double horizontal top of the row
\end{tabular}
\end{table}
\end{document}