8

Ok I am creating a simple CV and in have the following problem. My \linewidth is actually larger than linewith. I tried to add \noident as stated on the following link

overfull hbox despite of width=\linewidth

I attach a minimal example and an image of the produced output where the problem is obvious.

\documentclass{article}
\usepackage{showframe}

\begin{document}
\fboxrule=1pt

\noindent
\fbox{
\begin{minipage}{0.9575\linewidth}
\begin{center}
    {\huge  \textbf{Curiculum Vitae}} \\ \vspace{0.5cm}
    {\LARGE  \textbf{My Very Long Name}}
\end{center}
\end{minipage}
}

\noindent
\fbox{
\begin{minipage}{\linewidth}
\begin{center}
    {\huge  \textbf{Curiculum Vitae}} \\ \vspace{0.5cm}
    {\LARGE  \textbf{My Very Long Name}}
\end{center}
\end{minipage}
}

\end{document}

enter image description here

1 Answer 1

15

There are a few problems with your input. The main one is that you're not properly protecting end-of-lines so that they don't show as spaces in the output.

When you type

\fbox{
  text/box
}

you get the same output as if you had typed

\fbox{ text/box }

because TeX converts end-of-lines into spaces. So, if you want to use the first way, add % in the proper places:

\fbox{%
  text/box%
}

The second problem is that you don't take into account the \fboxsep space LaTeX pads the contents of an \fbox with.

You can avoid guessing the size by using the proper dimensions:

\documentclass{article}
\usepackage{calc}
\usepackage{showframe}

\begin{document}
\setlength{\fboxrule}{1pt}

\noindent
\fbox{%
  \begin{minipage}{\linewidth-2\fboxrule-2\fboxsep}
  \centering
  \huge\textbf{Curriculum Vitae} \\ \vspace{0.5cm}
  \LARGE\textbf{My Very Long Name}
  \end{minipage}%
}

\end{document}

enter image description here

0

You must log in to answer this question.

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