Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having a problem with LaTeX not hyphenating $\beta$-galactosidase, and the word as a result running off the page.

I have narrowed down the problem to a particular package, as a bare minumum LaTeX preamble with no packages avoids this problem. Please help me to identify the offending package by process of elimination, and suggest a solution that retains the use of the package where possible.

\documentclass[a4paper,12pt]{article}

\usepackage[a4paper]{geometry}

\begin{document}
Finally, all of the three antibiotics examined had a negative effect on $\beta$-galactosidase activity from the time they were introduced to the assay.  It is to be noted that chloramphenicol interferes with the 50S ribosomal subunit which negatively implicates peptide bond formation~\cite{chloram1962}, streptomycin interrupts the initiation stage of protein synthesis~\cite{strepto1968}, while rifampicin is an RNA-polymerase inhibitor~\cite{rifam1983}.  These results verify that both transcription and translation are needed for the gene product $\beta$-galactosidase to arise, which is probably not much more than a validation of the flow of genetic information in accordance with central dogma.  An interruption at the transcription or translational stage would prematurely or directly halt the production of $\beta$-galactosidase, in the two respective cases.
\end{document}

Sample output:

enter image description here

share|improve this question
    
Just note that the provided preamble is not minimal: As a start, you are loading hypcap twice. –  Werner Sep 11 '11 at 18:36

7 Answers 7

up vote 17 down vote accepted

The problem is that TeX doesn't know how to hyphenate the word $\beta$-galactosidase because it has a $\beta$- attached to it. The best solution to this problem is to load the hyphenat package, and use \hyp{} instead of the -:

\usepackage{hyphenat}
$\beta$\hyp{}galactosidase

This tells the hyphenation to hyphenate the word after the \hyp{} as a regular word.

share|improve this answer
    
I'm very pleased with the diversity of responses, as their are multiple workable solutions to this problem. Thank you to all who have put forward a solution. I submitted my paper today, thankfully having corrected this quirk in time. However, I'll acknowledge Alan's answer because it appears to be the most popular. –  ptrcao Sep 12 '11 at 11:08

Others have already pointed to the issue (the \beta$-). I'd like to point to the chemists answer: bpchem. It includes the \IUPAC macro, inside which \| is a break point and \- is a breakable hyphen. This gives

\documentclass[a4paper,12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage{bpchem,upgreek}

\begin{document}

Finally, all of the three antibiotics examined had a negative effect on
\IUPAC{$\upbeta$-galacto\|sidase} activity from the time they were introduced to
the assay. It is to be noted that chloramphenicol interferes with the 50S
ribosomal subunit which negatively implicates peptide bond
formation~\cite{chloram1962}, streptomycin interrupts the initiation stage of
protein synthesis~\cite{strepto1968}, while rifampicin is an RNA-polymerase
inhibitor~\cite{rifam1983}. These results verify that both transcription and
translation are needed for the gene product $\upbeta$-galactosidase to arise,
which is probably not much more than a validation of the flow of genetic
information in accordance with central dogma. An interruption at the
transcription or translational stage would prematurely or directly halt the
production of $\upbeta$-galactosidase, in the two respective cases.

\end{document}

(I've used upgreek as the use of italics for \beta, etc., in this text is wrong, but is often seen in the literature as the typesetting is done in TeX and upright greek letters need a little work!)

share|improve this answer
    
A chemist's input always appreciated. Most of the documents I typeset are scientific or mathematical in nature, and quite a few of them are very chemistry-oriented. –  ptrcao Sep 12 '11 at 11:03

For what it is worth, ConTeXt MkIV correctly hyphenates words with -. I don't know the internal implementation, but it will be nice to have similar functionality with lualatex.

Here is a minimal example

\setupindenting[big,yes] % to get the same visual effect
\starttext
Finally, all of the three antibiotics examined had a negative effect on $\beta$-galactosidase activity from the time they were introduced to the assay.`
\stoptext

which gives

enter image description here.

With regards to Joseph's suggestion of using \upbeta, if you are using a text font that has greek letters (like xits or cambria) you can simply type β-galactosidase and ConTeXt will hyphenate the word correctly.

share|improve this answer
    
I have added a LuaLaTeX solution... –  topskip Sep 12 '11 at 7:19

This LuaTeX solution is slightly more complicated: when the pre_linebreak_filter is called, the paragraph is already hyphenated. So you need to hyphenate again after inserting a "= equivalent. In order to hyphenate, all characters/glyphs must be subtype 1.

\documentclass[a4paper,12pt]{article}
\usepackage[a4paper]{geometry}

\usepackage{luatexbase,luacode}

\begin{luacode}
local active_hyphen = function (head)
  local orig_head = head
  while head do
    if head.id == 37 then
      head.subtype = 1
      if head.char == 45 then
        local p = node.new("penalty")
        p.penalty = 10000
        local g = node.new("glue")
        g.spec = node.new("glue_spec")
        g.spec.width = 0

        head.prev.next = p

        p.next = head
        p.prev = head.prev

        g.prev = head
        g.next = head.next

        head.prev = p
        head.next = g

        g.next.prev = g
      end
    end
    head = head.next
  end
  lang.hyphenate(orig_head)
  return true
end

luatexbase.add_to_callback("pre_linebreak_filter",active_hyphen,"active-")

\end{luacode}

\begin{document}
Finally, all of the three antibiotics examined had a negative effect on $\beta$-galactosidase activity from the time they were introduced to the assay.  It is to be noted that chloramphenicol interferes with the 50S ribosomal subunit which negatively implicates peptide bond formation~\cite{chloram1962}, streptomycin interrupts the initiation stage of protein synthesis~\cite{strepto1968}, while rifampicin is an RNA-polymerase inhibitor~\cite{rifam1983}.  These results verify that both transcription and translation are needed for the gene product $\beta$-galactosidase to arise, which is probably not much more than a validation of the flow of genetic information in accordance with central dogma.  An interruption at the transcription or translational stage would prematurely or directly halt the production of $\beta$-galactosidase, in the two respective cases.
\end{document}

There are most likely other approaches to this problem using callbacks.

share|improve this answer

The problem here is not package-related. It is the fact that the word "galactosidase" is not recognized in the hyphenation dictionary, and therefore does not have a proper hyphenation set. Consequently, LaTeX just typesets it as-is, without breaking it, causing the overflow into the margin. You need to suggest the discretionary hyphenation to LaTeX by using \- inside "galactosidase" at the appropriate places (say ga\-lac\-to\-si\-dase), or by specifying \hyphenation{ga-lac-to-si-dase} for a more global specification.

The latter may be problematic since the you are not using the word "galactosidase" on their won; you're prepending it with $\beta$-. Regardless, a work-around is the discretionary hyphenation \-.

share|improve this answer
1  
This doesn't actually work. The problem is caused by the $\beta$- attached to the word, which causes it not to be hyphenated independent of the the hyphenation points you specify. –  Alan Munn Sep 11 '11 at 18:43
    
@Alan: We were thinking the same thing; I mentioned this in my answer and suggested a more manual approach. –  Werner Sep 11 '11 at 19:11

If a word is already hyphenated, TeX won't hypenate it. Here is one solution

\documentclass[a4paper,12pt]{article}

\usepackage{geometry}

\usepackage{hyphenat}
\hyphenation{ga-lac-to-si-dase}
\def\hyph{-\penalty0\hskip0pt\relax}

\begin{document}
Finally, all of the three antibiotics examined had a negative effect on $\beta$\hyph galactosidase activity from the time they were introduced to the assay.  It is to be noted that chloramphenicol interferes with the 50S ribosomal subunit which negatively implicates peptide .  
\end{document}

This is more of a MWE. If you put the hypen back you can reproduce the error. If you are using this often it might be better to define a command for that:

\newcommand{\BetaGalactosidase}{$\beta$\hyph galactosidase}%

This is based on http://stackoverflow.com/questions/2193307/how-to-get-latex-to-hyphenate-a-word-that-contains-a-dash

share|improve this answer

A solution is to insert this into the preamble:

\usepackage[ngerman,english]{babel}
\useshorthands{"}
\addto\extrasenglish{\languageshorthands{ngerman}}

and type $\beta$"=galactosidase - this inserts a hyphen and allows hyphenation in the next word. See this answer to another question here on tex.se.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.