希望你们能帮助我。我正在尝试将单元格文本顶部对齐。但无论我做什么,文本都不会与顶部对齐。
请参阅下面的我的代码和结果。
\begin{mytable}[label={tab:frame},width=16cm]{Frame module}
\begin{tabular}[t]{l|p{12cm}}
\begin{minipage}{3.45cm}\includegraphics[width=3.4cm]{fig/06Synthesis/Modules/A1.pdf}\end{minipage}
&
\begin{minipage}[t]{1\columnwidth}
\textbf{Frame concept 1} \newline
\textbf{\textcolor{green}{+}}\, \hl{new:} Provides a stable core \newline
\textbf{\textcolor{green}{+}}\, Easier to service \newline
\textbf{\textcolor{green}{+}}\, Easier to assemble \newline
\textbf{\textcolor{red}{--}}\;\, More material processing than today
\end{minipage}
\\ \hline
\begin{minipage}{3.45cm}\includegraphics[width=3.4cm]{fig/06Synthesis/Modules/A2.pdf}\end{minipage}
&
\multicolumn{1}{p{12cm}}{\raggedright
\textbf{Frame concept 2} \newline
\textbf{\textcolor{green}{+}}\, Easier to service \newline
\textbf{\textcolor{green}{+}}\, Easier to assemble \newline
\textbf{\textcolor{red}{--}}\;\, More material processing than today \newline
\textbf{\textcolor{red}{--}}\;\, Does not provide stability for stacking
} \\ \hline
\begin{minipage}{3.45cm}\includegraphics[width=3.4cm]{fig/06Synthesis/Modules/A3.pdf}\end{minipage}
&
\multicolumn{1}{p{12cm}}{\raggedright
\textbf{Frame concept 3} \newline
\textbf{\textcolor{green}{+}}\, Easier to service \newline
\textbf{\textcolor{red}{--}}\;\, More material processing than today\newline
\textbf{\textcolor{red}{--}}\;\, Does not provide stability for stacking
} \\ \hline
\begin{minipage}{3.45cm}\includegraphics[width=3.4cm]{fig/06Synthesis/Modules/A3.pdf}\end{minipage}
&
\textbf{Frame concept 3}
\end{tabular}
\end{mytable}
我的序言如下:
\documentclass[12pt, onecolumn]{book}
%------------- PACKAGES --------------
\usepackage{geometry}
\geometry{a4paper,inner=30mm,outer=20mm,top=30mm,bottom=30mm,footskip=15mm,headsep=10mm,headheight=6mm,twoside} %Ændrer marginer
\usepackage{graphicx}
\usepackage{appendix}
\usepackage{tabularx}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{fancyhdr}
\usepackage{color}
\usepackage{xcolor}
\usepackage{pdfpages}
\usepackage[most]{tcolorbox}
\usepackage{soul}
\usepackage{tikz}
\usepackage{caption}
\usepackage{colortbl}
\usepackage{array}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage{layouts}
%Farvede kasser til målsætning:
\newtcolorbox{goal}[1][]{
colback=lightgreen,
colframe=white,
colbacktitle=darkgreen,
boxrule=1mm,
fonttitle=\large\bfseries,
arc is angular,
arc=16pt,
sharp corners=south,
sharp corners=northwest,
toptitle=1mm,
bottomtitle=-3mm,
adjusted title= #1
}
\newtcolorbox[blend into=tables]{mytable}[2][]{
center,
colback=black!8!white,
colframe=white,
colbacktitle=black!25!white,
boxrule=1mm,
fonttitle=\normalfont,
fontlower=\Small,
boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=-.35mm,
arc is angular,
arc=16pt,
sharp corners=south,
sharp corners=northwest,
toptitle=2.5mm,
bottomtitle=2mm,
lefttitle=2mm,
title={#2},
#1
}
\begin{document}{
答案1
像这样?
(红线表示文本边框)
使用tabularx
和adjustbox
包,彩色标志+
和-
和标准表环境有了新的定义:
\documentclass[12pt, onecolumn]{book}
%------------- PACKAGES --------------
\usepackage{geometry}
\geometry{a4paper,
inner=30mm,outer=20mm,top=30mm,bottom=30mm,
footskip=15mm,headsep=10mm,headheight=6mm,twoside} %Ændrer marginer
\usepackage[demo, % remove "demo" in real document
export]{adjustbox} % <--- load graphicx, enable move image baseline
\usepackage{appendix}
\usepackage{cellspace, makecell, tabularx} % <---
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\addparagraphcolumntypes{X}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{fancyhdr}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
\usepackage[most]{tcolorbox}
\usepackage{soul}
\usepackage{tikz}
\usepackage{enumitem}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{layouts}
\newcommand\Plus{\textcolor{green}{$\boldsymbol{+}$}} % <---
\newcommand\Minus{\textcolor{red}{$\boldsymbol{-}$}} % <---
\begin{document}
\begin{table}
\caption{Frame module}
\label{tab:frame}
\setkeys{Gin}{width=\linewidth}
\setlength\arrayrulewidth{3pt}
\arrayrulecolor{white}
\begin{tabularx}{\linewidth}{>{\columncolor{gray!30}}p{3.4cm} |
>{\columncolor{gray!30}}S{X}} % <--- cells have additional vertical spaces
\includegraphics[valign=t]{fig/06Synthesis/Modules/A1.pdf}
&
\textbf{Frame concept 1} \newline
\Plus \, \hl{new:} Provides a stable core \newline
\Plus \, Easier to service \newline
\Plus \, Easier to assemble \newline
\Minus \, More material processing than today
\\ \hline
\includegraphics[valign=t]{fig/06Synthesis/Modules/A2.pdf}
&
\textbf{Frame concept 2} \newline
\Plus \, Easier to service \newline
\Plus \, Easier to assemble \newline
\Minus \, More material processing than today \newline
\Minus \, Does not provide stability for stacking
\\ \hline
\includegraphics[valign=t]{fig/06Synthesis/Modules/A3.pdf}
&
\textbf{Frame concept 3} \newline
\Plus \, Easier to service \newline
\Minus \, More material processing than today\newline
\Minus \, Does not provide stability for stacking
\\ \hline
\includegraphics[valign=t]{fig/06Synthesis/Modules/A3.pdf}
&
\textbf{Frame concept 3}
\end{tabularx}
\end{table}
\end{document}
注意:在序言中,有些包需要两次。相反color
,xcolor
仅colortbl
加载就足够了[table]{xcolor}
。