I use \texttt
to format some text. I need to break it into two lines if it exceeds the line width. I use \justify
but it does not always work. The script below shows two examples one works well and the other does not. Can you identify why \justify
does not work in one case?
\documentclass[sigconf]{acmart}
\newcommand*\justify{%
\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=`\-% allowing hyphenation
}
\usepackage{lipsum}
\begin{document}
\title{Test}
\author{First Author}
\affiliation{%
\institution{First University}
\city{City}
\state{Country}
}
\email{[email protected]}
\author{Second Author}
\affiliation{%
\institution{Second University}
\city{City}
\state{Country}
}
\email{[email protected]}
\begin{abstract}
Abstract here.
\end{abstract}
\maketitle
\section{Section}
\lipsum
\texttt{\justify{xxxx:xxxx;yyyyyyyyy:yy-yy-yyyy;zzzzzzz:zz-zz-zzzz;uuu-uuuuu:uuuuuu-uuuuuu;aaaaaaaaaaaaaaaa:a;cccccc:c;wwwwww:[email protected]}}
\texttt{\justify{long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-long-text-}}
\end{document}
\justify
with no argument so should be\justify xxx...
not\justify{xxx....}