2

I have this document which I try to reproduce in Latex. I am using the colorbox and minipage. But I got confused with an alignment. Can I get the expected results with current packages or should I try something else? Tanks in advanced.

Expected results: enter image description here

Actual results: enter image description here

Actual code:

\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{pdfpages}
\usepackage{pdflscape} 

\pagestyle{empty}
\begin{document}
\textbf{Last name, first name, patronymic name} \\

\begin{minipage}[t]{2cm}
\hspace{-30mm}\colorbox{gray}{\begin{minipage}[t]{12cm}{\centering
\textbf{Ivanova Nadezda Ivanovna } \\
}\end{minipage}}%
\end{minipage}

Date of birth \\
\begin{minipage}[t]{-1mm}
\hspace{-30mm}\colorbox{gray}{\begin{minipage}[t]{12cm}{\centering
\textbf{January 01, 1985} \\
}\end{minipage}}%
\end{minipage}
\lipsum[1-2]
\end{document}

Also the grey color looks different than on original document, but I think I will get how to changed it by my own in the future.

2

Might as well use a \parbox in this case:

enter image description here

Note:

  • The showframe package was used to show the borders. Remove it in your actual use case.

Code

\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage{lmodern}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{pdfpages}
\usepackage{pdflscape} 
\usepackage{calc,showframe} 

\pagestyle{empty}
\begin{document}
\noindent
\textbf{Last name, first name, patronymic name} \\
\colorbox{gray}{\parbox[t]{\linewidth-2\fboxsep}{\centering\textbf{Ivanova Nadezda Ivanovna}}}

\noindent
Date of birth~%
\colorbox{gray}{\parbox[t]{\linewidth-\widthof{Date of birth~}-\fboxsep}{\centering January 01, 1985}}%
\par\medskip
\lipsum[1-2]
\end{document}
  • Peter Grill, thank you very much! It works perfect for me :) – Alex Aug 16 '18 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.