表の行を太字にする

表の行を太字にする

以下の MWE を検討してください。次の表が得られます。ここで、表を通過するはしご状の線を太字にしたいと思います。これを実現する方法について何かアイデアはありますか?

ここに画像の説明を入力してください

\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}

答え1

パッケージ をロードしbooktabs、垂直線を削除して のようなものを使用できます\cmidrule[\heavyrulewidth](lr){11-11}

さらに、パッケージSで定義された列タイプを使用してsiunitx、数値の書式設定と配置を行うこともできます。

\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}

ここに画像の説明を入力してください

最初の列の行がなければ、環境内で\cmidrulewidthを変更できます。\heavyrulewidthtable

\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}

ここに画像の説明を入力してください

答え2

標準フォントには、b数字の幅が中サイズの数字と同じフォント シリーズ (ただし、固定サイズでのみ使用可能) があるという事実を利用できます。

すべての列の配置は右揃えにする必要があることに注意してください。

\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}

ここに画像の説明を入力してください

siunitxおよびも同様ですbooktabs

\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}

ここに画像の説明を入力してください

答え3

「少ないほど良い」ということわざを心に留めて、ないラダー ラインを太字にします。代わりに、ほとんどの縦線を削除すると、ラダー ラインがそれ自体できれいに目立つようになります。

また、水平方向の空白の量を減らすことをお勧めします(パラメータによって制御されます\tabcolsep)が、増加\extrarowheight表内の垂直方向の空白の量 (パラメータ によって制御されます)。また、すべての数字の千単位の区切りとして単語間の完全なスペースを使用すると、空白が多すぎるように思われます。列 2 から 11 にはS列タイプ (パッケージによって提供siunitx) を使用することをお勧めします。これにより、LaTeX は千単位の区切りとして「薄いスペース」を挿入します。

ここに画像の説明を入力してください

\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}

関連情報