1

Current code:

\begin{tabular*}{0.97\textwidth}[t]{l@{\extracolsep{\fill}}r}
      \Huge \textbf{John Doe} & {City Country
                                 Phone number
                                 Email
                                 Website} \\
       \\\
\end{tabular*}\vspace{-7pt}

This is the current output: Current output

But what I want is for the text on the right to be stacked on top of each other like the way it's written in my code.

And it should be horizontally aligned on the same line / row as "John Doe" to get an output like this: enter image description here

Preferably I'd also like for John Doe to be in the center left and not top left like it currently is.

JamesT
  • 3,169

2 Answers2

2

... I'd also like for "John Doe" to be in the center left and not top left

Something like this?

enter image description here

The frame lines along the left and right hand edges of the text block are drawn courtesy of the showframe package.

\documentclass{article}
\usepackage{showframe} % draw framelines around text block
\begin{document}
\null

\noindent % <-- important {\Huge \textbf{John Doe}} \hfill \begin{tabular}{|l@{}} City Country \ Phone number \ Email \ Website \end{tabular}

\bigskip \end{document}

Mico
  • 506,678
  • Exactly what I'm looking for. But how would I go about changing the color of that vertical line and adding a bit of padding between it and the text? – hellomansour Feb 18 '23 at 09:15
  • @demxaxa -- To change the color of the vertical line to, say, blue, I suggest you (a) load the xcolor and colortbl packages and (b) execute \arrayrulecolor{blue} before \begin{tabular} (and execute \arrayrulecolor{black} after \end{tabular}). To increase the amount of whitespace padding to the right of the vertical line by, say, 2mm, I suggest you replace |l with |>{\hspace{2mm}}l. – Mico Feb 18 '23 at 09:38
1

No need for tabular*. You can

  1. lower “John Doe” so it has no height and
  2. raise by the height of a capital letter.

Next the data is in its own tabular with top alignment.

Add colors and other details.

It may appear a waste of time to have a \cvof command, but this gives a centralized place where to change the details.

\documentclass{article}

\newcommand{\cvof}[2]{% \par\noindent \raisebox{% \dimexpr-\height+\fontcharht\font`A % lower by the height and raise }{\Huge\bfseries#1}\hfill \begin{tabular}[t]{|@{\hspace{2em}}r@{}} #2 \end{tabular}\par }

\begin{document}

\cvof{John Doe}{ City Country \ Phone number \ Email \ Website \ }

\end{document}

enter image description here

egreg
  • 1,121,712