Text Formattinghyphenat | Slash Line Break Problem with 'none' Option

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
nokhbeh100
Posts: 2
Joined: Sun Jan 29, 2012 5:46 pm

hyphenat | Slash Line Break Problem with 'none' Option

Post by nokhbeh100 »

Hi,

I am using PDFLaTeX to typeset a two-column document but there is a problem.
I do not want latex to hyphenate long words in the end of documents, so I use:

Code: Select all

\usepackage[none]{hyphenat}
but using none option for hyphenat will stop this package from breaking words like:

Code: Select all

input\slash output
to break before or after slash.

I have already read the hyphenat package help but there is no other option.
Please help me with my problem.
thanks
example:

Code: Select all

\documentclass[10pt,a4paper,twocolumn]{article}
\special{papersize=164mm,234mm}
%This file is prepared and compiled by MNZ script-to-latex program
\usepackage[none]{hyphenat}
\begin{document}
\twocolumn

suffer acute pain\slash{}test\slash{}test\slash{}test\slash{}test\slash{}remorse\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test\slash{}test
\end{document}
Last edited by nokhbeh100 on Mon Jan 30, 2012 5:38 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

hyphenat | Slash Line Break Problem with 'none' Option

Post by Stefan Kottwitz »

Hi,

welcome to the board!

For single occurences you could use \mbox{word\slash{}text}. And this works in the preamble:

Code: Select all

\let\stdslash\slash
\renewcommand*{\slash}{\mbox{\stdslash}}
Or

Code: Select all

\renewcommand*{\slash}{\nobreak\mbox{\stdslash}\nobreak}
Have a look at the spacing around the slash, as the kerning could change. Or write a macro for such words with slash, using \mbox or a feature of hyphenat.

Stefan
LaTeX.org admin
nokhbeh100
Posts: 2
Joined: Sun Jan 29, 2012 5:46 pm

Re: hyphenat | Slash Line Break Problem with 'none' Option

Post by nokhbeh100 »

Hi, Thanks
There is a misunderstanding,
I want \slash to be able to break the words but other words be untouched.

Thanks very much
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

hyphenat | Slash Line Break Problem with 'none' Option

Post by Stefan Kottwitz »

Ok, so you could similarly redefine for inserting \allowbreak:

Code: Select all

\let\stdslash\slash
\renewcommand*{\slash}{\stdslash\allowbreak}
Stefan
LaTeX.org admin
Post Reply