20 Latex多图多文本排版

发布于 2022-12-10 19:59:34

大佬们,这个怎么排版哇? 一个单元有两个图,两个文本和一个标签

QQ截图20221210195526.png

查看更多

关注者
0
被浏览
1k
Beatrice
Beatrice 2022-12-11
这家伙很懒,什么也没写!
\documentclass{article}
\usepackage{geometry}
\geometry{margin=1cm}
\usepackage{xcolor}
\usepackage{tabularray}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[export]{adjustbox}
\begin{document}
\begin{figure}
\centering
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}\hfill
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}\hfill
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}\hfill
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}\hfill
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}\hfill
\subcaptionbox{}{
\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur             \\
\includegraphics[width=.15\textwidth,valign=t]{example-image} & Lorem ipsum dolor sit amet, consectetur adipisicing \\
consectetur adipisicing                                       &                                                     \\
\end{tblr}
}
\caption{bbb}
\end{figure}
\end{document}

image.png

通过表格实现对齐,如果你嫌麻烦,可以自行封装一个命令,用来排版每一个\subcaptionbox内的内容。

tabularray可能需要较新的LaTeX发行版才可以使用,推荐TeX Live 2022。

2 个回答
烟云幻梦
烟云幻梦 2022-12-11
数学系咸鱼一枚!
\documentclass[fontset=ubuntu]{ctexart}
\usepackage{graphicx,tabularray,subfig}
\usepackage[export]{adjustbox}
\usepackage[margin=1cm]{geometry}
\usepackage{xcolor}
\usepackage{alphalph}

\renewcommand*{\thesubfigure}{(\thefigure.\arabic{subfigure})}
\renewcommand*{\thesubfigure}{%
\alphalph{\value{subfigure}}%
}%
\begin{document}
\begin{figure}[htbp]
       \centering
\subfloat[fig1][]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       
\subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} \label{fig:sub1}
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
\subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}\label{fig:sub2}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \hfill 
       \subfloat[fig2][]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} 
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \hfill 
       \subfloat[fig3][]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} 
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \hfill 
       \subfloat[fig4][]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} 
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \hfill 
       \subfloat[fig5][]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} 
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \hfill 
       \subfloat[]{\begin{tblr}{width=.3\textwidth,colspec={Q[l,t]X[l,t]},column{2}={font=\small},cell{Z}{1}={c=2}{c},row{Z}={gray7},columns={leftsep=0pt}}
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}} 
    & Lorem ipsum dolor sit amet, consectetur \\[-2ex]
       \subfloat{\includegraphics[width=.15\textwidth,valign=t]{example-image}}
        & Lorem ipsum dolor sit amet, consectetur \\
        Fig 1 Test & \\
       \end{tblr}}
       \caption{很好}
       \label{fig2111}
\end{figure}
\end{document}

image.png

除了编号不对以外都满足要求了,编号什么原因导致的错乱还不清楚

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览