1

I would like to underline the whole line with texts anywhere I choose on the line. I found this answer, which is almost what I want. I tried

\titleline{homework \hfill assignment}

but it does not output what I expect. Why is that? Also, here is a visualization of what I want to produce:enter image description here

2

There are a large number of ways one can achieve this. Here's one using a tabular for the "underline":

enter image description here

\documentclass{article}

\newcommand{\titleline}[3]{%
  \par\noindent
  \begin{tabular}{ @{} p{\linewidth} @{} }
    \makebox[0pt][l]{#1}\hfill
    \makebox[0pt][c]{#2}\hfill
    \makebox[0pt][r]{#3} \\
    \hline
  \end{tabular}}

\begin{document}

\titleline{Left}{Center}{Right}

\titleline{Very long left}{Medium center}{R}

\end{document}

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.