table-minimal.tex 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. \documentclass[a4paper]{scrartcl}
  2. \usepackage{amssymb, amsmath} % needed for math
  3. \usepackage[utf8]{inputenc} % this is needed for umlauts
  4. \usepackage[ngerman]{babel} % this is needed for umlauts
  5. \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
  6. \usepackage[margin=2.5cm]{geometry} %layout
  7. \usepackage{hyperref} % links im text
  8. \usepackage{siunitx}
  9. \usepackage{booktabs}
  10. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  11. % Begin document %
  12. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  13. \begin{document}
  14. \newcolumntype{+}{>{\global\let\currentrowstyle\relax}}
  15. \newcolumntype{^}{>{\currentrowstyle}}
  16. \newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
  17. #1\ignorespaces
  18. }
  19. \begin{table}[ht]
  20. \centering
  21. \begin{tabular}{+l|^r^r^r}
  22. \toprule
  23. \rowstyle{\bfseries}%
  24. Country / Property & Population & Area & HDI \\\midrule
  25. France & $66 \cdot 10^6$ & $\SI{668763}{\km\squared}$ & 0.89 \\
  26. Germany & $81 \cdot 10^6$ & $\SI{357167}{\km\squared}$ & 0.92 \\
  27. United States & $317 \cdot 10^6$ & $\SI{9629091}{\km\squared}$ & 0.94 \\\bottomrule
  28. \end{tabular}
  29. \caption{Information about countries}
  30. \label{table:countries}
  31. \end{table}
  32. \end{document}