TeX - LaTeX Asked by velocivirusssss on July 28, 2021
I was trying to align one figure and two tables in the same row while still have a caption to each table. Currently I am using something like:
documentclass{article}
usepackage[utf8]{inputenc} % allow utf-8 input
usepackage[T1]{fontenc} % use 8-bit T1 fonts
usepackage{hyperref} % hyperlinks
usepackage{url} % simple URL typesetting
usepackage{booktabs} % professional-quality tables
usepackage{amsfonts} % blackboard math symbols
usepackage{nicefrac} % compact symbols for 1/2, etc.
usepackage{microtype} % microtypography
usepackage{xcolor} % colors
usepackage{times,latexsym}
usepackage[T1]{fontenc}
usepackage{url}
usepackage{tabularx}
usepackage{times}
usepackage{array}
usepackage{tikz}
usepackage{soul}
usepackage{caption, floatrow}
renewcommand{UrlFont}{ttfamilysmall}
usepackage{times}
usepackage{graphicx}
usepackage{multirow}
usepackage[official]{eurosym}
usepackage{mathtools}
usepackage{adjustbox}
usepackage{subfig}
usepackage{wrapfig}
usepackage{lipsum}
usepackage{subcaption}
newsavebox{bigimage}
usepackage{caption}
newfloatcommand{capbtabbox}{table}[][0.25linewidth]
begin{document}
begin{figure}
CenterFloatBoxes
begin{floatrow}
ffigbox[0.8textwidth]{
includegraphics[width=0.8textwidth]{Rplot01.png}
}{
caption{
figure 1 of some kind}
}
capbtabbox[0.2textwidth]{
caption{first table}
begin{tabular}{l|ccc}
toprule
& AA & BB & CC
midrule
Number & 20.0 & 21.0 & 22.0
- (first exp) & 23.0 & 24.0 & 25.0
- (second exp) & 20.0 & 21.0 & 22.0
bottomrule
end{tabular}
adjustbox{width=0.5textwidth}{caption{second table}begin{tabular}{l|ccc}
toprule
&
midrule
invalid experiments & 300 hdashline
valid experiments with positive top 1 & 10 (25%)
valid experiments with negative top 1 & 50 (75%)
bottomrule
end{tabular}}
}{}
end{floatrow}
end{figure}
end{document}
The issue is that table 1’s caption disappears and table 1 and table 2 are not having the same width. I still want the image at the left and two vertically stacked tables on the right with each table’s caption below the table itself, something like:
Thanks for any help!
Like this:
minipage
scaptionof{table}{...}
small
font size is usedtimes
the newtxtext
font is useddocumentclass{article}
usepackage[T1]{fontenc} % use 8-bit T1 fonts
usepackage{newtxtext}
usepackage{microtype}
usepackage[export]{adjustbox}
usepackage[skip=1ex, below skip=2ex]{caption}
usepackage{makecell}
%---------------------------------------------------------------%
usepackage{lipsum}% For dummy text. Don't use in a real document
begin{document}
lipsum[66]
begin{figure}[ht]
begin{minipage}{0.4textwidth}centering
includegraphics[width=textwidth]{example-image-duck}
caption{figure 1 of some kind}
end{minipage}hfill
begin{minipage}{0.56textwidth}
small
captionsetup{singlelinecheck=false}
begin{tabular}{@{} l|ccc @{}}
Xhline{1pt}
& AA & BB & CC
Xhline{0.5pt}
Number & 20.0 & 21.0 & 22.0
- (first exp) & 23.0 & 24.0 & 25.0
- (second exp) & 20.0 & 21.0 & 22.0
Xhline{1pt}
end{tabular}
captionof{table}{first table}
begin{tabular}{@{} l|c @{}}
Xhline{1pt}
invalid experiments & 300
valid experiments with positive top 1 & 10 (25%)
valid experiments with negative top 1 & 50 (75%)
Xhline{1pt}
end{tabular}
captionof{table}{second table}
end{minipage}
end{figure}
lipsum[66]
end{document}
Note:
hyperref
had to be load last in preamblehyperref
also load url
, so it not need to be loaded againsubfig
and subcaption
doesn't work well together, Stik with just one of them, the more powerful is subcaption
Correct answer by Zarko on July 28, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP