0

LaTeX doesn't create the line break and I get text coming off the page. I'm using the seqsplit package but it doesn't work in this case.

Here is my preambule and code :

\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}
\renewcommand*{\tablename}{Tab.}
 \usepackage[unicode]{hyperref}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
 \graphicspath{{rysunki/}}
 \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
 \usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
 \fancyhead[RO,LE]{Rozdział \thechapter}
 \fancyhead[CE,CO]{\rightmark}
 \fancyfoot[LO,CE]{\thepage}

 \usepackage{graphicx}
 \graphicspath{{rysunki/}}
 \usepackage{amsmath}
 \setcounter{secnumdepth}{4}
 \usepackage{seqsplit}

 \hyphenpenalty=10000   
 \clubpenalty=10000         
 \widowpenalty=10000        
 \brokenpenalty=10000       
  \exhyphenpenalty=999999       
  \righthyphenmin=3         

 \tolerance=4500
 \pretolerance=250
 \hfuzz=1.5pt
 \hbadness=1450

 \sloppy                        

  \setlength{\textwidth}{\paperwidth}
  \addtolength{\textwidth}{-5cm}
  \setlength{\textheight}{\paperheight}
  \addtolength{\textheight}{-5cm}
  \setlength{\oddsidemargin}{0cm}
   \setlength{\evensidemargin}{0cm}
  \topmargin -1.25cm
  \footskip 1.4cm

 \linespread{1.3}

 \begin{document}

 \section{Synteza związków}
 $\textbf{[Cu}_{3}\textbf{1}_\textbf{{RRRRRR}}\textbf{Cl}_\textbf{{4}}\textbf{]Cl}_\textbf{{2}}\cdot\textbf{7,5H}_\textbf{{2}}\textbf{O} $ \\ 
  ^{1}H \ \textbf{\mbox{NMR}} \ (500 \mbox{MHz}, D_{2}O)\ \delta\ \seqsplit{$77,20;\ 56,82;\ 36,46;\ 34,52;\ 29,12;\ 28,08;\ 27,52;\ 16,04;\ 10,44;\ 1,60;\ -0,96;\ -1,77;\ -6,19;\ -8,20;\ -9,42;\ -161,13;\ -184,80\ ppm.$} \\
  \textbf{\mbox{ESI-MS}}: m \backslash z\  $291,7 [\textbf{1}_{-2H}Cu_{2}Cl]^{+};\ 387,7\ [\textbf{1}_{-2H}Cu_{2}]^{2+};437,1\ [\textbf{1}_{-3H}Cu_{3}Cl]^{2+};\ 455,1\ [\textbf{1}_{-2H}Cu_{3}Cl_{2}]^{2+};\ 812,3\ [\textbf{1}_{-2H}Cu_{2}Cl]^{+};\ 848,3\ [\textbf{1}_{-1H}Cu_{2}Cl_{2}]^{+};\ 884,2\ [\textbf{1}Cu_{2}Cl_{3}]^{+};\ 909,2\ [\textbf{1}_{-3H}Cu_{3}Cl_{2}]^{+};\ 927,2\ \{[\textbf{1}_{-3H}Cu_{3}Cl_{3}](H_{2}O)_{2}\}^{+}; $ 


\end{document}

As you can see seqsplit works in with NMR line but it doesn`t with ESI line.
Is there anyway to have LaTeX do this line break automatically and adjust text to the width of the page?

5
  • 2
    Make a complete example so that we can test without having to create a document first. Aug 10, 2016 at 15:40
  • seqsplit is intended to take a sequence of letters, you are giving it math markup??? But your example stops before then with the unrelated error ! Missing $ inserted. <inserted text> $ l.55 ^ Aug 10, 2016 at 16:19
  • I read that seqsplit is for letters but I didn`t find anything else so I decided to try this. I also saw this error but my pdf file seems to look ok. When I add $ before ^{1}H, and remove $ from 77,20 and also do the same in next line - add $ at the beggining of the line and remove it from 291,7, I get warning "Overfull \hbox (679.78935pt too wide) in paragraph at lines 54--57". But my pdf file stil seems to lokk the same...
    – marta
    Aug 10, 2016 at 16:46
  • @marta never ignore error messages, honestly it is rarely worth looking at the pdf after an error, tex's error recovery is not designed to make sensible typeset output it just recovers any way to get itself into a state to carry on to check the rest of the document. Certainly you should make sure that your example posted to a question does not generate errors unrelated to the question. Aug 10, 2016 at 18:16
  • @DavidCarlisle I realy don't know what to do. I thought this errors are related to my question. When I remove whole line "\textbf{\mbox{ESI-MS}}:..." error "Overfull.." disappear. I know I still have error with missing $ but when I remove all $, text in line "^{1}H \ \textbf{\mbox{NMR}}" is comming out off the page. I also read that this error occurs when you put one $ and don't close it with another $. But I did it. I've started learn LATEX few days ago and I realy don't know what to do with this
    – marta
    Aug 10, 2016 at 18:46

1 Answer 1

1

seqsplit can't do what you want it to do. No offense to seqsplit; that's just not what it was designed for. Its documentation should make that pretty clear.

So I removed your extraneous code and produced a minimal working example;

\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}

 \begin{document}

 \section{Synteza związków}
 $\textbf{[Cu}_{3}\textbf{1}_\textbf{{RRRRRR}}\textbf{Cl}_\textbf{{4}}\textbf{]Cl}_\textbf{{2}}\cdot\textbf{7,5H}_\textbf{{2}}\textbf{O} $ \\ 
  $^{1}H \ \textbf{\mbox{NMR}} \ (500 \mbox{MHz}, D_{2}O)\ \delta\ 77,20;\ 56,82;\ 36,46;\ 34,52;\ 29,12;\ 28,08;\ 27,52;\ 16,04;\ 10,44;\ 1,60;\ -0,96;\ -1,77;\ -6,19;\ -8,20;\ -9,42;\ -161,13;\ -184,80\ ppm.$ \\
$  \textbf{\mbox{ESI-MS}}: m \backslash z\  291,7 [\textbf{1}_{-2H}Cu_{2}Cl]^{+};\ 387,7\ [\textbf{1}_{-2H}Cu_{2}]^{2+};437,1\ [\textbf{1}_{-3H}Cu_{3}Cl]^{2+};\ 455,1\ [\textbf{1}_{-2H}Cu_{3}Cl_{2}]^{2+};\ 812,3\ [\textbf{1}_{-2H}Cu_{2}Cl]^{+};\ 848,3\ [\textbf{1}_{-1H}Cu_{2}Cl_{2}]^{+};\ 884,2\ [\textbf{1}Cu_{2}Cl_{3}]^{+};\ 909,2\ [\textbf{1}_{-3H}Cu_{3}Cl_{2}]^{+};\ 927,2\ \{[\textbf{1}_{-3H}Cu_{3}Cl_{3}](H_{2}O)_{2}\}^{+}; $ 

\end{document}

Now, what you need to do is, instead of using the basic $ to start your TeX math environment, use something else which permits line breaking ($ is specifically designed for inline math). I'd suggest the dmath environment, from the breqn package. When I tried this, however, I found that your equations don't have any obvious breakpoints that breqn recognized; so assuming (from your use of seqsplit) that you don't much care where the equations are broken, I told breqn to condsider the character ; as a good breakpoint, and got this (after fixing some strangeness in your equations that was causing compilation to fail; to get the boldface and such looking the way you want, you'll need to fix that):

\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{polski}
\usepackage{amsmath}
\usepackage{breqn}

\newcommand\breakspace{%
    \begingroup\lccode`~=`;
    \lowercase{\endgroup\expandafter\def\expandafter~\expandafter{~\penalty0
    }}}

 \begin{document}

 \section{Synteza związków}

\begin{dmath}
\boldsymbol{[Cu}_{3}\boldsymbol{1}_{\boldsymbol{RRRRRR}}
\boldsymbol{Cl}_{\boldsymbol{4}}\boldsymbol{]Cl}_{\boldsymbol{2}}
\cdot\boldsymbol{7,5H}_{\boldsymbol{2}}\boldsymbol{O}\end{dmath}  

\begin{dmath}\breakspace
^{1}H \ \boldsymbol{\mbox{NMR}} \ (500 \mbox{MHz},
D_{2}O)\ \delta\ 77,20;\ 56,82;\ 36,46;\ 34,52;\ 29,12;\
28,08;\ 27,52;\ 16,04;\ 10,44;\ 1,60;\ -0,96;\ -1,77;\
-6,19;\ -8,20;\ -9,42;\ -161,13;\ -184,80\ ppm.
\end{dmath}

\begin{dmath}\breakspace
\boldsymbol{\mbox{ESI-MS}}: m \backslash z\  291,7
[\boldsymbol{1}_{-2H}Cu_{2}Cl]^{+};\ 387,7\
[\boldsymbol{1}_{-2H}Cu_{2}]^{2+};437,1\
[\boldsymbol{1}_{-3H}Cu_{3}Cl]^{2+};\ 455,1\
[\boldsymbol{1}_{-2H}Cu_{3}Cl_{2}]^{2+};\ 812,3\
[\boldsymbol{1}_{-2H}Cu_{2}Cl]^{+};\ 848,3\
[\boldsymbol{1}_{-1H}Cu_{2}Cl_{2}]^{+};\ 884,2\
[\boldsymbol{1}Cu_{2}Cl_{3}]^{+};\ 909,2\
[\boldsymbol{1}_{-3H}Cu_{3}Cl_{2}]^{+};\ 927,2\
\{[\boldsymbol{1}_{-3H}Cu_{3}Cl_{3}](H_{2}O)_{2}\}^{+};
\end{dmath}

\end{document}

(With some perfunctory line breaking to make the code a bit easier to work with, though it's certainly not what I would call clean.) This will yield the following:

Hacked-up equations properly broken

Note that the "use semicolon as breakpoint" code came from this excellent answer, which may have solved your problem on its own.

Please look into how to create a minimal working example; it makes it a lot easier to help you.

1
  • 1
    \boldsymbol{\mbox{ABC}? Why not a simpler \textbf{ABC}?
    – egreg
    Aug 11, 2016 at 20:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .