1

The title may be incorrect if I have misunderstood the problem. feel free to fix.

Steven Segletes helpfully provided me with some latex in this answer which creates a row consisting of left, center, and right-aligned content. It works great.

However, I have noticed that in certain circumstances when it is at the top of my document, there is a gap. This may or may not be specific to stackengine.

I would like to know how I can remove this gap so that the top part of this row is completely flush with the top of the document.

This example is not flush with the top of the document (I have showframe enabled and disabled header/footer, marginpar) and I want it to be:

\documentclass{article}
\usepackage[
  letterpaper,
  showframe,
  vmargin=0.2in,
  hmargin=0.7in,
  noheadfoot,
  nomarginpar
  ]{geometry}
\usepackage[usestackEOL]{stackengine}
\newcommand{\topline}[3]{%
    \noindent%
    \belowbaseline[0pt]{\makebox[0pt][l]{\Longunderstack[l]{#1}}}\hfill%
    \belowbaseline[0pt]{\Longunderstack[c]{#2}}\hfill%
    \belowbaseline[0pt]{\makebox[0pt][r]{\Longunderstack[r]{#3}}}}

\begin{document}
\topline{123 Main Street\\Los Angeles, CA}%
{\LARGE FIRST MIDDLE LAST\\[email protected]}%
{(555) 123 -- 4567\\somesite.com}
\end{document}

enter image description here

By comparison, this example has 'Test' flush with the top of the document:

\documentclass{article}
\usepackage[
  letterpaper,
  showframe,
  vmargin=0.2in,
  hmargin=0.7in,
  noheadfoot,
  nomarginpar
]{geometry}

\begin{document}
Test
\end{document}

enter image description here

1 Answer 1

2

Simply change the optional argument of \belowbaseline from [0pt], to the appropriate negative height of the text line, namely [-\ht\strutbox].

\documentclass{article}
\usepackage[
  letterpaper,
  showframe,
  vmargin=0.2in,
  hmargin=0.7in,
  noheadfoot,
  nomarginpar
  ]{geometry}
\usepackage[usestackEOL]{stackengine}
\newcommand{\topline}[3]{%
    \noindent%
    \belowbaseline[-\ht\strutbox]{\makebox[0pt][l]{\Longunderstack[l]{#1}}}\hfill%
    \belowbaseline[-\ht\strutbox]{\Longunderstack[c]{#2}}\hfill%
    \belowbaseline[-\ht\strutbox]{\makebox[0pt][r]{\Longunderstack[r]{#3}}}}

\begin{document}
\topline{123 Main Street\\Los Angeles, CA}%
{\LARGE FIRST MIDDLE LAST\\[email protected]}%
{(555) 123 -- 4567\\somesite.com}
\end{document}

enter image description here

1
  • Thank you so much Steven! It works perfectly! Jan 25, 2023 at 2:43

You must log in to answer this question.

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