Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I 'squeeze' or 'shrink' some text horizontally? I've heard of the microtype package but I'm not familiar with its options. I tried playing around with it but I could only get it to shrink the text if it was just about to overflow the line. Is there a way to force-shrink a selected portion of the text?

Example - I have the following document and I want to be able to shrink/squeeze all or some porition of the text:

\documentclass[10pt]{article}
\begin{document}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text. 
This is a long line of text.
\end{document}
share|improve this question
2  
You can search for scalebox on this site's searchbar. –  percusse Jan 22 '13 at 0:08
3  
By shrinking are you referring to the inter-word/-character space or the actual characters as well? –  Werner Jan 22 '13 at 0:20
    
@Werner I'd like to be able to adjust both, if possible. If I'm not mistaken, these can be adjusted with \SetTracking and \SetExpansion options using microtype but I just can't get it to work/enforce properly... sorry, I'm kind of a newbie. –  Dawood Jan 22 '13 at 1:04
    
@percusse Thank you for the suggestion but I'm having some difficulty getting scalebox to work properly when the text I'd like to squeeze is multi-line. –  Dawood Jan 22 '13 at 1:07
    
Hmm, I'm not getting the question right I guess. If you can include a MWE I'm sure our users will figure out a way. Just make up the smallest example starting from \documentclass{...} and \end{document}. –  percusse Jan 22 '13 at 1:18
show 1 more comment

1 Answer

I'm not sure if this is what you want, but when I needed squeezed text I personally found it more visually appealing to just change the tracking (i.e., the inter-letter spacing, more or less) rather than to actually squeeze the individual letters. My result was a combination of someone's forum reply (don't remember where), the microtype package documentation, and a lot of fiddling around to figure out how it actually worked. I used this to make text more narrow in a table. Here's my code, maybe it'll do for you.

enter image description here

\documentclass[10pt]{article}
\usepackage[tracking=true]{microtype}

%% Narrow letter spacing
\newcommand\narrowstyle{\SetTracking{encoding=*}{-50}\lsstyle}
%% Custom letter spacing
\newcommand\spacedstyle[1]{\SetTracking{encoding=*}{#1}\lsstyle}
%% Normal letter spacing
\newcommand\normalstyle{\SetTracking{encoding=*}{0}\lsstyle}

\begin{document}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% \narrowstyle as a shorthand for setting tracking to -50 --
% the result is quite squeezed
\narrowstyle
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% \spacedstyle{} as a lets you set a custom value, e.g. -25
\spacedstyle{-25}
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.

% ...and back to normal
\normalstyle
This is a long line of text. This is a long line of text. This is a
long line of text. This is a long line of text. This is a long line
of text. This is a long line of text. This is a long line of text.
This is a long line of text.
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.