我想要一个有两列两行的表格,其中一列我想放一张图片,第二列我想放一个段落
这是我目前的代码:
\begin{tabular}{ | m{5cm}| m{30em}| }
\hline
{laravel.png} & Laravel is a free open-source PHP web application framework with expressive, elegant syntax. Was released by Taylor Otwell and follows the model–view–controller (MVC) architectural pattern and is based on Symfony. This framework attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
\newline Powerful dependency injection container.
\newline Simple, fast routing engine.
… etc
\\
\hline
\end{tabular}
我希望它是这样的:
答案1
欢迎来到 TeX.SE!
编辑:
两个例子。都使用graphicx
、enumitem
和etoolbox
包作为表体:
- 带环境的表
tabularx
:
\documentclass{article}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[itemize]{nosep,
leftmargin=*,
label=\textbullet,
before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}}
}
}% end of \AtBeginEnvironment
\usepackage{tabularx}
\begin{document}
\begin{table}[ht]
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\textwidth}{|m{44mm}|X|}
\hline
Lavarell Framework 8.83.9
& Description \\
\hline
\includegraphics[width=\linewidth]{example-image-duck}
& Laravel is a free open-source PHP web application framework with expressive, elegant syntax. Was released by Taylor Otwell and follows the model–view–controller (MVC) architectural pattern and is based on Symfony. This framework attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
\begin{itemize}
\item Powerful dependency injection container.
\item Simple, fast routing engine.
\item etc
\end{itemize} \\
\hline
\end{tabularx}
\end{table}
\end{document}
tblr
包中定义的环境表tabularray
:
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{%
\setlist[itemize]{nosep,
leftmargin=*,
label=\textbullet,
before={\begin{minipage}[t]{\hsize}},
after ={\end{minipage}}
}
}% end of \AtBeginEnvironment
\usepackage{tabularray}
\UseTblrLibrary{varwidth}
\begin{document}
\begin{table}[ht]
\begin{tblr}{hlines, vlines,
colspec = {Q[l, wd=44mm] X[m] },
row{1} = {font=\small\bfseries},
measure = vbox
}
Lavarell Framework 8.83.9
& Description \\
\includegraphics[width=\linewidth, valign=m]{example-image-duck}
& Laravel is a free open-source PHP web application framework with expressive, elegant syntax. Was released by Taylor Otwell and follows the model–view–controller (MVC) architectural pattern and is based on Symphony. This framework attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:
\begin{itemize}
\item Powerful dependency injection container.
\item Simple, fast routing engine.
\item etc
\end{itemize} \\
\end{tblr}
\end{table}
\end{document}
编辑(2):
最新的 LaTeX 已经在内核中实现了包提供的大部分定义etoolbox
,因此使用时\AtBeginEnvironment
不再需要加载它。