1

I either need to draw a box around \title (to see how much space there is between the title, first line of text on the page [below the title], and top margin of the page [above the title]) or measure the \title in order to subtract appropriate \vspace from \date (to get rid of the big, unnecessary, space after the title so that the title will have same amount of space above and below---independent of top margin of the page).

\documentclass[border=5mm,varwidth]{standalone}
\date{}
\title{this is title}
\begin{document}
\maketitle
this is line 1\\
this is line 2
\end{document}

ADDENDUM: Getting size of the \date would also do.

  • You should take a look at the titling package which provides many tools to customise maketitle – Bernard Apr 30 at 17:09
1

Try using an \fbox.

\title{\fbox{this is title}}

However, if you have a multiline title then use \parbox instead like, perhaps (which unfortunately doesn't draw a box)

\title{\parbox{\textwidth}{this is a title too long to fit on one line}}

Leslie Lamport in his book LaTeX: A Documentation Preparation System, Addison-Wesly, 2nd edition, 1985, describes a boxit environment which will draw a box around multiline texts as (less any of my typos):

\newsavebox{\savepar}
\newenvironment{boxit}{\begin{lrbox}{\savepar}
  \begin{minipage}{\textwidth}}
{\end{minipage}\end{lrbox}\fbox{\usebox{\savepar}}}

which can be used for your title like this:

\title{\begin{boxit}this is a title but it is rather too long for a single line\end{boxit}}

For your purposes you may need to adjust the width and position of the minipage within the boxit definition.

  • 1
    @bp2017 I have extended my answer. – Peter Wilson Apr 30 at 18:43
  • Have you tried using it on the title in my example? The title box becomes way wider than the title itself. – bp2017 Apr 30 at 18:50
  • Note, \fbox adds precisely 2\fboxsep+2\fboxrule to each dimension. – John Kormylo Apr 30 at 22:09
1
\documentclass[border=5mm,varwidth]{standalone}
\date{}
\usepackage{framed}
\title
  { \begin{framed}
      this is (multiline) title\\
      let see how long this line extends before wrapping takes effect
    \end{framed}
  }
\begin{document}
  \maketitle
  % don't know why but negating 3 times
  %  the \baselineskip works(?)
  %   (vertical spacing should be
  %    EXACTLY determined [from somewhere; any help?]
  %     before removal attempts)
  \vspace{\dimexpr(-\baselineskip*3)}
  \begin{framed}
    this is line 1\\
    this is line 2
  \end{framed}
\end{document}

Red lines are same size. Document border (5mm) is not considered by the title, or coincidence.

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.