I have this word in my document:
--standard\_min\_confidence\_threshold\_for\_calling
It currently exceeds the page width. How can I make it start on the next line, so it doesn't exceed the page width? I should probably add that I'm new to tex.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI have this word in my document:
--standard\_min\_confidence\_threshold\_for\_calling
It currently exceeds the page width. How can I make it start on the next line, so it doesn't exceed the page width? I should probably add that I'm new to tex.
Edit: The microtype
package probably also does what you want
\documentclass{article}
\usepackage{microtype}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultricies volutpat rhoncus.
Fusce suscipit molestie rhoncus. Fusce nec tristique purus. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus mi leo, pharetra vitae
nunc vitae, imperdiet tincidunt dui. Cras placerat pulvinar massa, non tincidunt eros auctor ac.
standard\_min\_confidence\_threshold\_for\_{} Ut molestie convallis dui, a malesuada nunc
aliquet et. standard\_min\_confidence\_threshold\_for\_{} Aliquam rhoncus diam a nunc volutpat
mollis. Fusce mattis congue diam, in porttitor sem. Nam ut eros et urna consectetur sollicitudin.
Cras mollis pulvinar dui, porta auctor diam ultricies a. Morbi ultricies gravida nisl vel ornare.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Nunc accumsan scelerisque magna, vel venenatis metus aliquam ornare. Vivamus sed mollis ipsum.
\end{document}
gives
Maybe also sloppypar
is what you want to put around your paragraphs with the long words. It will look ugly and manual breaking the long words is certainly better, though at least you cannot have too long lines anymore.
\documentclass{article}
\begin{document}
\begin{sloppypar}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ultricies volutpat rhoncus.
Fusce suscipit molestie rhoncus. Fusce nec tristique purus. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus mi leo, pharetra vitae
nunc vitae, imperdiet tincidunt dui. Cras placerat pulvinar massa, non tincidunt eros auctor ac.
standard\_min\_confidence\_threshold\_for\_{} Ut molestie convallis dui, a malesuada nunc
aliquet et. standard\_min\_confidence\_threshold\_for\_{} Aliquam rhoncus diam a nunc volutpat
mollis. Fusce mattis congue diam, in porttitor sem. Nam ut eros et urna consectetur sollicitudin.
Cras mollis pulvinar dui, porta auctor diam ultricies a. Morbi ultricies gravida nisl vel ornare.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Nunc accumsan scelerisque magna, vel venenatis metus aliquam ornare. Vivamus sed mollis ipsum.
\end{sloppypar}
\end{document}
Then you get
instead of this without sloppypar
I found the answer to my own question here: How can I make my text never go over the right margin by always hyphenating or breaking on word-boundaries?
The trick is to add \sloppy
right after \begin{document}
. That did the trick for me.
\_
you could add\linebreak[0]
to allow a break or\-
if you want it to add a-
if it breaks the word.\newcommand\myunder{\_\-}
then use\myunder
instead of\_
or presumably this is some programming identifier and you could redefine the command used to display the program fragments to allow linebreaking or lots of other possibilities. But your question needs to give a few clues