1

As part of a title page, I'd like to make a simple box around my Title. Nothing fancy, just a black lined box around it. But I don't want the box to be as narrow as usual but to have some space around it (up and below my title, as well as left and right).

I googled this problem but sadly didn't find a similar problem - I don't care about the box, it is in no way fancy, I just want some space around my text, before the box is printed.

The first thing I tried to do is a 1x1 tabular like this:

\begin{tabular}{|c|}
\hline
\textbf{\huge{The Problem}}\\
\hline
\end{tabular}

Now the lines are very close to the text, so I added new lines before and after the title

\begin{tabular}{|c|}
\hline
\\
\textbf{\huge{The Problem}}\\
\\
\hline
\end{tabular}

This does the trick vertically BUT it's not the same amount of space (below more than above) - so I've got my first problem here.

Then, I also want to have some space on the left and right. I tried to do this with \quad , but the right one is ignored if i don't write \quad{} and a space after it. But then, I've got more space on the right then I do have on the left.

So here's my problem: I've got the following and it looks pretty much like what I would like to have, but the spaces left/right and above/below are not equal.

\begin{tabular}{|c|}
\hline
\\
\textbf{\huge{ \quad{}The Problem\quad{} }}\\
\\
\hline
\end{tabular}

Can anyone help me to draw a box around my title?

As requested, here's a complete minimal document:

\documentclass[UKenglish,12pt,twoside]{scrartcl}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc} 
\usepackage{amssymb,amsmath,amsfonts} 
\usepackage{amsthm}
\usepackage{dsfont} 
\usepackage{url} 
\usepackage[a4paper,left=20mm,right=20mm,top=25mm,bottom=25mm,marginparwidth=3cm]{geometry} 
\usepackage{color} 
\usepackage{graphicx}
\usepackage{csquotes} 
\usepackage{verbatim} 
\usepackage{hyperref} 
\usepackage{cleveref}

\begin{document}

% Front page

\thispagestyle{empty}
% a picture is inserted on the top left
%\includegraphics[width=7cm]{img/eth_logo.png}

\begin{center}

\vspace{20mm}

\LARGE{Here's some text}

\vspace{20mm}

\begin{tabular}{|c|}
\hline
\\
\textbf{\huge{ \quad{}The Problem\quad{} }}\\
\\
\hline
\end{tabular}


\vspace{20mm}

\LARGE{Manuel}\\
\medskip
\Large{Number}

\vfill

\LARGE{Some more text}

\vspace{20mm}

\LARGE{Zurich}\\
\LARGE{\today}\\

\end{center}

\end{document}
2
  • How exactly are you producing your title? A complete minimal document showing the settings for the title would be really useful here. May 13, 2014 at 12:39
  • \framebox[width][c]{} and \fboxsep will give you what you want. May 13, 2014 at 12:44

1 Answer 1

2

If you don't care much about the frame, you could use \fbox{The Problem} and set the spacing by setting the length \fboxsep :

%the classica behaviour
\fbox{The problem}

%saving the default length to modify it and restore it
\newlength{\fboxsepsave}
\setlength{\fboxsepsave}{\fboxsep}
\setlength{\fboxsep}{1cm}
\fbox{The problem}

%restoring the length back to normal
\setlength{\fboxsep}{\fboxsepsave}
\fbox{The problem}

If you would like more control on the box, I suggest you use tools like the nodes in tikz, using the inner sep parameter to control the spacing.

1
  • Now, I would like to do the same thing, but have a longer line of text inside the box, not just "The Problem", but e.g. "The Problem With Some Details Which Makes It Too Long For One Line". If I insert \\, I get errors. How can I set new lines without getting errors?
    – Manuel
    Dec 4, 2015 at 15:16

You must log in to answer this question.

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