LaTeX forum ⇒ GeneralLine/data overrun ...

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

Line/data overrun ...

Postby rgrice » Wed Aug 22, 2012 5:54 pm

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 ...

  1. ! Undefined control sequence.
  2. \CT@start ->\let \CT@arc@save
  3. \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 165 times
dajBodyDefinitions.tex
Supporting LaTeX module
(10.6 KiB) Downloaded 198 times
US20120165464A1dab.tex
Abstract data
(14.9 KiB) Downloaded 172 times
Last edited by cgnieder on Wed Aug 22, 2012 7:52 pm, edited 1 time in total.
Reason: added code markup

Tags:

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

Postby cgnieder » Wed Aug 22, 2012 7:58 pm

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
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Postby rgrice » Wed Aug 22, 2012 9:26 pm

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 175 times
dajBodyDefinitions.tex
New version
(10.56 KiB) Downloaded 198 times

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

Postby cgnieder » Wed Aug 22, 2012 10:27 pm

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

The code:
  1. \documentclass[8pt]{article}
  2. \usepackage{fontspec}
  3. \setmainfont[
  4. Scale=1.35,
  5. Ligatures=TeX,
  6. Extension=.otf,
  7. UprightFont= *-regular,
  8. BoldFont=*-bold,
  9. ItalicFont=*-italic,
  10. BoldItalicFont=*-bolditalic
  11. ]{texgyretermes}
  12. \linespread{1.1}
  13. \setlength\textwidth{9.25cm}
  14. \usepackage{showframe}
  15.  
  16. \begin{document}
  17. \footnotesize\noindent
  18. (bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,
  19. (bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  20. (1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  21. \,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  22. (1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,
  23. (dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  24.  
  25. \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…

  1. \documentclass[8pt]{article}
  2. \usepackage{fontspec}
  3. \setmainfont[
  4. Scale=1.35,
  5. Ligatures=TeX,
  6. Extension=.otf,
  7. UprightFont= *-regular,
  8. BoldFont=*-bold,
  9. ItalicFont=*-italic,
  10. BoldItalicFont=*-bolditalic
  11. ]{texgyretermes}
  12. \linespread{1.1}
  13. \setlength\textwidth{9.25cm}
  14. \usepackage{showframe}
  15.  
  16. \usepackage{hyphenat}
  17. \usepackage{xstring}
  18. \usepackage{forloop}
  19.  
  20. \newsavebox\MyBreakChar%
  21. \sbox\MyBreakChar{}% char to display the break after non char
  22. \newsavebox\MySpaceBreakChar%
  23. \sbox\MySpaceBreakChar{\hyp}% char to display the break after space
  24. \makeatletter%
  25. \newcommand*{\BreakableChar}[1][\MyBreakChar]{%
  26. \leavevmode%
  27. \prw@zbreak%
  28. \discretionary{\usebox#1}{}{}%
  29. \prw@zbreak%
  30. }%
  31. \makeatother
  32.  
  33.  
  34. \newcounter{index}%
  35. \newcommand{\AddBreakableChars}[1]{%
  36. \protected\def\,{\hskip.16667em\relax}%
  37. \StrLen{#1 }[\stringLength]%
  38. \forloop[1]{index}{1}{\value{index}<\stringLength}{%
  39. \StrChar{#1}{\value{index}}[\currentLetter]%
  40. {\currentLetter\BreakableChar}%
  41. }%
  42. }%
  43.  
  44. \newcommand{\techFocus}{%
  45. (bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,
  46. (bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  47. (1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  48. \,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,
  49. (1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,
  50. (dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,}
  51.  
  52. \begin{document}
  53. \footnotesize\noindent
  54. \AddBreakableChars{\techFocus}
  55.  
  56. \end{document}


Regards
Attachments
test.pdf
(5.02 KiB) Downloaded 145 times
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

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

Postby cgnieder » Wed Aug 22, 2012 10:41 pm

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:

  1. \documentclass[8pt]{article}
  2. \usepackage{fontspec}
  3. \setmainfont[
  4. Scale=1.35,
  5. Ligatures=TeX,
  6. Extension=.otf,
  7. UprightFont= *-regular,
  8. BoldFont=*-bold,
  9. ItalicFont=*-italic,
  10. BoldItalicFont=*-bolditalic
  11. ]{texgyretermes}
  12. \linespread{1.1}
  13. \setlength\textwidth{9.25cm}
  14. \usepackage{showframe}
  15.  
  16. \usepackage{seqsplit}
  17.  
  18. \newcommand{\techFocus}{%
  19. \documentclass[8pt]{article}
  20. \usepackage{fontspec}
  21. \setmainfont[
  22. Scale=1.35,
  23. Ligatures=TeX,
  24. Extension=.otf,
  25. UprightFont= *-regular,
  26. BoldFont=*-bold,
  27. ItalicFont=*-italic,
  28. BoldItalicFont=*-bolditalic
  29. ]{texgyretermes}
  30. \linespread{1.1}
  31. \setlength\textwidth{9.25cm}
  32. \usepackage{showframe}
  33.  
  34. \usepackage{seqsplit}
  35.  
  36. \newcommand{\techFocus}{%
  37. (bis(trihydrocarbylsilyl)amino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)]silanes,~
  38. (bis(dihydrocarbylhydrosilylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
  39. (1-aza-2ω -disilacyclohydrocarbyl)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,\,[(trihydr-ocarbylsilyl)(hydrocarbyl)amino\,](hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
  40. \,[(dihydrocarbylhydrosilyl)(hydrocarbyl)amino\,](hydrocarbyl) \,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,~
  41. (1-aza-2-silacyclohydrocarbyl)(hydrocarbyl)\,[di(h-ydrocarbylaminohydrocarbyloxy)\,]silanes,~
  42. (dihydrocarbylamino)(hydrocarbyl)\,[di(hydrocarbylaminohydrocarbyloxy)\,]silanes,}
  43.  
  44. \begin{document}
  45. \footnotesize\noindent
  46. \expandafter\seqsplit\expandafter{\techFocus}
  47.  
  48. \end{document}}
  49.  
  50. \begin{document}
  51. \footnotesize\noindent
  52. \expandafter\seqsplit\expandafter{\techFocus}
  53.  
  54. \end{document}
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

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

Postby cgnieder » Wed Aug 22, 2012 11:33 pm

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:

  1. \documentclass[8pt]{article}
  2. \usepackage{fontspec}
  3. \setmainfont[
  4. Scale=1.35,
  5. Ligatures=TeX,
  6. Extension=.otf,
  7. UprightFont= *-regular,
  8. BoldFont=*-bold,
  9. ItalicFont=*-italic,
  10. BoldItalicFont=*-bolditalic
  11. ]{texgyretermes}
  12. \linespread{1.1}
  13. \setlength\textwidth{9.25cm}
  14. \usepackage{showframe}
  15.  
  16. \usepackage{chemmacros}
  17.  
  18. \newcommand\techFocus{%
  19. \iupac{(bis\|(tri\|hydro\|carbyl\|silyl)amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  20. \iupac{(bis\|(di\|hydro\|carbyl\|hydro\|silyl\|amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  21. \iupac{(1\-aza\-2\w\-di\|sila\|cyclo\|hydro\|carbyl)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  22. \iupac{[(tri\|hydro\|carbyl\|silyl)\|(hydro\|carbyl)\|amino]\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  23. \iupac{[(di\|hydro\|carbyl\|hydro\|silyl)\|(hydro\|carbyl)\|amino]\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  24. \iupac{(1\-aza\-2\-sila\|cyclo\|hydro\|carbyl)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes},
  25. \iupac{(dihydro\|carbyl\|amino)\|(hydro\|carbyl)\|[di\|(hydro\|carbyl\|amino\|hydro\|carbyloxy)]\|silanes}}
  26.  
  27. \begin{document}
  28. \footnotesize\noindent\raggedright
  29. \techFocus
  30.  
  31. \end{document}


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

rgrice
Posts: 10
Joined: Fri Mar 09, 2012 2:25 pm

Postby rgrice » Thu Aug 23, 2012 1:32 pm

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

Postby rgrice » Thu Aug 30, 2012 2:18 am

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: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Thu Aug 30, 2012 9:12 am

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?

  1. \documentclass{article}
  2.  
  3. \usepackage{ragged2e}% Improvements on the standard \raggedright, used as \RaggedRight
  4. \begin{document}
  5.  
  6. A reactive functional group-modified molecularly self-assembling material comprises
  7. reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
  8. material. The reactive functional group is supplementary to the MSA material and
  9. independently derived from a reaction of a premodification MSA material with a
  10. polyfunctional reactant comprising first- and second-reacting functional groups.
  11.  
  12. \raggedright
  13. A reactive functional group-modified molecularly self-assembling material comprises
  14. reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
  15. material. The reactive functional group is supplementary to the MSA material and
  16. independently derived from a reaction of a premodification MSA material with a
  17. polyfunctional reactant comprising first- and second-reacting functional groups.
  18.  
  19. \RaggedRight
  20. A reactive functional group-modified molecularly self-assembling material comprises
  21. reactive functional group(s) covalently bonded to a molecularly self-assembling (MSA)
  22. material. The reactive functional group is supplementary to the MSA material and
  23. independently derived from a reaction of a premodification MSA material with a
  24. polyfunctional reactant comprising first- and second-reacting functional groups.
  25.  
  26. \end{document}


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests