0
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\usepackage{tabularx}

\begin{document}
\begin{table*}[h]
\renewcommand{\arraystretch}{1.2}

\begin{subtable}{0.22\textwidth}
\centering
\begin{tabular}{c}
\includegraphics[width=0.5\textwidth]{A.jpg}
\end{tabular}
\end{subtable}%
\begin{subtable}{0.75\textwidth}
\begin{tabular}{rp{27em}}
\textbf{SRC}: & caption1 \\
\textbf{Prototypa}: & caption2 \\
\textbf{MODEL2}: & caption3 \\
\textbf{MODEL3}: & caption4 \\
\textbf{MODEL4}: & caption5 \\

\end{tabular}
\end{subtable}

 \caption{ Examples how the model behaves.}
 \end{table*}
 \end{document}
2
  • Welcome to TeX.se, and thanks for adding an example document. I made your example compilable. To format code on the site, select it all an click on the {} icon, or use Control-K. It's also helpful to add a bit of explanation of your problem in the question itself instead of just relying on the question title to convey your problem.
    – Alan Munn
    Commented Mar 4, 2019 at 0:18
  • 2
    This is now quite different from your original question. But as I showed in my answer, there is really no need for subcaption here. You can do this all with a tabular. But you still haven't explained what you want the output to look like.
    – Alan Munn
    Commented Mar 4, 2019 at 21:05

1 Answer 1

1

I don't think you need to use the subcaption package at all for what you want to do. Instead, just put everything into a tabular. I've used the technique described in this answer to centre the images and the labels vertically. I've made a counter to number the rows automatically. You'll need to reset the counter using \setcounter{imgcnt}{0} before each table that you want to have counted. This can be made more automatic by hooking into the tabular environment, but not if you have tabulars inside other tabulars as you have here. I've also simplified these tables from your examples, because it was unclear what you were trying to do with them.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{linguex}
\usepackage{array}
\usepackage{etoolbox}
\newcounter{imgcnt}
\renewcommand{\theimgcnt}{\arabic{imgcnt})}
\newcommand{\tcount}{\stepcounter{imgcnt}\theimgcnt}

% Technique for centring image from https://tex.stackexchange.com/a/69747/2693
\newcommand{\tabincgr}[2][]{\ensuremath{\vcenter{\hbox{\includegraphics[#1]{#2}}}}}


\begin{document}
\begin{table*}
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{m{.05\linewidth}p{.2\linewidth}p{.75\linewidth}}
\tcount &
\tabincgr[width=0.75\linewidth]{a.jpg}
&
\begin{tabular}{rp{27em}}
line 1\\
line 2\\
line 3\\
line 4
\end{tabular}
\\
\\
\tcount &
\tabincgr[width=0.5\linewidth]{b.jpg}
&
\begin{tabular}{rp{27em}}
line 1\\
line 2 \\
line 3\\
line 4
\end{tabular}
\\
\\
\tcount &
\tabincgr[width=0.75\linewidth]{c.jpg}
&
\begin{tabular}{rp{27em}}
line 1\\
line 2\\
line 3 \\
line 4
\end{tabular}
\end{tabular}
\caption{ Examples how the model behaves.}\label{tab:results:examples}
\end{table*}
\end{document}

output of code

6
  • thanks so much for your help. i was looking for something that's in the same line as the image and not at the bottom.
    – blues
    Commented Mar 4, 2019 at 0:27
  • 1
    @blues Then my comment is even more pertinent: how could anyone tell from your question what output you want? I suspect you don't need to use \subcaption at all then. Do you just need a number? Please edit your question to explain how you want the output to look.
    – Alan Munn
    Commented Mar 4, 2019 at 1:13
  • so i was able to fix that but the problem is there's unwanted white space between the image and the caption column. how to get rid of that?
    – blues
    Commented Mar 4, 2019 at 19:49
  • 1
    @blues I must say you're really not helping here much. You've edited your question but the code is no longer compilable, and you still haven't explained what you actually want. I don't think you should be using subcaption at all for what you want. The spacing between the number and the image in my solution is determined by the m{.05} column specification. You can make that m{1em}@{} to make it smaller and remove the intercolumn space.
    – Alan Munn
    Commented Mar 4, 2019 at 19:55
  • thanks so much for your solution first of all. I was trying to check if it was possible to remove the whitespace between the image and captions in the code posted.
    – blues
    Commented Mar 4, 2019 at 20:05

Not the answer you're looking for? Browse other questions tagged .