单元格内文本的顶部和中间左对齐

单元格内文本的顶部和中间左对齐

如何使单元格内的文本左上对齐(黄色矩形)和中间左对齐(红色矩形)?

我尝试了很多不同的选择,我认为对齐应该直接在单元格中指定;而不是在我的情况下在表格的开头指定。

\topleftalignment{Klient:}

在此处输入图片描述

我的代码:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage[export]{adjustbox}
\usepackage{graphbox}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{graphicx}

\usepackage{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm},
includehead=false,
includefoot=true,footskip=10cm}

\pagestyle{fancy}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}

\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{}                      %% clear default for head and foot
\fancyfoot[C]{%
    \begin{tikzpicture}[remember picture,overlay]
    \node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(2.5cm,1cm)$) {
        \begin{tabular}{@{}p{3cm}@{}@{}p{2.95cm}@{}|@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{1.5cm}@{}@{}p{0.8cm}@{}}
        \cline{3-8}     
        &
        &
        & \multicolumn{1}{c|}{}
        &
        & \multicolumn{1}{c|}{}
        & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}         
        &
        &
        & \multicolumn{1}{c|}{}
        &
        & \multicolumn{1}{c|}{}
        & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}         
        &
        &
        & \multicolumn{1}{c|}{}
        &
        & \multicolumn{1}{c|}{}
        & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}         
        &
        & \centering\textbf{\scriptsize A}
        & \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
        & \centering\textbf{\scriptsize 1}
        & \multicolumn{1}{c|}{\textbf{\scriptsize 1}}
        & \multicolumn{2}{c }{\textbf{\scriptsize 1}}
        \bigstrut\\ \cline{3-8}         
        &
        & \multicolumn{1}{c|}{\scriptsize Rev.:}
        & \multicolumn{1}{c|}{\scriptsize Datum:}
        & \multicolumn{1}{c|}{\scriptsize Gezeichnet:}
        & \multicolumn{1}{c|}{\scriptsize Überprüft:}
        & \multicolumn{2}{c }{\scriptsize Genehmigt:}
        \bigstrut\\ \hline
        \scriptsize Klient:
        & \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
        & \multicolumn{3}{l}{\footnotesize Dummy text}
        \bigstrut\\ \hline
        \scriptsize Auftragnehmer:
        & \multicolumn{3}{c}{\includegraphics[valign=c,scale=0.2]{example-image-a}}
        & \multicolumn{3}{l}{\footnotesize Dummy text}
        \bigstrut\\ \hline
        \multicolumn{2}{@{}l|}{\scriptsize Projekt:}
        & \scriptsize Vertrag Nr.:
        & \multicolumn{3}{@{}l|}{\scriptsize Dokument Nr.:}
        & \scriptsize Seite:
        & \textbf{\footnotesize \thepage}
        \bigstrut\\ \cline{7-8} 
        \multicolumn{2}{c|}{\textbf{\makecell{\footnotesize 1}}}
        &
        & \multicolumn{3}{c|}{\textbf{\footnotesize 1}} 
        & \makecell[l]{\scriptsize Gesamte\\\scriptsize Seite:}
        & \textbf{\footnotesize \pageref*{LastPage}}
        \bigstrut\\ \hline
        \multicolumn{2}{@{}l|}{\scriptsize Titel:}
        & \scriptsize Rahmen:
        & \multicolumn{3}{@{}l|}{\scriptsize Rev.:}
        & \scriptsize Format:
        & \textbf{\footnotesize A4}
        \bigstrut\\ \cline{7-8} 
        \multicolumn{2}{c|}{\textbf{\footnotesize 1}}
        & \centering\textbf{\footnotesize 1:1}
        & \multicolumn{3}{c|}{\textbf{\footnotesize A}}
        & \scriptsize Sprache:
        & \textbf{\footnotesize DE}
        \bigstrut\\ \hline
        \end{tabular}%
    };
    \end{tikzpicture}
}

\begin{document}
Dummy text
\end{document}

答案1

align=c您可以使用包graphbox中添加的选项轻松获得位于图像中心的同一行中的单元格\includegraphics

至于让行中的一个单元格顶部对齐,您可以使用一个技巧来实现:使用\multirow{-n},其中 n 是通过反复试验找到的行数。

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{background}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage[export]{adjustbox}
\usepackage{graphbox}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
\usepackage{graphicx}

\usepackage{geometry}
\geometry{paper=a4paper}
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm}}
\geometry{includehead=true,headheight=3cm,headsep=1cm}
\geometry{includefoot=false}

\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt} %%delete default header line

\usetikzlibrary{calc}
\usetikzlibrary{positioning}

\SetBgOpacity{100.0}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=0pt]
($ (current page.north west) + (2.5cm,-1cm) $)
rectangle
($ (current page.south east) + (-1cm,1cm) $);

\draw [line width=1.5pt]
($ (current page.north west) + (2.5cm,-14.85cm) $) -- ($ (current page.north west) + (1cm,-14.85cm) $);

\node[anchor=north] at ($(current page.north west)+(1.5cm,-1cm)$) {\rotatebox{90}{\makecell[r]{\scriptsize\selectfont Reproduction or any use not conformity with the intended\\
            \scriptsize\selectfont application is not permissible.}}};
\node[anchor=south] at ($(current page.south west)+(1.5cm,1cm)$) {\rotatebox{90}{\makecell[l]{\scriptsize\selectfont Nachdruck oder Verwendung, die nicht der beabsichtigten\\
            \scriptsize\selectfont Anwendung entspricht, ist nicht zulässig.}}};

\end{tikzpicture}
}

\fancypagestyle{firstpage}{%
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{} %% clear default for head and foot
\fancyfoot[C]{%
    \begin{tikzpicture}[remember picture,overlay]
    \node[anchor=south west,inner sep=0pt] at ($(current page.south west)+(2.5cm,1cm)$) {
\setcellgapes{3pt}\makegapedcells
        \begin{tabular}%
{@{}p{3cm}@{}@{}p{2.95cm}@{}|@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{2.3cm}@{}|@{}p{2.3cm}@{}@{}p{1.5cm}@{}@{}p{0.8cm}@{}}
        \cline{3-8}
        & & & \multicolumn{1}{c|}{} & & \multicolumn{1}{c|}{} & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}
        & & & \multicolumn{1}{c|}{} & & \multicolumn{1}{c|}{} & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}
        & & & \multicolumn{1}{c|}{} & & \multicolumn{1}{c|}{} & \multicolumn{2}{c }{}
        \bigstrut\\ \cline{3-8}
        & & \centering\textbf{\scriptsize A} & \multicolumn{1}{c|}{\textbf{\scriptsize 1}} & \centering\textbf{\scriptsize 1}
        & \multicolumn{1}{c|}{\textbf{\scriptsize 1}} & \multicolumn{2}{c }{\textbf{\scriptsize 1}}
        \bigstrut\\ \cline{3-8}
        &
        & \multicolumn{1}{c|}{\scriptsize Rev.:} & \multicolumn{1}{c|}{\scriptsize Datum:} & \multicolumn{1}{c|}{\scriptsize Gezeichnet:} & \multicolumn{1}{c|}{\scriptsize Überprüft:} & \multicolumn{2}{c }{\scriptsize Genehmigt:}
        \bigstrut\\ \hline
       \multirow{-4}{=}{\scriptsize Klient:} & \multicolumn{3}{c}{\includegraphics[scale=0.2, align = c]{example-image-a}} & \multicolumn{3}{l}{\footnotesize Dummy text}
        \bigstrut\\ \hline
        \multirow{-4}{=}{\scriptsize Auftragnehmer:} & \multicolumn{3}{c}{\includegraphics[scale=0.2, align = c]{example-image-a}} & \multicolumn{3}{l}{\footnotesize Dummy text}
        \bigstrut\\ \hline
        \multicolumn{2}{@{}l|}{\scriptsize Projekt:} & \scriptsize Vertrag Nr.: & \multicolumn{3}{@{}l|}{\scriptsize Dokument Nr.:} & \scriptsize Seite: & \textbf{\footnotesize \thepage}
        \bigstrut\\ \cline{7-8}
        \multicolumn{2}{c|}{\textbf{\makecell{\footnotesize 1}}} & & \multicolumn{3}{c|}{\textbf{\footnotesize 1}}
        & \makecell[l]{\scriptsize Gesamte\\\scriptsize Seite:} & \textbf{\footnotesize \pageref*{LastPage}}
        \bigstrut\\ \hline
        \multicolumn{2}{@{}l|}{\scriptsize Titel:} & \scriptsize Rahmen: & \multicolumn{3}{@{}l|}{\scriptsize Rev.:} & \scriptsize Format: & \textbf{\footnotesize A4}
        \bigstrut\\ \cline{7-8}
        \multicolumn{2}{c|}{\textbf{\footnotesize 1}} & \centering\textbf{\footnotesize 1:1} & \multicolumn{3}{c|}{\textbf{\footnotesize A}}
        & \scriptsize Sprache: & \textbf{\footnotesize DE}
        \bigstrut\\ \hline
        \end{tabular}%
    };
    \end{tikzpicture}
}
}

\begin{document}

\thispagestyle{firstpage}
\newgeometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm},
    includehead=false,
    includefoot=true,footskip=10cm
}
%\vspace*{6cm}
%\begin{center}
% \Huge Some random text\\
% \large Some random text\\~\\
% \Huge Some random text\\
% \large Some random text
%\end{center}
\vspace*{\fill}

\end{document} 

在此处输入图片描述

相关内容