我正在努力创建像下面这样的界面。
因此,基本上,我在页面上有几个部分必须具有设定的高度(10 厘米)(定义为小页面),并且每个部分都有“类似”的 2 列:左侧包含一些其他小页面/文本,必须垂直对齐在顶部,一个在另一个之下,右侧必须垂直居中。如果图片和文本都没有占据整个部分的高度,则应该有一个白色区域,正如我所说,高度始终为 10 厘米。
我尝试了一些方法,但是:
1)定义外部小页面为:
\begin{minipage}[c][9cm]{0.3\textwidth},
所有元素(左列也是如此)都垂直对齐
2)当我将顶行保留为如下面的完整代码片段中所示,即 [t],以便内部小页面默认对齐到中心时,图像与左列的中间对齐,而不是整个部分的中间:
\documentclass[12pt]{article}
\nonstopmode
\usepackage{geometry}
\geometry{
papersize={216mm, 303mm},
left=0mm,
top=0mm,
bottom=0mm,
right=0mm
}
\usepackage[x-1]{pdfx}
\usepackage{pdfpages}
\usepackage{changepage}
\usepackage{tikz}
\renewcommand\familydefault{\sfdefault}
\begin{document}
\newgeometry{
left=3mm,
top=3mm,
bottom=3mm,
right=3mm
}
\begin{minipage}[c][9cm]{0.3\textwidth}
\parbox[t][0cm][b]{5cm}{\textcolor{black}{\Large TITLE}}
\begin{adjustwidth}{0mm}{5mm}
problems???
\end{adjustwidth}
\end{minipage}
\begin{minipage}[c][9cm]{0.7\textwidth}
\vspace{5pt}
\begin{center}
\noindent\begin{tikzpicture}%
\node[anchor=south west, inner sep=0] (X) at (0,0){
\centering
\includegraphics[width=12cm,height=8.5cm,keepaspectratio]{example-image-golden}
};%
\end{tikzpicture}
\end{center}
\end{minipage}%
\textcolor{black}{\hrulefill}
\begin{minipage}[c][9cm]{0.7\textwidth}
\begin{center}
\noindent\begin{tikzpicture}%
\node[anchor=south west, inner sep=0] (X) at (0,0){\includegraphics[width=13cm,height=8.5cm,keepaspectratio]{example-image-golden}};%
\begin{scope}[x={(X.south east)},y={(X.north west)}]%
\node[anchor=north west,text width=0.08\textwidth,inner sep=2mm, fill=black,draw,color=black] (Z) at (0.9, 1) {%
\centering
\textcolor{white}{\huge info}\par%
};
\end{scope}
\end{tikzpicture}
\end{center}
\end{minipage}%
\begin{minipage}[c][9cm]{0.27\textwidth}
\parbox[t][0cm][b]{3.8cm}{\textcolor{black}{\Large rafal}}
\begin{flushleft}
\begin{adjustwidth}{0mm}{7mm}
dfakpjfldsa . dfklaljkdfa dfkjfd dfaskjdfs dfjkadfa fdnjkfd dfandfs df njkdfa dfk ds sd . a . dsafkjweL,M DF LDAKDFLKAKLFJFD KLKk
\end{adjustwidth}
\end{flushleft}
\end{minipage}
\textcolor{black}{\hrulefill}
\end{document}
答案1
我不确定是否理解了您的请求,但我建议您使用tcolorbox
:
\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{
papersize={216mm, 303mm},
left=0mm,
top=0mm,
bottom=0mm,
right=0mm
}
\usepackage[most]{tcolorbox}
%\tcbuselibrary{raster}
\newtcolorbox{myframebox}[1][]{height=10cm, colback=white, sidebyside, sidebyside align=top seam, lower separated=false,sidebyside gap=10pt,#1}
\newtcolorbox{mytextbox}{colback=green!40!white,width=\linewidth}
\newtcolorbox{myimagebox}{colback=white,width=12.1cm, height=(10cm-6mm), valign=center, nobeforeafter, boxsep=0pt,
leftrule=-1pt,rightrule=-1pt, bottomrule=-1pt, toprule=-1pt,
left=0pt, right=0pt, bottom=0pt, top=0pt}
\begin{document}
\newgeometry{
left=3mm,
top=3mm,
bottom=3mm,
right=3mm
}
\begin{myframebox}[righthand width=12cm]
\begin{mytextbox}
problems???
\end{mytextbox}
\begin{mytextbox}
If ``problems???''\ is the title you could put
just one titled tcolorbox here
\end{mytextbox}
\tcblower
\begin{myimagebox}
\includegraphics[width=12cm,keepaspectratio]{example-image-golden}
\end{myimagebox}
\end{myframebox}
\begin{myframebox}[lefthand width=12cm]
\begin{myimagebox}
\includegraphics[width=12cm,keepaspectratio]{example-image-golden}
\end{myimagebox}
\tcblower
\begin{mytextbox}
\Large rafal
\end{mytextbox}
\begin{mytextbox}
dfakpjfldsa . dfklaljkdfa dfkjfd dfaskjdfs dfjkadfa fdnjkfd dfandfs df njkdfa dfk ds sd . a . dsafkjweL,M DF LDAKDFLKAKLFJFD KLKk
\end{mytextbox}
\end{myframebox}
\end{document}