Fazendo uma linha em uma tabela em negrito

Fazendo uma linha em uma tabela em negrito

Por favor, considere o MWE abaixo, isso fornece a tabela a seguir. Agora quero que a linha em forma de escada que passa pela mesa fique em negrito. Alguma idéia de como isso pode ser feito?

insira a descrição da imagem aqui

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

Responder1

Você pode carregar o pacote booktabs, remover as linhas verticais e usar algo como \cmidrule[\heavyrulewidth](lr){11-11}.

Além disso, você também pode usar o Stipo de coluna definido pelo siunitxpacote para formatar e alinhar os números.

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

insira a descrição da imagem aqui

Sem as linhas da primeira coluna você pode alterar \cmidrulewidthpara \heavyrulewidthdentro do tableambiente.

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

insira a descrição da imagem aqui

Responder2

Você pode usar o fato de que as fontes padrão possuem uma série de fontes b(disponível apenas em tamanho fixo, no entanto) onde os dígitos têm a mesma largura que os de tamanho médio.

Observe que o alinhamento deve ser à direita em todas as colunas.

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

insira a descrição da imagem aqui

O mesmo com siunitxebooktabs

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

insira a descrição da imagem aqui

Responder3

Atento ao ditado “menos é mais”, sugiro que vocênãodeixe a linha da escada em negrito; em vez disso, livre-se da maioria das linhas verticais e a linha da escada se destacará por si só.

Eu também gostaria de sugerir que você reduzisse a quantidade de espaços em branco horizontais (controlados pelo parâmetro \tabcolsep), masaumentara quantidade de espaços em branco verticais (controlados pelo parâmetro \extrarowheight) na tabela. Eu também diria que usar um espaço completo entre palavras como separador de milhares para todos os números parece fornecer muito espaço em branco; Eu sugiro que você use o Stipo de coluna (fornecido pelo siunitxpacote) para as colunas 2 a 11, o que fará com que o LaTeX insira um "espaço fino" como separador de milhares.

insira a descrição da imagem aqui

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

informação relacionada