2

I am facing an issues with tables. Currently my MWE looks like this:

\documentclass[12pt,a4paper]{scrreprt}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm]{geometry}
\usepackage{showframe}
\begin{document}
\begin{tabular}{p{7cm}p{.5cm}l}
\hrulefill \\ 
Datum
\end{tabular}% 
\hfill 
\begin{tabular}{p{7cm}p{.5cm}l}
\hrulefill \\ 
Unterschrift 
\end{tabular}% 
\end{document}

which produces this: https://i.stack.imgur.com/DUsFD.png Now, what I would like to achieve is first the top borders to start with the same spacing (as it looks to me the one on the left has more space than on the right). Second I would want the part "Unterschrift" to be aligned on the right. I've tried replacing the "l" in the tabular by an "r", as I understood this would change the alignment, but it did not work. What did I miss?

Thank you!

1
  • You are missing that the cells in a row of a tabular are been separated by & character... So, you use only one without using &... As for the space it can be handled easy by using \cline for a p column
    – koleygr
    Mar 1, 2019 at 18:20

1 Answer 1

1

like this:

enter image description here

\documentclass[12pt,a4paper]{scrreprt}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm]{geometry}
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedleft\arraybackslash}p{#1}}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{center}
\begin{tabular}{ P{\dimexpr7cm}p{0.5cm}P{7cm} }
        &   &                   \\
\cline{1-1}\cline{3-3}
Datum   &   &   Unterschrift
\end{tabular}
    \end{center}
\end{document}
4
  • Thank you that worked perfectly! (I just had to change aray to array from your MWE!)
    – user168390
    Mar 1, 2019 at 18:37
  • 2
    @user168390, you are welcome. 'm curious, what you need to change?
    – Zarko
    Mar 1, 2019 at 18:39
  • > \usepackage{aray} to \usepackage{array}
    – user168390
    Mar 1, 2019 at 18:48
  • @user168390, ah, typing error :-). corrected now!
    – Zarko
    Mar 1, 2019 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .