LaTeX - moderncv - spacing problem, overlap of letters - latex

I have some trouble with the spacing of moderncv. Here is an exmaple of the current code:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[scale=0.9]{geometry} % Reduce document margins
\firstname{Ann-Kathrin} % Your first name
\familyname{Lipman-Schindler} % Your last name
\title{Curriculum Vitae}
\begin{document}
\makecvtitle % Print the CV title
\vspace{-1cm}
\section{About}
\cvitem{Name}{Ann-Kathrin Lipman-Schindler}
\cvitem{Date of Birth}{May 28, 1900 in Washington, DC}
\cvitem{CurrentAdresses123}{Fair Parkway 1998, Washington, DC 90394, United States}
\cvitem{Nationality}{US}
\cvitem{e-mail adress}{xyz.xyz#xgy.com}
\cvitem{Telephon}{+0 982 3996 69}
\end{document}
The problem ist that the left side "CurrentAdresses123" overlaps the right argument. But why? I used my script so many times and doesn't change something. And now I have the trouble of overlapping letters. Normally, the blue bar will be longer and also the right side will be longer and no overlapping will occur. But what happens now? Please take a look on the image. Thanks in advance

You can add something like
\setlength{\hintscolumnwidth}{1.5in}
to the preamble of your document. This will increase the space available for for the fist arguments of \cvitem.

Related

get height on a block of latex output

I am trying to determine how to get the height on a block of latex output (not the whole document, and not the code..but rather a block of output). As an example of what I am trying to accomplish: i were to have the latex code
$\sum_{i=0}^\infty \frac{1}{n}>\infty$ \newline hello world \newline hello universe
The height of the above block of text is dependent on a number of things-font, margin size, and of course what the text is, as changing any of these parameters changes how many inches that output would be, but with default formatting its output would be something like 2 inches high.
I am hoping there is a package that does this!
Usually, the trick is to put whatever you want to measure into a box and then simply not typeset the box, but measure it:
\newdimen\height
\setbox0=\hbox{\Huge Hello, World!}
\height=\ht0 \advance\height by \dp0
The height is: \the\height
I think this will work:
\newlength{\somenamehere}
\settoheight{\somenamehere}{\hbox{...}}
Where ... is your content you like to measure. And you can then use \somenamehere as the height of that content.
Example:
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
\newlength{\heightofhw}
\settoheight{\heightofhw}{\hbox{Hello World!}}
Value = \the\heightofhw
\end{document}
Will output:
Value = 6.8872pt
Note:
Values of lengths are stored as points, and 1 inch ≈ 72.27 pt
This does not require any additional packages.
Update:
Use \hbox to correctly calculate the height of a different sized environment, but it won't work with newlines :-(

Variable font height via tables in LaTeX

I've been looking for a more elegant solution to the following typesetting problem. Consider those banners found in print media where the text is aligned like:
B I G T E X T
small text small text small text
m o r e m e d i u m t e x t
The font sizes are adjusted so that the height is scaled down for longer lines of text such that each line has equal width. I've written a small script that runs each line separately, compiles, crops the resulting pdf and then \includegraphics each in a table. This gives the desired effect but requires an both an outside script and pdfcrop (which only crops to a white bounding box). Since much of LaTeX is self-aware, I imagine it would be possible to have it recognize the width of a box and scale it appropriately so that any text fits exactly into the desired width.
Any thoughts or ideas on how a pure LaTeX implementation might work?
EDIT As a supplement to the suggested solution by AVB (since large code in comments looks awful), I've posted below the code used so that others may find it easily.
\documentclass[]{article}
\usepackage[pdftex]{graphicx}
\begin{document}
\begin{table}[l]
\resizebox{10cm}{!}{BIG Text} \\
\resizebox{10cm}{!}{small text small text small text} \\
\resizebox{10cm}{!}{Medium Text Medium Text}
\end{table} \end{document}
First, read the TeX FAQ entry titled Changing the space between letters. Depending on your circumstances, the packages and recommendation in that FAQ may suffice.
Also, take a look at the \scalebox and \resizebox commands in the graphicx package. They do what the names imply.
I'm sure that this could be improved upon, and due to different font implementations at different sizes then it isn't going to be exact, but here's a quick-and-dirty way to do it:
\documentclass[10pt]{article}
\usepackage{pgfmath}
\usepackage{anyfontsize}
\newlength{\mywidth}
\newlength{\testwidth}
\setlength{\mywidth}{4in}
\newcommand{\fixedwidth}[1]{%
\settowidth{\testwidth}{#1}%
\pgfmathsetmacro{\x}{round(\mywidth/\testwidth * 10)}%
\pgfmathsetmacro{\y}{round(\mywidth/\testwidth * 15)}%
\bgroup\fontsize{\x pt}{\y pt}\selectfont#1\egroup}
\begin{document}
\fixedwidth{hello world}
\fixedwidth{greetings earthlings}
\end{document}
In practice, it's a little less than the 4in, but the two lines of text do get scaled to the same amount.
Check out the package textfit. Usage:
\scaletowidth{width}{text}
or
\scaletoheight{height}{text}

Is there unresizable space in latex? Pictures in good looking grid

I've created latex macro to typeset guitar chords diagrams(using picture environment).
Now I want to make diagrams of different appear in good looking grid when typeset one next to each other as the picture shows:
The picture.
(on the picture: Labeled "First" bad layout of diagrams, labeled "Second" correct layout when equal number of diagrams in line)
I'm using \hspace to make some skips between diagrams, otherwise they would be too near to each other. As you can see in second case when latex arrange pictures in so that there is same number of them in each line it works. However if there is less pictures in the last line they become "shifted" to the right. I don't want this.
I guess is because latex makes the space between diagrams in first line a little longer for the line to exactly fit the page width. How do I tell latex not to resize spaces created by \hspace ? Or is there any other way ?
I guess I cannot use tables because I don't know how many diagrams will fit in one line...
This is current state of code:
\newcommand{\spaceForChord}{1.7cm}
\newcommnad{\chordChart}[1]{%
%calculate dimensions xdim and ydim according to settings
\begin{picture}(xdim, ydim){%
%draw the diagram inside defined area
}%
\hspace*{\spaceForChord}%
\hspace*{-\xdim}%
}%
%end preambule and begin document
\begin{document}
First:\\*
\\*
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
%...above line is repeated 12 more times to produce result shown at the picture
\end{document}
Thanks for any help.
A long shot, since I can't easily recreate your situation: would wrapping a flushleft environment around your \chordCart be of any help?
I.e.,
First:\\*
\begin{flushleft}
\chordChart{...some arguments to change diagram look...}
...
\end{flushleft}
Second:\\*
If your hypothesis is correct and LaTeX is indeed trying to stretch spaces to justify lines, then the above should solve your problem by turning off justification on the right.

latex template or example for personal statement

I am writing a personal statement in latex. I don't want the big margin at the top of the page not big title taking a lot of space. I just like to make the layout compact but still clearly spaced with title, name and other necessary information, since there may be restriction on the number of pages. One example would be http://www.hsc.unt.edu/education/CIM/Documents/PS-Sample2_000.pdf. I wonder where to find some good latex templates or examples?
Thanks and regards!
I would use the geometry package to establish the desired margins. To get the margins in your sample document, try:
\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
Your next requirement was to fix the title block. LaTeX uses the internal command \#maketitle to format the title block. You can redefine this as you like. To achieve the same title block style as in the sample document, use:
\usepackage[svgnames]{xcolor}% provides colors for text
\makeatletter% since there's an at-sign (#) in the command name
\renewcommand{\#maketitle}{%
\begin{center}
\parskip\baselineskip% skip a line between paragraphs in the title block
\parindent=0pt% don't indent paragraphs in the title block
\textcolor{red}{\bf\#title}\par
\textbf{\#author}\par
%\#date% remove the percent sign at the beginning of this line if you want the date printed
\end{center}
}
\makeatother% resets the meaning of the at-sign (#)
The \#title, \#author, and \#date commands will print the title, author, and date. You can use whatever formatting commands you like to set the text in bold, different colors, etc.
Put all of the above commands in the preamble of the document. The preamble is the space between \documentclass and \begin{document}.
\documentclass{article}
% this is the preamble
% put all of the above code in here
\title{Personal Statement}
\author{Tim}
\begin{document}
\maketitle% prints the title block
Emergency medicine has always been a passion of mine\ldots
\end{document}
Attempt #1: I've used the following style file, which I call cramp2e, for similar purposes. It is probably not right for you, but have a look:
\oddsidemargin -1cm
\evensidemargin -2cm
\topmargin 1cm
\textheight 24cm
\textwidth 19cm
\headheight 0cm
\headsep .7cm
\footskip .7cm
\parskip .2cm
\paperheight 25cm
\setlength\voffset{-.33in}
\setlength\hoffset{-.25in}
Any good?
Postscript This is for A4 size paper.
A slightly less LaTeX-ey solution would be to not use the \maketitle command. A couple of times I've simply used this as my title(marginsize helps too).
Set up smaller margins:
\documentclass{article}
\usepackage{anysize}
\marginsize{1cm}{1cm}{1cm}{1cm}
(EDIT: 1cm might be even better..)
Minimal title:
\begin{document}
\begin{center}
\section*{My Document Title}
\today
\end{center}
% content goes here
\end{document}
The result looks something like:

Latex - Change margins of only a few pages

I have a Latex document where I need to change the margins of only a few pages (the pages where I'm adding a lot of graphics).
In particular, I'd like to change the top margins (\voffset). I've tried doing:
\addtolength{\voffset}{-4cm}
% Insert images here
\addtolength{\voffset}{4cm}
but it didn't work. I've seen references to the geometry package, but I haven't found how to use it for a bunch of pages, and not for the whole document.
Any hints?
Use the "geometry" package and write \newgeometry{left=3cm,bottom=0.1cm} where you want to change your margins. When you want to reset your margins, you write \restoregeometry.
I've used this in beamer, but not for general documents, but it looks like that's what the original hint suggests
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
Then to use it
\begin{changemargin}{-1cm}{-1cm}
don't forget to
\end{changemargin}
at the end of the page
I got this from Changing margins “on the fly” in the TeX FAQ.
I was struggling a lot with different solutions including \vspace{-Xmm} on the top and bottom of the page and dealing with warnings and errors. Finally I found this answer:
You can change the margins of just one or more pages and then restore it to its default:
\usepackage{geometry}
...
...
...
\newgeometry{top=5mm, bottom=10mm} % use whatever margins you want for left, right, top and bottom.
...
... %<The contents of enlarged page(s)>
...
\restoregeometry %so it does not affect the rest of the pages.
...
...
...
PS:
1- This can also fix the following warning:
LaTeX Warning: Float too large for page by ...pt on input line ...
2- For more detailed answer look at this.
3- I just found that this is more elaboration on Kevin Chen's answer.
\par\vfill\break % Break Last Page
\advance\vsize by 8cm % Advance page height
\advance\voffset by -4cm % Shift top margin
% Start big page
Some pictures
% End big page
\par\vfill\break % Break the page with different margins
\advance\vsize by -8cm % Return old margings and page height
\advance\voffset by 4cm % Return old margings and page height
For figures you can use the method described here :
http://texblog.net/latex-archive/layout/centering-figure-table/
namely, do something like this:
\begin{figure}[h]
\makebox[\textwidth]{%
\includegraphics[width=1.5\linewidth]{bla.png}
}
\end{figure}
Notice that if you have subfigures in the figure, you'll probably want to enter into paragraph mode inside the box, like so:
\begin{figure}[h]
\makebox[\textwidth]{\parbox{1.5\textwidth}{ %
\centering
\subfigure[]{\includegraphics[width=0.7\textwidth]{a.png}}
\subfigure[]{\includegraphics[width=0.7\textwidth]{b.png}}
\end{figure}
For allowing the figure to be centered in the page, protruding into both margins rather than only the right margin.
This usually does the trick for images. Notice that with this method, the caption of the image will still be in the delimited by the normal margins of the page (which is a good thing).
A slight modification of this to change the \voffset works for me:
\newenvironment{changemargin}[1]{
\begin{list}{}{
\setlength{\voffset}{#1}
}
\item[]}{\end{list}}
And then put your figures in a \begin{changemargin}{-1cm}...\end{changemargin} environment.
Look up \enlargethispage in some LaTeX reference.
I could not find a easy way to set the margin for a single page.
My solution was to use vspace with the number of centimeters of empty space I wanted:
\vspace*{5cm}
I put this command at the beginning of the pages that I wanted to have +5cm of margin.
This worked for me:
\newpage % larger page1
\enlargethispage{1.5cm} % more room for text or floats
\advance\voffset by -0.5cm % reduce top margin
\advance\footskip by 1cm % lower page number
Some content
\newpage % larger page2
\enlargethispage{1.5cm}
Some content
...
\newpage % return to normal page
\advance\voffset by 0.5cm
\advance\footskip by -1cm
I had the same problem in a beamer presentation. For me worked using the columns environment:
\begin{frame}
\begin{columns}
\column{1.2\textwidth}
\begin{figure}
\subfigure{\includegraphics[width=.49\textwidth]{1.png}}
\subfigure{\includegraphics[width=.49\textwidth]{2.png}}
\end{figure}
\end{columns}
\end{frame}

Resources