On 28. okt. 2011 17:43, Bianca Kranzusch wrote:
My thesis contains a "material" part where I have, among other stuff,
a list of used equipment with names and manufacturers.
I would like to use typewriter font for product names and small caps
for manufacturer names. Within the thesis text, this looks good, but
when I format this list in this pattern, I get all sorts of weird line
breaks and it looks very messy. (There are line breaks, but the lines
have very strange lengths.)

Can somebody help me to prevent/fix this?
I have included a minimal file.

The typewriter font is often used for stuff that should not be hyphenated or justified. It is therefore set up to not hyphenate, and this causes your problems.

LaTeX is unable to break up the lines in the middle of words in typewriter font. So the words stick into the margin and the
line breaks after them.

The fix for this, is to reconfigure the typewriter font so it
permits normal hyphenation and some justification. It can be done with
this addition to the preamble:
%Hyphenation in typewriter font
\usepackage{everysel}
\let\oldttdefault=\ttdefault
\renewcommand*\ttdefault{\oldttdefault}
\EverySelectfont{%
\fontdimen2\font=0.4em% interword space
\fontdimen3\font=0.2em% interword stretch
\fontdimen4\font=0.1em% interword shrink
\fontdimen7\font=0.1em% extra space
\hyphenchar\font=`\-% to allow hyphenation
}


Based on this webpage:
http://texblog.net/latex-archive/plaintex/full-justification-with-typewriter-font/

With this, your document looks much better. There is still one line
that doesn't break properly. The best solution is to rewrite it
slightly. Or you can tweak the interword space/stretch/shrink, at the
tisk of getting some uglier lines.

Your testfile with this modification is attached.

Helge Hafting

Attachment: Diplomarbeit_fixit.lyx
Description: application/lyx

Reply via email to