我想要实现的是底部附图中所示的效果。第一个问题是制作双线边框。我还没有尝试太多,我所做的大部分工作就是在 Google 上搜索,并找到了看似相似但我认为无法解决这个问题的不同解决方案。
我尝试过将 fbox-es 放在 fbox-es 中,试图让它看起来像这样。但我无法将一个 fbox 放在另一个 fbox 下。我只能让它们彼此相邻,并在每个 fbox 中放置几个。
\begin{center}
\fboxsep=3pt\relax\fboxrule=0.5pt\relax
\fbox{%
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
}
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
}
}
\end{center}
导致了这个
我也尝试过
\begin{table}[]
\begin{tabular}{|l|l|l|}
\hline
& \fboxsep=10pt\relax\fboxrule=0.5pt\relax\fbox{hello} & \\ \hline
& & \\ \hline
& & \\ \hline
\end{tabular}
\end{table}
导致了这个
正如我在问题开头所说的,下图中显示的是我想要实现的,我首先需要帮助的是双线边框。我不确定如何轻松地按照我想要的方式获得其余的布局(使用图像和文本),所以如果您也能帮助我,我将不胜感激。但首先我需要双线边框方面的帮助。
答案1
您似乎对以下功能感兴趣hhline
:
\documentclass{article}
\usepackage{graphicx,tabularx,hhline}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ || X || X || }
\hhline{|t:==:t|}
\multicolumn{2}{|| p{\dimexpr\linewidth-2\tabcolsep-4\arrayrulewidth-2\doublerulesep} ||}{%
\centering
\begin{tabular}{c}
\\
\includegraphics[width=100pt]{example-image} \\
\\
Some text should go right here \\
\\
\Large Some larger text goes right here \\
\mbox{}
\end{tabular}
} \\
\hhline{|:=:t:=:|}
& \\
More text & More text here \\
& \\
Some text here as well & And then some more here \\
& \\
\hhline{|:=::=:|}
& \\
More text & \centering\arraybackslash
\makebox[.8\linewidth]{\dotfill} \\
& \\
Some text here as well & And then some more here \\
& \\
\hhline{|b:=:b:=:b|}
\end{tabularx}
\end{document}
中的示例hhline
文档简洁地显示参数\hhline
符号及其结果显示:
答案2
您有外部的\fbox
,\fbox
第 2 级有两个 es ,\fbox
第 3 级有四个 es 。第 2 级有:\fbox
,空格,\par
,\fbox
,空格。\par
由于我们处于受限水平模式,因此 (来自空行) 被忽略。但是空格 (它们来自行尾) 不会被忽略。第一个空格是示例图片中心两个垂直规则之间的空间,第二个空格给您带来了问题。
\begin{center}
\fboxsep=3pt\relax\fboxrule=0.5pt\relax
\fbox{%
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
} %<- this space generates space between rules
% ^^^ this empty line ^^^ is \par and it is ignored
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
} %<- this space is your problem.
}
\end{center}
解决方案:
\begin{center}
\fboxsep=3pt\relax\fboxrule=0.5pt\relax
\fbox{%
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
}\kern3pt %<- space with more controlled size
%
\fboxsep=40pt\relax\fboxrule=0.5pt\relax\fbox{
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
\fboxsep=5pt\relax\fboxrule=0.5pt\relax\fbox{}
}% <- no space here
}
\end{center}
答案3
这是最新版本nicematrix
(2023-09-28 的 v. 6.24) 的解决方案。
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
\noindent
\begin{NiceTabular}{XX}
\Block{1-2}{
\begin{tabular}{c}
\\
\includegraphics[width=100pt]{example-image} \\
\\
Some text should go right here \\
\\
\Large Some larger text goes right here \\
\mbox{}
\end{tabular}
} \\
\Block{5-1}{} & \Block{5-1}{} \\
More text & More text here \\
\\
Some text here as well & And then some more here \\
\\
\Block{5-1}{} & \Block{5-1}{} \\
More text & \Block[transparent]{}{\makebox[.8\linewidth]{\dotfill}} \\
\\
Some text here as well & And then some more here \\
& \\
\CodeAfter
\TikzEveryCell{offset=1pt,draw}
\tikz \draw ([xshift=-1pt,yshift=1pt]1-|1)
rectangle
([xshift=1pt,yshift=-1pt]last-|last) ;
\end{NiceTabular}
\end{document}
您需要多次编译。