TransWikia.com

Left justified table captions with threeparttable and chemstyle

TeX - LaTeX Asked on September 30, 2021

First post here, be gentle. I have a problem that I already spent countless hours on. I am a Latex newbie, so this is taking me longer than it should.

I want to align a caption on the left with a table, but the table to be centered. This should be very easily done with threeparttable. But it doesn’t work. While creating an MWE for you guys I found out that it works until I load the chemstyle package. If I comment it out, it works like it should. Probably because this in turn loads the float package? Can somebody give me an easy fix on how to solve the issue?
Thank you so much!

documentclass[version, 12pt, USenglish, a4paper, parskip=full]{scrbook}

usepackage[varioref=false]{chemstyle} %also loads chemscheme, psfrags, xspace, amstext, caption, float, kvoptions, siunitx or SIunits 

% TABLES: 
usepackage{booktabs}   
usepackage{multirow}   
usepackage{makecell}   
usepackage{caption} 
captionsetup[table]{singlelinecheck=false, justification=justified}
usepackage[flushleft]{threeparttable}

begin{document}

begin{table}[h]
    centering
    label{tab:binding-energies}
    begin{threeparttable}
        caption{Exemplary table text: Very very long caption, so very very very long. Oh long John. Long looooooong maaaaaaaaaan.}
        begin{tabular}{@{}l|l@{}}
            toprule
            Column one              & Column twotnote{1}          midrule
            bbbbb bbbb              & 200--300   bli bla          
            cccccccccccc ccccccc    & 50--200 yadda yadda yadda    bottomrule
        end{tabular}
        begin{tablenotes}
            item[1] Lorem ipsum dolor sit amet who am I kidding I dont know how to continue this fake text and I am too lazy to copy it from the web.
        end{tablenotes}
    end{threeparttable}
end{table}

end{document}

One Answer

Since you used the chemstyle bundle in order to get access to the scheme float that can be used for reaction schemes, I suggest switching to chemmacros and its scheme module instead. Captions in a threeparttable are still as wide as the table if chemmacros is loaded:

enter image description here

documentclass[version, 12pt, USenglish, a4paper, parskip=full]{scrbook}

usepackage{chemmacros}
usechemmodule{scheme}

% TABLES: 
usepackage{booktabs}   
usepackage{multirow}   
usepackage{makecell}   
usepackage{caption} 
captionsetup[table]{singlelinecheck=false, justification=justified}
usepackage[flushleft]{threeparttable}

begin{document}

begin{table}[h]
    centering
    label{tab:binding-energies}
    begin{threeparttable}
        caption{Exemplary table text: Very very long caption, so very very very long. Oh long John. Long looooooong maaaaaaaaaan.}
        begin{tabular}{@{}l|l@{}}
            toprule
            Column one              & Column twotnote{1}          midrule
            bbbbb bbbb              & 200--300   bli bla          
            cccccccccccc ccccccc    & 50--200 yadda yadda yadda    bottomrule
        end{tabular}
        begin{tablenotes}
            item[1] Lorem ipsum dolor sit amet who am I kidding I dont know how to continue this fake text and I am too lazy to copy it from the web.
        end{tablenotes}
    end{threeparttable}
end{table}


begin{scheme}
caption{reaction scheme}
end{scheme}
end{document}

Correct answer by leandriis on September 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP