4
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{top=10mm, bottom=10mm, left=10mm, right=10mm}
\geometry{showframe}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage{cals}

\makeatletter

\begin{document}
%\renewcommand*\familydefault{\sfdefault}
\renewcommand*\familydefault{\ttdefault}
\normalfont

\begin{calstable}

\colwidths{
{15pt}
{10pt}
{515.60239pt}
}
\cals@paddingL=1pt
\cals@paddingR=1pt
\def\cals@borderT{0.2pt}
\def\cals@borderB{0.2pt}
\def\cals@borderL{0.2pt}
\def\cals@borderR{0.2pt}
\brow
\alignR \cell{\strut E}
\alignC \cell{\strut =}
\alignL \cell{\strut this is the english text, this is the english text, this is the english text, this is the english text, this is the english text, this is the english text, this is the english text}
\erow

\end{calstable}

Why doesn't the text break in the rigth place? In case of using sfdeault, it's good. 
\end{document}
1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – jub0bs
    Commented Dec 23, 2013 at 15:51

2 Answers 2

4

This is similar to How to get long \texttt sections to break. By default the tt font does not have stretachable interword spaces and so there is not much room for TeX to manoevre when choosing line breaks. Adding some stretchability improves the line breaking:

Sample output

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{top=10mm, bottom=10mm, left=10mm, right=10mm}
\geometry{showframe}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage{cals}
\makeatletter

\newcommand*\flextt{%
  \ttfamily
  \fontdimen2\font=0.4em% interword space
  \fontdimen3\font=0.2em% interword stretch
  \fontdimen4\font=0.1em% interword shrink
  \fontdimen7\font=0.1em% extra space
}

\begin{document}
\flextt

\begin{calstable}

\colwidths{
{15pt}
{10pt}
{515.60239pt}
}
\cals@paddingL=1pt
\cals@paddingR=1pt
\def\cals@borderT{0.2pt}
\def\cals@borderB{0.2pt}
\def\cals@borderL{0.2pt}
\def\cals@borderR{0.2pt}
\brow
\alignR \cell{\strut E}
\alignC \cell{\strut =}
\alignL \cell{\strut this is the english text, this is the english text, this is the english text, this is the english text, this is the english text, this is the english text, this is the english text}
\erow

\end{calstable}

Why doesn't the text break in the rigth place? In case of using sfdeault, it's good. 
\end{document}
3

It's always a big deal trying to break words in tt fonts.

You can try using a sloppypar environment:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{top=10mm, bottom=10mm, left=10mm, right=10mm}
\geometry{showframe}
\usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage{cals}

\makeatletter

\begin{document}
%\renewcommand*\familydefault{\sfdefault}
\renewcommand*\familydefault{\ttdefault}
\normalfont

\begin{calstable}

\colwidths{
{15pt}
{10pt}
{515.50239pt}
}
\cals@paddingL=1pt
\cals@paddingR=1pt
\def\cals@borderT{0.2pt}
\def\cals@borderB{0.2pt}
\def\cals@borderL{0.2pt}
\def\cals@borderR{0.2pt}
\brow
\alignR \cell{\strut E}
\alignC \cell{\strut =}
\alignL \cell{\begin{sloppypar}\strut this is the english text, this is the english text, 
this is the english text, this is the english text, this is the english text, 
this is the english text, this is the english text\end{sloppypar}}
\erow

\end{calstable}

Why doesn't the text break in the rigth place? In case of using sfdeault, it's good.
\end{document}

Output:

enter image description here

You must log in to answer this question.

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