3

I am currently writing my Master Thesis in Latex and I have a wide table, which it's in landscape mode. Also, in the Table, there is two rows which are entirely in bold: the header row and last row. I follow this question's answer Make first row of table all bold and it worked for the first row, however not for the last one.

enter image description here For the first row all columns are bold, but for the last, only the first is bold.

Can anyone help me, please? I am using LuaLatex and Miktex 2.9.

My MWE is:

\documentclass[ 
    11pt,                       
    a4paper,                    
    BCOR=15mm,                  
    bibliography=totoc,         
    DIV=9,                      
    final,                      
    headings=optiontohead,      
    listof=chaptergapsmall,     
    listof=totoc,               
    numbers=noenddot,           
    openright,                  
    parskip=half,               
    titlepage,                  
    twoside,                        
]{scrreprt}
%------------------------------
% DOCUMENT AND ENCODING
%------------------------------
\usepackage[
    english,                
    ngerman                 
]{babel}                    
\usepackage{datetime}       
\usepackage[
    T1                      
]{fontenc}                  
\usepackage[
    utf8                    
]{inputenc}                 
\usepackage[
    automark,               
    ilines                  
]{scrlayer-scrpage}

%------------------------------
% Tables
%------------------------------
\usepackage{booktabs}       
\usepackage{longtable}      
\usepackage{multirow}       
\usepackage{tabularx}       

%------------------------------
% GRAPHICS
%------------------------------
\usepackage{graphicx}       
\usepackage{overpic}        

%------------------------------
% FONT, MATH, AND SYMBOLS
%------------------------------
\usepackage{amsmath}        
\usepackage{amssymb}        
\usepackage[
    makeroom                
]{cancel}                   
\usepackage{chemfig}        
\usepackage{empheq}         
\usepackage{icomma}         
\usepackage{mathptmx}       
\usepackage[
    sc,                     
    osf                     
]{mathpazo}                 
\usepackage{mathtools}      
\usepackage[
version=4                   
]{mhchem}                   
\usepackage{nicefrac}       
\usepackage[
    output-decimal-marker={,}, 
    range-phrase={--},      
    range-units=single,     
    output-exponent-marker=\text{E}, 
    retain-explicit-plus    
]{siunitx}                  

%------------------------------
% TEXT
%------------------------------
\usepackage{blindtext}      
\usepackage[
    font={small,it},        
    labelfont=bf,           
    textformat=period,      
]{caption}                  
\usepackage{enumitem}       
\usepackage{footnote}       
\usepackage[
    framemethod=TikZ
]{mdframed}                 
\usepackage[all]{nowidow}   
\usepackage{placeins}       
\usepackage[
    onehalfspacing          
]{setspace}                 
\usepackage{subcaption}     
\usepackage{xcolor}         

%------------------------------
% References
%------------------------------
\usepackage[
    backref=true,           
    backrefstyle=three,     
    bibencoding=utf8,       
    citestyle=authoryear,   
    defernumbers=true,      
    date=year,              
    doi=true,               
    giveninits=true,        
    hyperref=true,          
    isbn=true,              
    maxbibnames=99,         
    sortlocale=auto,        
    style=authoryear,       
    uniquename=init,        
    url=true                
]{biblatex}
\usepackage[
    babel=true,             
    strict=true,
    english=american,       
    german=guillemets       
    ]{csquotes}             

%------------------------------
% LISTS OF SYMBOLS AND ABBREVIATIONS
%------------------------------
\usepackage[]{acronym}      
\usepackage[
    intoc,                  
    english                 
]{nomentbl}                 

%------------------------------
% CODE
%------------------------------
\usepackage{listings}       
\usepackage{scrhack}        

%------------------------------
% HYPERREF
%------------------------------
\usepackage[
    bookmarks,
    bookmarksopen=true,
    colorlinks=false,
    linkcolor=black,         
    anchorcolor=black,      
    citecolor=blue,         
    filecolor=magenta,      
    menucolor=black,        
    linkbordercolor=red,    
    citebordercolor=blue,   
    urlbordercolor=cyan,    
    %pagebackref,           
    pdfpagelabels,          
    hypertexnames=true,     
    linktocpage,            
]{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{tablefootnote}
\usepackage{lscape}
\usetikzlibrary{intersections, calc}
\usepackage{filecontents}
\usepackage{adjustbox}
\usepackage{array}
%\usepackage{subfig}
\usepackage{filecontents}
\usepackage{tikz,pgfplots}
\usepackage{soul}
%\usepackage[backend=bibtex,style=numeric-comp,natbib=true,sorting=none]{biblatex} 

\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
    #1\ignorespaces
}
\begin{document}

\begin{landscape}
\begin{table}[h!]
\resizebox{\pagewidth}{!}{%
\begin{tabular}{$c^c^c^c^c^c^c^c^c^c}
\rowstyle{\bfseries}k0      & 3             & 4               & 11             & 15             & 16             & 21             & 23             & 24             & 25             \\
1   & $\SI{-1,611698E+00}{}$ & $\SI{-5,15900258E-03}{}$ & $\SI{6,30506428E-04}{}$ & $\SI{1,76906828E-03}{}$ & $\SI{1,33663594E-01}{}$ & $\SI{1,48886466E-03}{}$ & $\SI{1,20976955E-01}{}$ & $\SI{1,34041033E-01}{}$ & $\SI{8,82496074E-01}{}$ \\
2   & $\SI{-1,611698E+00}{}$ & $\SI{-5,15900258E-03}{}$ & $\SI{6,26128162E-04}{}$ & $\SI{1,76906828E-03}{}$ & $\SI{1,20297235E-01}{}$ & $\SI{1,49439564E-03}{}$ & $\SI{1,00734380E-01}{}$ & $\SI{1,20636930E-01}{}$ & $\SI{8,71657257E-01}{}$ \\
3   & $\SI{-1,611698E+00}{}$ & $\SI{-5,15900258E-03}{}$ & $\SI{7,66274060E-04}{}$ & $\SI{1,59217479E-03}{}$ & $\SI{1,17781198E-01}{}$ & $\SI{1,50464406E-03}{}$ & $\SI{1,01117973E-01}{}$ & $\SI{1,08573237E-01}{}$ & $\SI{8,71657257E-01}{}$ \\
4   & $\SI{-1,611698E+00}{}$ & $\SI{-5,15900258E-03}{}$ & $\SI{7,94979626E-04}{}$ & $\SI{1,51805768E-03}{}$ & $\SI{1,15181913E-01}{}$ & $\SI{1,52044130E-03}{}$ & $\SI{1,02134836E-01}{}$ & $\SI{1,08573237E-01}{}$ & $\SI{8,80405384E-01}{}$ \\
5  & $\SI{-1,611698E+00}{}$ & $\SI{-5,15900258E-03}{}$ & $\SI{6,68034204E-04}{}$ & $\SI{1,68500964E-03}{}$ & $\SI{1,25576240E-01}{}$ & $\SI{1,52142533E-03}{}$ & $\SI{1,12348319E-01}{}$ & $\SI{9,77159132E-02}{}$ & $\SI{8,80405384E-01}{}$ \\
\rowstyle{\bfseries}Average & $\SI{-1,611698E+00}{}$ & $\SI{-5,159003E-03}{}$   & $\SI{6,946160E-04}{}$   & $\SI{1,635247E-03}{}$   & $\SI{1,216266E-01}{}$   & $\SI{1,493486E-03}{}$   & $\SI{1,031347E-01}{}$   & $\SI{1,128022E-01}{}$   & $\SI{8,425496E-01}{}$  
\end{tabular}}
\end{table}
\end{landscape}

\end{document}
  • please make your document minimal. remove all what is not related to table. on the first sight, the simplest solution is add to each cell in the last column command for bold face: \textbf{....} . since you have only few columns, this is not big deal to do ... – Zarko Jan 6 at 0:17
3

Rather than use the adjustbox machinery to squeeze your table with 9 data columns, each with numbers containing up to 9 digits after the decimal marker and exponent terms, into the width of the textblock, I'd use the machinery of the siunitx package to round all numbers to 3 digits after the decimal marker. (What are your readers supposed to take away from being 8 digits after the decimal markers? Three digits should be enough, right?)

Employing the package's S column type allows you to get rid of all $...$ wrappers and all \SI{...}{} wrappers, making the input much more legible.

I'd also use a tabular* environment instead of a tabular environment, to assure that the table fits inside the width of the (rotated) textblock.

These adjustments, along with providing a bit more visual structure to the table, should also make it unnecessary to use any bold-facing.

enter image description here

\documentclass[ 
    11pt, a4paper, BCOR=15mm, bibliography=totoc, 
    DIV=9, final, headings=optiontohead,  
    listof=chaptergapsmall, listof=totoc,   
    numbers=noenddot, openright, parskip=half,   
    titlepage, twoside]{scrreprt}

%% I've simplified the preamble to load only packages relevant for this example

\usepackage[automark,ilines]{scrlayer-scrpage}
\usepackage[english,ngerman]{babel}   
\usepackage[T1]{fontenc}  
\usepackage[utf8]{inputenc} 

\usepackage{booktabs}   
\usepackage{rotating}   

\usepackage{mathtools,amssymb} % 'mathtools' loads 'amsmath'   
%\usepackage{mathptmx} % why do you load this package?
%\usepackage[sc,osf]{mathpazo} % mathpazo is obsolete
\usepackage{newpxtext,newpxmath} 

\usepackage[output-decimal-marker={,}, 
            range-phrase={--},
            range-units=single,
            output-exponent-marker=\text{E},
            retain-explicit-plus
           ]{siunitx}  

\usepackage[font={small,it}, labelfont=bf, textformat=period]{caption}  
\usepackage[onehalfspacing]{setspace}
\usepackage{array}

\begin{document}

\begin{sidewaystable}
\small % for a 10 percent linear reduction in font size
\setlength\tabcolsep{0pt} % let LaTeX determine intercolumn whitespace
\sisetup{round-mode=places, round-precision=3, retain-zero-exponent} % new

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l 
       *{9}{S[table-format=-1.3e1]}}
k0 & {3} & {4} & {11} & {15} & {16} & {21} & {23} & {24} & {25} \\
\midrule
1 & -1,611698E+00& -5,15900258E-03& 6,30506428E-04& 1,76906828E-03& 1,33663594E-01& 1,48886466E-03& 1,20976955E-01& 1,34041033E-01& 8,82496074E-01 \\
2 & -1,611698E+00& -5,15900258E-03& 6,26128162E-04& 1,76906828E-03& 1,20297235E-01& 1,49439564E-03& 1,00734380E-01& 1,20636930E-01& 8,71657257E-01 \\
3 & -1,611698E+00& -5,15900258E-03& 7,66274060E-04& 1,59217479E-03& 1,17781198E-01& 1,50464406E-03& 1,01117973E-01& 1,08573237E-01& 8,71657257E-01 \\
4 & -1,611698E+00& -5,15900258E-03& 7,94979626E-04& 1,51805768E-03& 1,15181913E-01& 1,52044130E-03& 1,02134836E-01& 1,08573237E-01& 8,80405384E-01 \\
5 & -1,611698E+00& -5,15900258E-03& 6,68034204E-04& 1,68500964E-03& 1,25576240E-01& 1,52142533E-03& 1,12348319E-01& 9,77159132E-02& 8,80405384E-01 \\
\addlinespace
Avg & -1,611698E+00 & -5,159003E-03 & 6,946160E-04 & 1,635247E-03 & 1,216266E-01 & 1,493486E-03 & 1,031347E-01 & 1,128022E-01 & 8,425496E-01 
\end{tabular*}
\end{sidewaystable}

\end{document}
2

For rows containing maths, use

\rowstyle\bfseries\mathversion{bold} 

and add

\sisetup{detect-weight}

Edit:

Also, if you absolutely want to use resizebox, write

\resizebox{\textheight}{...}
  • I used this and the table, instead of shrinking, got massive. – user151562 Jan 6 at 12:24
  • Sorry, I forgot one detail: use \textheight instead of \pagewidth. You also can play with the fontsize and the value of \tabcolsep (which would be better). – Bernard Jan 6 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.