Eine Zeile in einer Tabelle fett darstellen

Eine Zeile in einer Tabelle fett darstellen

Bitte beachten Sie das MWE unten, das ergibt die folgende Tabelle. Jetzt möchte ich, dass die leiterartige Linie, die durch die Tabelle verläuft, fett gedruckt wird. Irgendwelche Ideen, wie das gemacht werden kann?

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{float}

\begin{document}

\begin{table}[h]
\scriptsize
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|}
\hline
 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ \hline
 1 &  270 061 &  672 616 &  704 494 &  753 437 &  417 350 &  292 570 &  268  343 & 182 034 &  272 606 &  67 948 \\ \cline{1-1} \cline{11-11} 
2 &  376 125 &  936 779 & 981 176 &  1 049 342 &  581 259 & 407 474 & 373 732 &  253 526 &  379 669 & 94633 \\ \cline{1-1} \cline{10-10}
3 & 372 325 &  927 315 &  971 264 &  1 038 741 &  575 387 & 403 358 & 369 956 &250 965 & 375 833 & 93677 \\ \cline{1-1} \cline{9-9}
4 & 366 724 &  913 365 &  956 652 & 1 023 114 & 566 731 & 397 289 & 364 391 & 247 190 & 370 179 & 92 268 \\ \cline{1-1} \cline{8-8}
5 &  336 287 & 837 559 &  877 253 & 938 199 & 519 694 & 364 316 & 334 148 & 226 674 & 339 455 & 84 610 \\ \cline{1-1} \cline{7-7}
6 &  353 798 &  881 171 & 922 933 & 987 052 &  546 756 & 383 286 & 351 547 & 238 477 & 357 131 & 89 016 \\ \cline{1-1} \cline{6-6}
7 &  391 841 &  975 923 &  1 022 175 & 1 093 189 & 605 548 &424 501 & 389 349 & 264 120 &395 533 & 98 588 \\ \cline{1-1} \cline{5-5}
8 &  469 647 &  1 169 707 &  1 225 143 &1 310 258 & 725 788 & 508 791 & 466 660 & 316 565 & 474 072 & 118 164 \\ \cline{1-1} \cline{4-4}
9 & 390 560 &  972 733 & 1 018 834 & 1 089 616 &603 568 & 423 113 & 388 076 & 263 257 & 394 240 & 98 265 \\ \cline{1-1} \cline{3-3}
10 &  344 014 &856 803 & 897 410 & 959 756 & 531 635 & 372 687 & 341 825 & 231882 & 347 255 & 86555 \\ \hline
\end{tabular}
\end{table}

\end{document}

Antwort1

Sie können das Paket laden booktabs, die vertikalen Linien entfernen und etwas wie verwenden \cmidrule[\heavyrulewidth](lr){11-11}.

SDarüber hinaus können Sie auch den vom Paket definierten Spaltentyp verwenden, siunitxum die Zahlen zu formatieren und auszurichten.

\documentclass{article}
\usepackage{float}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}[h]
\scriptsize
\sisetup{table-format=6.0}
\begin{tabular}{rS*{3}{S[table-format=7.0]}*{6}{S}}
\toprule
 & {1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9} & {10} \\ \midrule
 1 &  270061 &  672 616 &  704 494 &  753 437 &  417 350 &  292 570 &  268  343 & 182 034 &  272 606 &  67 948 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){11-11} 
2 &  376125 &  936 779 & 981 176 &  1 049 342 &  581 259 & 407 474 & 373 732 &  253 526 &  379 669 & 94 633 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){10-10}
3 & 372325 &  927 315 &  971 264 &  1 038 741 &  575 387 & 403 358 & 369 956 &250 965 & 375 833 & 93 677 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){9-9}
4 & 366 724 &  913 365 &  956 652 & 1 023 114 & 566 731 & 397 289 & 364 391 & 247 190 & 370 179 & 92 268 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){8-8}
5 &  336 287 & 837 559 &  877 253 & 938 199 & 519 694 & 364 316 & 334 148 & 226 674 & 339 455 & 84 610 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){7-7}
6 &  353 798 &  881 171 & 922 933 & 987 052 &  546 756 & 383 286 & 351 547 & 238 477 & 357 131 & 89 016 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){6-6}
7 &  391 841 &  975 923 &  1 022 175 & 1 093 189 & 605 548 &424 501 & 389 349 & 264 120 &395 533 & 98 588 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){5-5}
8 &  469 647 &  1 169 707 &  1 225 143 &1 310 258 & 725 788 & 508 791 & 466 660 & 316 565 & 474 072 & 118 164 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){4-4}
9 & 390 560 &  972 733 & 1 018 834 & 1 089 616 &603 568 & 423 113 & 388 076 & 263 257 & 394 240 & 98 265 \\ \cmidrule(lr){1-1} \cmidrule[\heavyrulewidth](lr){3-3}
10 &  344 014 &856 803 & 897 410 & 959 756 & 531 635 & 372 687 & 341 825 & 231 882 & 347 255 & 86 555 \\ \bottomrule
\end{tabular}
\end{table}

\end{document}

Bildbeschreibung hier eingeben

Ohne die Zeilen in der ersten Spalte können Sie das \cmidrulewidth„in“ \heavyrulewidthinnerhalb der tableUmgebung ändern.

\documentclass{article}
\usepackage{float}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{table}[h]
\scriptsize
\sisetup{table-format=6.0}
\setlength\cmidrulewidth{\heavyrulewidth}
\begin{tabular}{rS*{3}{S[table-format=7.0]}*{6}{S}}
\toprule
 & {1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9} & {10} \\ \midrule
 1 &  270061 &  672 616 &  704 494 &  753 437 &  417 350 &  292 570 &  268  343 & 182 034 &  272 606 &  67 948 \\ \cmidrule(lr){11-11} 
2 &  376125 &  936 779 & 981 176 &  1 049 342 &  581 259 & 407 474 & 373 732 &  253 526 &  379 669 & 94 633 \\ \cmidrule(lr){10-10}
3 & 372325 &  927 315 &  971 264 &  1 038 741 &  575 387 & 403 358 & 369 956 &250 965 & 375 833 & 93 677 \\ \cmidrule(lr){9-9}
4 & 366 724 &  913 365 &  956 652 & 1 023 114 & 566 731 & 397 289 & 364 391 & 247 190 & 370 179 & 92 268 \\ \cmidrule(lr){8-8}
5 &  336 287 & 837 559 &  877 253 & 938 199 & 519 694 & 364 316 & 334 148 & 226 674 & 339 455 & 84 610 \\ \cmidrule(lr){7-7}
6 &  353 798 &  881 171 & 922 933 & 987 052 &  546 756 & 383 286 & 351 547 & 238 477 & 357 131 & 89 016 \\ \cmidrule(lr){6-6}
7 &  391 841 &  975 923 &  1 022 175 & 1 093 189 & 605 548 &424 501 & 389 349 & 264 120 &395 533 & 98 588 \\ \cmidrule(lr){5-5}
8 &  469 647 &  1 169 707 &  1 225 143 &1 310 258 & 725 788 & 508 791 & 466 660 & 316 565 & 474 072 & 118 164 \\ \cmidrule(lr){4-4}
9 & 390 560 &  972 733 & 1 018 834 & 1 089 616 &603 568 & 423 113 & 388 076 & 263 257 & 394 240 & 98 265 \\ \cmidrule(lr){3-3}
10 &  344 014 &856 803 & 897 410 & 959 756 & 531 635 & 372 687 & 341 825 & 231 882 & 347 255 & 86 555 \\ \bottomrule
\end{tabular}
\end{table}

\end{document}

Bildbeschreibung hier eingeben

Antwort2

Dabei macht man sich die Tatsache zunutze, dass es bei den Standardschriften eine Schriftreihe gibt b(allerdings nur in fester Größe verfügbar), bei der die Ziffern die gleiche Breite haben wie die Ziffern mittlerer Größe.

Beachten Sie, dass die Ausrichtung in allen Spalten rechts sein sollte.

\documentclass{article}
\usepackage{graphicx}

\newcommand{\bn}[1]{{\fontseries{b}\selectfont#1}}
\newcommand{\tc}[1]{\multicolumn{1}{c|}{#1}}

\begin{document}

\begin{table}
\centering

\resizebox{\textwidth}{!}{%
\begin{tabular}{|*{11}{r|}}
\hline
& \tc{1} & \tc{2} & \tc{3} & \tc{4} & \tc{5} & \tc{6} & \tc{7} & \tc{8} & \tc{9} & \tc{10} \\ \hline
1  & 270 061 &   672 616 &   704 494 &   753 437 & 417 350 & 292 570 & 268 343 & 182 034 & 272 606 & \bn{67 948} \\ \cline{1-1} \cline{11-11} 
2  & 376 125 &   936 779 &   981 176 & 1 049 342 & 581 259 & 407 474 & 373 732 & 253 526 & \bn{379 669} &  94 633 \\ \cline{1-1} \cline{10-10}
3  & 372 325 &   927 315 &   971 264 & 1 038 741 & 575 387 & 403 358 & 369 956 & \bn{250 965} & 375 833 &  93 677 \\ \cline{1-1} \cline{9-9}
4  & 366 724 &   913 365 &   956 652 & 1 023 114 & 566 731 & 397 289 & \bn{364 391} & 247 190 & 370 179 &  92 268 \\ \cline{1-1} \cline{8-8}
5  & 336 287 &   837 559 &   877 253 &   938 199 & 519 694 & \bn{364 316} & 334 148 & 226 674 & 339 455 &  84 610 \\ \cline{1-1} \cline{7-7}
6  & 353 798 &   881 171 &   922 933 &   987 052 & \bn{546 756} & 383 286 & 351 547 & 238 477 & 357 131 &  89 016 \\ \cline{1-1} \cline{6-6}
7  & 391 841 &   975 923 & 1 022 175 & \bn{1 093 189} & 605 548 & 424 501 & 389 349 & 264 120 & 395 533 &  98 588 \\ \cline{1-1} \cline{5-5}
8  & 469 647 & 1 169 707 & \bn{1 225 143} & 1 310 258 & 725 788 & 508 791 & 466 660 & 316 565 & 474 072 & 118 164 \\ \cline{1-1} \cline{4-4}
9  & 390 560 & \bn{972 733} & 1 018 834 & 1 089 616 & 603 568 & 423 113 & 388 076 & 263 257 & 394 240 &  98 265 \\ \cline{1-1} \cline{3-3}
10 & \bn{344 014} &   856 803 &   897 410 &   959 756 & 531 635 & 372 687 & 341 825 & 231 882 & 347 255 &  86 555 \\ \hline
\end{tabular}%
}
\end{table}

\end{document}

Bildbeschreibung hier eingeben

Das gleiche mit siunitxundbooktabs

\documentclass{article}
\usepackage{graphicx}
\usepackage{siunitx,booktabs}

\begin{document}

\begin{table}

% a local command
\newcommand{\bn}[1]{%
  \multicolumn{1}{%
    S[table-format=7.0,
      mode=text,
      text-rm=\fontseries{b}\selectfont
     ]}{#1}%
}

\centering

\resizebox{\textwidth}{!}{%
\begin{tabular}{r *{10}{S[detect-weight,table-format=7.0]}}
\toprule
& {1} & {2} & {3} & {4} & {5} & {6} & {7} & {8} & {9} & {10} \\
\midrule
1  & 270 061 &   672 616 &   704 494 &   753 437 & 417 350 & 292 570 & 268 343 & 182 034 & 272 606 & \bn{67 948} \\ \cmidrule(lr){11-11} 
2  & 376 125 &   936 779 &   981 176 & 1 049 342 & 581 259 & 407 474 & 373 732 & 253 526 & \bn{379 669} &  94 633 \\ \cmidrule(lr){10-10}
3  & 372 325 &   927 315 &   971 264 & 1 038 741 & 575 387 & 403 358 & 369 956 & \bn{250 965} & 375 833 &  93 677 \\ \cmidrule(lr){9-9}
4  & 366 724 &   913 365 &   956 652 & 1 023 114 & 566 731 & 397 289 & \bn{364 391} & 247 190 & 370 179 &  92 268 \\ \cmidrule(lr){8-8}
5  & 336 287 &   837 559 &   877 253 &   938 199 & 519 694 & \bn{364 316} & 334 148 & 226 674 & 339 455 &  84 610 \\ \cmidrule(lr){7-7}
6  & 353 798 &   881 171 &   922 933 &   987 052 & \bn{546 756} & 383 286 & 351 547 & 238 477 & 357 131 &  89 016 \\ \cmidrule(lr){6-6}
7  & 391 841 &   975 923 & 1 022 175 & \bn{1 093 189} & 605 548 & 424 501 & 389 349 & 264 120 & 395 533 &  98 588 \\ \cmidrule(lr){5-5}
8  & 469 647 & 1 169 707 & \bn{1 225 143} & 1 310 258 & 725 788 & 508 791 & 466 660 & 316 565 & 474 072 & 118 164 \\ \cmidrule(lr){4-4}
9  & 390 560 & \bn{972 733} & 1 018 834 & 1 089 616 & 603 568 & 423 113 & 388 076 & 263 257 & 394 240 &  98 265 \\ \cmidrule(lr){3-3}
10 & \bn{344 014} &   856 803 &   897 410 &   959 756 & 531 635 & 372 687 & 341 825 & 231 882 & 347 255 &  86 555 \\
\bottomrule
\end{tabular}%
}
\end{table}

\end{document}

Bildbeschreibung hier eingeben

Antwort3

Im Bewusstsein des Sprichworts „weniger ist mehr“ schlage ich vor, SienichtMachen Sie die Leiterlinie fett; entfernen Sie stattdessen die meisten vertikalen Linien, dann wird die Leiterlinie gut für sich allein hervorstechen.

Ich möchte Ihnen auch vorschlagen, die Menge an horizontalen Leerzeichen (gesteuert durch den Parameter \tabcolsep) zu reduzieren, aberZunahmedie Menge an vertikalem Leerraum (bestimmt durch den Parameter \extrarowheight) in der Tabelle. Ich würde auch sagen, dass die Verwendung eines vollständigen Wortzwischenraums als Tausendertrennzeichen für alle Zahlen zu viel Leerraum zu erzeugen scheint; ich schlage vor, dass Sie den SSpaltentyp (vom siunitxPaket bereitgestellt) für die Spalten 2 bis 11 verwenden, wodurch LaTeX ein „dünnes Leerzeichen“ als Tausendertrennzeichen einfügt.

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{array,booktabs,siunitx}
\newcommand\vv[1]{\multicolumn{1}{S|}{#1}} % handy shortcut macro
\begin{document}

\begin{table}[h]
\setlength\extrarowheight{1pt} % more vertical whitespace
\setlength\tabcolsep{3pt}      % less horizontal whitespace
\sisetup{table-format=7.0} 
\scriptsize
\begin{tabular}{@{} l *{10}{S} @{}}
\toprule
&{1}&{2}&{3}&{4}&{5}&{6}&{7}&{8}&{9}&{10}\\
\midrule
1&270061&672616&704494&753437&417350&292570&268343&182034&272606&67948\\ \cline{11-11}
2&376125&936779&981176&1049342&581259&407474&373732&253526&\vv{379669}&94633\\ \cline{10-10}
3&372325&927315&971264&1038741&575387&403358&369956&\vv{250965}&375833&93677\\ \cline{9-9}
4&366724&913365&956652&1023114&566731&397289&\vv{364391}&247190&370179&92268\\ \cline{8-8}
5&336287&837559&877253&938199&519694&\vv{364316}&334148&226674&339455&84610\\ \cline{7-7}
6&353798&881171&922933&987052&\vv{546756}&383286&351547&238477&357131&89016\\ \cline{6-6}
7&391841&975923&1022175&\vv{1093189}&605548&424501&389349&264120&395533&98588\\ \cline{5-5}
8&469647&1169707&\vv{1225143}&1310258&725788&508791&466660&316565&474072&118164\\ \cline{4-4}
9&390560&\vv{972733}&1018834&1089616&603568&423113&388076&263257&394240&98265\\ \cline{3-3}
10&\vv{344014}&856803&897410&959756&531635&372687&341825&231882&347255&86555\\
\bottomrule
\end{tabular}
\end{table}

\end{document}

verwandte Informationen