1

I use emphasis in Lyx to indicate variables in a description of a computational algorithm.

Some of these variables have a long name. Lyx does not attempt to hyphenate these variables when they enter into the defined page margins, leading to text overflow.

Furthermore, their inclusion in a sentence seems to cause standard text words to be pushed into the margin as well.

You can see both issues in this screencap; the first two lines indicate the start of the margin which standard text lines adhere to:

Lyx emphasized text overflow issue

Here is the associated lyx code:

\emph default
are gathered into a set 
\emph on
degreeOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 and the unmapped atoms of degree greater than one which are bonded to 
\emph on
mapped
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
are gathered into a set 
\emph on
unmappedDegreeGtOneNbors
\begin_inset script subscript

\begin_layout Plain Layout
b
\end_layout

\end_inset


\emph default
.
 The atoms in 
\emph on
degreeOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
are decomposed into groups of atoms 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
which are a chemical match [
\begin_inset CommandInset ref
LatexCommand formatted
reference "Procedure:isChemicalMatch"

\end_inset

].
 So too are the atoms in 
\emph on
unmappedDegreeGtOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
decomposed into 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
b
\end_layout

\end_inset


\emph default
.
 These chemically similar groups are then paired up where possible such
 that a group 
\emph on
chemicalSimilarityGroup
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
in 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
contains atoms which are a chemical match for a group 
\emph on
chemicalSimilarityGroup
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
b
\end_layout

\end_inset

I understand I can use \hyphenation{wo-rd, w-ord} to manually indicate allowed hyphenations of such words. However, I have very many variables like this, so this one-by-one approach will be far too time consuming.

I've sought a solution in the Lyx hyphenation documentation, but to no avail.

Is there something I can add to my preamble to instruct Lyx to hyphenate these emphasized words in the same manner it does standard text words, and prevent them from disrupting Lyx's calculation of the line length, so standard text overflow is also prevented?

I'd like to achieve hyphenation of all text which conforms to the defined page margins, rather than enable justified text with e.g. \raggedright.


EDIT: Here is a minimal example Lyx file. The image result from pdflatex (Edit -> View [PDF (pdflatex)]) follows afterwards.

\lyxformat 413
\begin_document
\begin_header
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\use_hyperref false
\papersize default
\use_geometry false
\use_amsmath 1
\use_esint 1
\use_mhchem 1
\use_mathdots 1
\cite_engine basic
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
Next, the procedure considers each anchor atom 
\emph on
anchor
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 and its mapped counterpart 
\emph on
mapped
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
.
 The degree one atoms bonded to 
\emph on
anchor
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
are gathered into a set 
\emph on
degreeOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 and the unmapped atoms of degree greater than one which are bonded to 
\emph on
mapped
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
are gathered into a set 
\emph on
unmappedDegreeGtOneNbors
\begin_inset script subscript

\begin_layout Plain Layout
b
\end_layout

\end_inset


\emph default
.
 The atoms in 
\emph on
degreeOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
are decomposed into groups of atoms 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 which are a chemical match.
 So too are the atoms in 
\emph on
unmappedDegreeGtOneNbors
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 decomposed into 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
b
\end_layout

\end_inset


\emph default
.
 These chemically similar groups are then paired up where possible such
 that a group 
\emph on
chemicalSimilarityGroup
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
 in 
\emph on
chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
a
\end_layout

\end_inset


\emph default
contains atoms which are a chemical match for a group 
\emph on
chemicalSimilarityGroup
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
b
\end_layout

\end_inset


\emph default
 in
\emph on
 chemicalSimilarityGroups
\begin_inset script subscript

\begin_layout Plain Layout

\emph on
b
\end_layout

\end_inset


\emph default
.
 Each such pair is then considered in turn.
\end_layout

\end_body
\end_document

Here's what it looks like in Adobe Reader:

Minimal example PDF view

  • Welcome to TeX.SX! i don't know how lyx works in this respect, but (la)tex allows exceptions to be specified in the preamble as \hyphenation{degree-One-Nbors} (for example). you might try this to see if lyx allows it. – barbara beeton Sep 24 '14 at 13:32
  • Thanks for the warm welcome, Barbara. I guess I'll have to resort to \hyphenation unless someone suggests a better method. At least it only requires one declaration in the preamble, I appreciate you pointing that out. – user490123 Sep 24 '14 at 14:28
  • You are missing a space at least before decomposed and contains. Edit: And which, and in. – Torbjørn T. Sep 24 '14 at 14:32
  • @TorbjørnT. Thank you, I've corrected this locally. It doesn't affect the issue. – user490123 Sep 24 '14 at 15:08
  • @barbarabeeton Unfortunately \hyphenation doesn't seem to work given that I have subscript on the words. – user490123 Sep 24 '14 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.