GeneralLine/data overrun ...

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Line/data overrun ...

Post by rgrice »

Hi,

I'm sure this problem has been 'done to death' but I've having difficulty getting my abstract to display correctly.

Basically I've got a mixed tabular and two column multicolumn environment and the data can includes chemical names which are hyphenated and therefore don't wrap but run off the page or into the neighbouring column.

Additionally, I would like to be able to have ragged right text but I've tried to use the \raggedright command in DajBodyDefinitions.tex (see attached for file) but then I get this error ...

Code: Select all

! Undefined control sequence.
\CT@start ->\let \CT@arc@save 
                              \CT@arc@ \let \CT@drsc@save \CT@drsc@ \let \CT...
I'd like to get the text left justified (with ragged right) or failing that full justification (which seems to be the default) but with no text overruns. I've attached the LaTeX code US20120165464A1dab.tex which is the abstract data and the DajBodyDefinitions.tex and map.tex which are the supporting latex modules.

Yours sincerely
Richard
Attachments
map.tex
Supporting LaTeX module
(488 Bytes) Downloaded 528 times
dajBodyDefinitions.tex
Supporting LaTeX module
(10.6 KiB) Downloaded 457 times
US20120165464A1dab.tex
Abstract data
(14.9 KiB) Downloaded 589 times
Last edited by cgnieder on Wed Aug 22, 2012 7:52 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Line/data overrun ...

Post by cgnieder »

When running your code (I discovered I have to use XeLaTeX...) I found the file env.tex missing and the control sequence \dajRecord undefined…

Regards
site moderator & package author
rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Re: Line/data overrun ...

Post by rgrice »

Ah I uploaded the wrong file ... it is there now. I'm not sure why the \dajRecord isn't defined as it is defined in dajBodyDefinitions.tex ...

I've just run it through MikTeX fine ... hope you can get it working...
Rich
Attachments
env.tex
(47 Bytes) Downloaded 437 times
dajBodyDefinitions.tex
New version
(10.56 KiB) Downloaded 517 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Line/data overrun ...

Post by cgnieder »

After breaking this down to a Infominimal working example I find it is a non-trivial task (at least for me).

The code:

Code: Select all

\documentclass[8pt]{article}
\usepackage{fontspec}
  \setmainfont[
    Scale=1.35,
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic
]{texgyretermes}
\linespread{1.1}
\setlength\textwidth{9.25cm}
\usepackage{showframe}

\begin{document}
\footnotesize\noindent
(bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,
(bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
(1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
\,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
(1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,
(dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,

\end{document}
I tried to adapt the automated method described here: How to break long word containing symbols but with no hyphen? which is working somehow (not really perfect as it allows breaking anywhere, see code below and the attachment) and increases compilation time significantly. One should probably try a different approach for the loop…

Of course you can always add breakpoints manually…

Code: Select all

\documentclass[8pt]{article}
\usepackage{fontspec}
  \setmainfont[
    Scale=1.35,
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic
]{texgyretermes}
\linespread{1.1}
\setlength\textwidth{9.25cm}
\usepackage{showframe}

\usepackage{hyphenat}
\usepackage{xstring}
\usepackage{forloop}

\newsavebox\MyBreakChar%
\sbox\MyBreakChar{}% char to display the break after non char
\newsavebox\MySpaceBreakChar%
\sbox\MySpaceBreakChar{\hyp}% char to display the break after space
\makeatletter%
\newcommand*{\BreakableChar}[1][\MyBreakChar]{%
  \leavevmode%
  \prw@zbreak%
  \discretionary{\usebox#1}{}{}%
  \prw@zbreak%
}%
\makeatother


\newcounter{index}%
\newcommand{\AddBreakableChars}[1]{%
  \protected\def\,{\hskip.16667em\relax}%
  \StrLen{#1 }[\stringLength]%
  \forloop[1]{index}{1}{\value{index}<\stringLength}{%
    \StrChar{#1}{\value{index}}[\currentLetter]%
    {\currentLetter\BreakableChar}%
  }%
}%

\newcommand{\techFocus}{%
(bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,
(bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
(1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
\,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
(1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,
(dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,}

\begin{document}
\footnotesize\noindent
\AddBreakableChars{\techFocus}

\end{document}
Regards
Attachments
test.pdf
(5.02 KiB) Downloaded 531 times
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Line/data overrun ...

Post by cgnieder »

As things sometimes go… I just found out about the seqsplit package. Since it gobbles all spaces you'd need to insert non-breakable spaces (~) or control spaces (\) instead:

Code: Select all

\documentclass[8pt]{article}
\usepackage{fontspec}
  \setmainfont[
    Scale=1.35,
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic
]{texgyretermes}
\linespread{1.1}
\setlength\textwidth{9.25cm}
\usepackage{showframe}

\usepackage{seqsplit}

\newcommand{\techFocus}{%
\documentclass[8pt]{article}
\usepackage{fontspec}
  \setmainfont[
    Scale=1.35,
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic
]{texgyretermes}
\linespread{1.1}
\setlength\textwidth{9.25cm}
\usepackage{showframe}

\usepackage{seqsplit}

\newcommand{\techFocus}{%
(bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,~
(bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
(1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
\,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
(1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,~
(dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,}

\begin{document}
\footnotesize\noindent
\expandafter\seqsplit\expandafter{\techFocus}

\end{document}}

\begin{document}
\footnotesize\noindent
\expandafter\seqsplit\expandafter{\techFocus}

\end{document}
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Line/data overrun ...

Post by cgnieder »

The tedious method would of course be adding the breakpoints manually and using \raggedright (which you've already mentioned), maybe combined with some semantic markup:

Code: Select all

\documentclass[8pt]{article}
\usepackage{fontspec}
  \setmainfont[
    Scale=1.35,
    Ligatures=TeX,
    Extension=.otf,
    UprightFont= *-regular,
    BoldFont=*-bold,
    ItalicFont=*-italic,
    BoldItalicFont=*-bolditalic
]{texgyretermes}
\linespread{1.1}
\setlength\textwidth{9.25cm}
\usepackage{showframe}

\usepackage{chemmacros}

\newcommand\techFocus{%
\iupac{(bis\|(tri\|hydro\|carbyl\|silyl)amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{(bis\|(di\|hydro\|carbyl\|hydro\|silyl\|amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{(1\-aza\-2\w\-di\|sila\|cyclo\|hydro\|carbyl)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{[(tri\|hydro\|carbyl\|silyl)\|(hydro\|carbyl)\|amino]\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{[(di\|hydro\|carbyl\|hydro\|silyl)\|(hydro\|carbyl)\|amino]\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{(1\-aza\-2\-sila\|cyclo\|hydro\|carbyl)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
\iupac{(dihydro\|carbyl\|amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes}}

\begin{document}
\footnotesize\noindent\raggedright
\techFocus

\end{document}
Regards
site moderator & package author
rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Re: Line/data overrun ...

Post by rgrice »

Thanks very much for the quick replay and taking the time to look to this ... I'll have a go at trying to implement this solution.
rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Re: Line/data overrun ...

Post by rgrice »

Thanks \seqsplit seems to do the trick ...

Just one more question before I go ... something that bugs me about LaTeX. It seems that text is always fully justified. I would have thought left justified text should be the default. For example within a multicolumn environment it seems that LaTeX will space pad between words in order to get even text borders (anchoring it seems on hyphens when possible). However, this isn't predictable.

For example this text :

A reactive functional group-modified molecularly self-
assembling material comprises reactive functional group(s)
covalently bonded to a molecularly self-assembling (MSA)
material. The reactive functional group is supplementary to
the MSA material and independently derived from a reaction
of a premodification MSA material with a polyfunctional
reactant comprising first- and second-reacting functional
groups.

I would prefer to see like this :

A reactive functional group-modified molecularly
self-assembling material comprises reactive functional
group(s) covalently bonded to a molecularly
self-assembling (MSA) material. The reactive functional
group is supplementary to the MSA material and independently
derived from a reaction of a premodificationMSA material
with a polyfunctional reactant comprising first- and second-
reacting functional groups.

Thanks again for all your help ... it is much appreciated :)

Rich
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Line/data overrun ...

Post by cgnieder »

rgrice wrote:Just one more question before I go ... something that bugs me about LaTeX. It seems that text is always fully justified. I would have thought left justified text should be the default. For example within a multicolumn environment it seems that LaTeX will space pad between words in order to get even text borders (anchoring it seems on hyphens when possible). However, this isn't predictable.
Well, let's say:difficult to predict. TeX has a sophisticated way of building paragraphs and and typeset them justified. Internally it will always try several possibilities and choose the one with least “badness”, a number depending on a series of factors. The details for this are described in the TeXbook or in texbytopic.

Why don't you just set the text ragged right if you want to have it so?

Code: Select all

\documentclass{article}

\usepackage{ragged2e}% Improvements on the standard \raggedright, used as \RaggedRight
\begin{document}

A reactive functional group-modified molecularly self-assembling material comprises
reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
material. The reactive functional group is supplementary to the MSA material and
independently derived from a reaction of a premodification MSA material with a
polyfunctional reactant comprising first- and second-reacting functional groups.

\raggedright
A reactive functional group-modified molecularly self-assembling material comprises
reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
material. The reactive functional group is supplementary to the MSA material and
independently derived from a reaction of a premodification MSA material with a
polyfunctional reactant comprising first- and second-reacting functional groups.

\RaggedRight
A reactive functional group-modified molecularly self-assembling material comprises
reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
material. The reactive functional group is supplementary to the MSA material and
independently derived from a reaction of a premodification MSA material with a
polyfunctional reactant comprising first- and second-reacting functional groups.

\end{document}
Regards
site moderator & package author
Post Reply