Skip to main content
replaced http://tex.stackexchange.com/ with https://tex.stackexchange.com/
Source Link

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or soCutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} \squeeze{aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa} aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} \squeeze{aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa} aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} \squeeze{aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa} aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here

edited body
Source Link
Steven B. Segletes
  • 244.5k
  • 13
  • 346
  • 633

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} \squeeze{aaaaaaaaaa aaaaaaaaaaaaaa \squeeze{aaaaaaaaaaaaa aaaaaaaaaaaa} aaaaaaaa} % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description hereenter image description here

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa \squeeze{aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa} % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} \squeeze{aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa} aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here

Source Link
Steven B. Segletes
  • 244.5k
  • 13
  • 346
  • 633

The various comments to your question have indicated two things:

  1. everyone recommends against large images as inline characters

  2. you (for whatever reason) wish to have your large image set as in inline character, and not, for example, as a separate figure.

Given that, let me review the comment highlights.

  1. The tikzpicture being in an hbox and not a vbox, will be treated as an inline character if it is not set apart in its own environment or group.

  2. The way LaTeX works, it sets a whole paragraph at a time, trying to satisfy a set of weighted constraints (the weights being set by "penalties" and \sloppy just defining different weight values).

  3. If you were using raggedright justification, the constraints are fewer and LaTeX would provide the line break to prevent margin overrun. However, with full alignment, LaTeX may be unable, using the default penalties, to arrive at a satisfactory solution. In those cases it produces an "overfull hbox" which in this case manifests as margin overrun.

  4. You discovered that \sloppy "fixes" the problem, but you are worried that you don't want to prepare a whole document as sloppy.

So my first fix was to use the sloppypar environment to only fix the offending paragraph (paragraph 1 in the MWE).

You then asked if one could effectively provide a sloppypar like solution over a partial paragraph. I would say you are going from bad to worse, but I seemed to recall this solution, Cutting corners - how to delete 1 pt (0.3515 mm) or so, for squeezing things onto one row. Here I use it to stretch things across a partial row, in paragraph 2 of the MWE. It is worse than sloppypar because the word spacing changes mid line (yech!), but at least the line with the bbb characters is not "sloppy" (as you requested).

Paragraph 3 of the MWE was your own example, to prove that sloppypar does not extend over the remainder of the document.

\documentclass[]{article} \usepackage[]{pgfplots} \def\squeeze#1{\squeezeit#1 \relax\relax} % REVISED SOLUTION \def\squeezeit#1 #2\relax{#1\if\relax#2\else \findlast#1\relax\relax% \if.\LastChar\hfil\else \if,\LastChar\hfil\else \hfil\hfil% \fi \fi \squeezeit#2\relax\fi% } \def\findlast#1#2\relax{\def\LastChar{#1}\if\relax#2\else\findlast#2\relax\fi} \textheight 9in \begin{document} \begin{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{sloppypar} aaaaaaaaaa aaaaaaaaaaaaaa \squeeze{aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa} % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb aaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaa % \begin{tikzpicture} \begin{axis} \end{axis} \end{tikzpicture} bbbbbbbbbb bbbbbbbbbbbb bbbbbbbbbb \end{document} 

enter image description here