Text FormattingAlignment Problem in long Names

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
anurag1fundoo
Posts: 8
Joined: Thu Oct 13, 2011 2:23 am

Alignment Problem in long Names

Post by anurag1fundoo »

Hi,

When I input this in an enumerate environment :
\item L-B-L assembly through electrostatic interaction means that the inter-molecular forces responsible for interaction between 2 polyelectrolytes is electrostatic in nature. This is found in LBL structures of 2 strong polyelectrolytes. e.g. Poly(allylamine hydrochloride) (PAH) and Poly(styrenesulfonate)(PSS). In contrast , for LBL assembly of weak polyelectrolytes the inter-molecular force is hydrogen bonding. e.g. Polyvinylcaprolactum(PVCL) and Poly(methacrylic acid)(PMAA).

It compiles without any error however, latex tries to accomodate these large polymer
names in a single line . for example if i reach the end of right margin, while typing
Poly(styrenesulfonate)(PSS), after Poly then "(styrenesulfonate)(PSS)" should begin from the new line so that the formatting is preserved. Instead "(styrenesulfonate)(PSS)" sticks out like a long rod in the same line.

can anybody please help me with it.
TIA (Thanks in advance)
-Anurag
Last edited by anurag1fundoo on Mon Oct 17, 2011 12:59 am, 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

Alignment Problem in long Names

Post by Stefan Kottwitz »

Hi Anurag,

welcome to the board!

A quick way could be inserting \allowbreak at certain positions, such as:

Code: Select all

Poly\allowbreak (styrenesulfonate)\allowbreak(PSS)
Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Alignment Problem in long Names

Post by localghost »

You could try to assign certain hyphenation points for these special terms.

Code: Select all

\hyphenation{%
  Po-ly-(allyl-amine hy-dro-chlo-ride),
  Po-ly-(sty-rene-sul-fo-nate),
  Po-ly-vin-yl-ca-pro-lac-tum,
  Po-ly-(meth-acry-lic acid)
}
These lines go into the document preamble.


Best regards and welcome to the board
Thorsten
anurag1fundoo
Posts: 8
Joined: Thu Oct 13, 2011 2:23 am

Re: Alignment Problem in long Names

Post by anurag1fundoo »

Thanks you so much guys.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Alignment Problem in long Names

Post by cgnieder »

I realise I'm a bit late. However, there's another solution using the bpchem package. It provides the \IUPAC{} command, which is designed to handle breaks in "those long IUPAC compound names". Within it an allowed break is indicated with \|

Code: Select all

\documentclass{article}
\usepackage{bpchem, % provides \IUPAC
            chemstyle} % provides \eg
\begin{document}
\begin{enumerate}
\item L-B-L assembly through electrostatic interaction means that the inter-molecular
      forces responsible for interaction between 2 polyelectrolytes is electrostatic in nature.
      This is found in LBL structures of 2 strong polyelectrolytes. \eg
      \IUPAC{Poly\|(allyl\|amine hydro\|chloride)}(PAH) and \IUPAC{Poly\|(styrene\|sulfonate)}(PSS).
      In contrast, for LBL assembly of weak polyelectrolytes the inter-molecular force is hydrogen
      bonding. \eg \IUPAC{Poly\|vinyl\|caprolactum}(PVCL) and \IUPAC{Poly\|(meth\|acrylic acid)}(PMAA). 
\end{enumerate}
\end{document}
site moderator & package author
Post Reply