texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_latex_header): Re


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_latex_header): Redefine \_ so to allow line breaking at underscore. Update TODO agendum.
Date: Sat, 01 Oct 2022 17:07:21 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 22ea42f557 * tp/Texinfo/Convert/LaTeX.pm (_latex_header): Redefine \_ 
so to allow line breaking at underscore.  Update TODO agendum.
22ea42f557 is described below

commit 22ea42f55757157760e69c39e5dcb6dd3bb03f31
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Oct 1 22:07:11 2022 +0100

    * tp/Texinfo/Convert/LaTeX.pm (_latex_header):
    Redefine \_ so to allow line breaking at underscore.  Update TODO
    agendum.
---
 ChangeLog                                                  |  6 ++++++
 tp/Texinfo/Convert/LaTeX.pm                                | 14 +++++++-------
 .../combined_fonts/res_latex/combined_fonts.tex            |  3 +++
 .../definition_commands/res_latex/definition_commands.tex  |  3 +++
 tp/t/results/converters_tests/empty/res_latex/empty.tex    |  3 +++
 .../minimal_empty_empty/res_latex/minimal_empty_empty.tex  |  3 +++
 .../res_latex/minimal_empty_with_bye.tex                   |  3 +++
 .../res_latex/minimal_empty_with_input.tex                 |  3 +++
 .../res_latex/printindex_merged_indices_code_style.tex     |  3 +++
 .../res_latex/references_to_top_no_top_output.tex          |  3 +++
 .../res_latex/simplest_no_node_section.tex                 |  3 +++
 .../res_latex/char_latin1_latin1_in_refs.tex               |  3 +++
 .../res_latex/mathjax_with_texinfo_enable_encoding.tex     |  3 +++
 tp/t/results/indices/def_syn_indices.pl                    |  3 +++
 tp/t/results/indices/double_seeentry_seealso.pl            |  3 +++
 tp/t/results/indices/empty_cindex_entry.pl                 |  3 +++
 tp/t/results/indices/empty_index_entry.pl                  |  3 +++
 tp/t/results/indices/empty_string_index_entry.pl           |  3 +++
 tp/t/results/indices/explicit_sort_key.pl                  |  3 +++
 .../indices/multiple_index_text_sortas_seeentry_seealso.pl |  3 +++
 tp/t/results/indices/same_only_seealso_seeentry.pl         |  3 +++
 tp/t/results/indices/same_seealso_seeentry.pl              |  3 +++
 tp/t/results/indices/seealso_duplicate.pl                  |  3 +++
 tp/t/results/indices/seeentry.pl                           |  3 +++
 tp/t/results/indices/subentries.pl                         |  3 +++
 tp/t/results/indices/subentry_and_sortas.pl                |  3 +++
 tp/t/results/indices/syncode_index_print_both.pl           |  3 +++
 tp/t/results/indices/transparent_sort_chars.pl             |  3 +++
 .../res_latex/inter_item_commands_in_enumerate.tex         |  3 +++
 .../res_latex/inter_item_commands_in_itemize.tex           |  3 +++
 .../res_latex/multiple_lang_chapters.tex                   |  3 +++
 .../anchor_links_xref_xrefautomaticsectiontitle.tex        |  3 +++
 .../brace_in_index/res_latex/brace_in_index.tex            |  3 +++
 .../custom_headings/res_latex/custom_headings.tex          |  3 +++
 .../enumerate_arguments/res_latex/enumerate_arguments.tex  |  3 +++
 .../res_latex/error_in_sectioning_command.tex              |  3 +++
 .../res_latex/example_in_cartouche.tex                     |  3 +++
 .../float_and_refs/res_latex/float_and_refs.tex            |  3 +++
 .../latex_tests/fonttextsize/res_latex/fonttextsize.tex    |  3 +++
 tp/t/results/latex_tests/indices/res_latex/indices.tex     |  3 +++
 .../res_latex/informative_commands_in_top_node.tex         |  3 +++
 .../nested_enumerate/res_latex/nested_enumerate.tex        |  3 +++
 .../nested_itemize/res_latex/nested_itemize.tex            |  3 +++
 .../res_latex/no_titlepage_and_setchapternewpage_odd.tex   |  3 +++
 .../res_latex/no_titlepage_and_setchapternewpage_on.tex    |  3 +++
 tp/t/results/latex_tests/pagesizes/res_latex/pagesizes.tex |  3 +++
 tp/t/results/latex_tests/pagetype/res_latex/pagetype.tex   |  3 +++
 .../res_latex/setchapternewpage_on_odd_titlepage.tex       |  3 +++
 .../res_latex/settitle_and_headings.tex                    |  3 +++
 .../shorttitlepage/res_latex/shorttitlepage.tex            |  3 +++
 .../res_latex/three_setchapternewpage_on_odd_off.tex       |  3 +++
 .../res_latex/titlepage_and_headings.tex                   |  3 +++
 .../res_latex/titlepage_and_setchapternewpage_odd.tex      |  3 +++
 .../res_latex/titlepage_and_setchapternewpage_on.tex       |  3 +++
 .../titlepage_classical/res_latex/titlepage_classical.tex  |  3 +++
 .../res_latex/titlepage_in_top_node.tex                    |  3 +++
 .../res_latex/titlepage_long_title.tex                     |  3 +++
 .../titlepage_no_author/res_latex/titlepage_no_author.tex  |  3 +++
 .../titlepage_no_title/res_latex/titlepage_no_title.tex    |  3 +++
 .../res_latex/titlepage_with_commands_classical.tex        |  3 +++
 .../res_latex/two_setchapternewpage_odd_on.tex             |  3 +++
 .../res_latex/two_setchapternewpage_on_odd.tex             |  3 +++
 .../res_latex/verbatim_in_smallformat.tex                  |  3 +++
 .../misc_commands/codequoteundirected_codequotebacktick.pl |  3 +++
 tp/t/results/misc_commands/command_in_heading_footing.pl   |  3 +++
 .../results/misc_commands/comment_space_command_on_line.pl |  3 +++
 tp/t/results/misc_commands/comments_in_text.pl             |  3 +++
 tp/t/results/misc_commands/definfoenclose.pl               |  3 +++
 .../results/misc_commands/definfoenclose_with_empty_arg.pl |  3 +++
 tp/t/results/misc_commands/empty_center.pl                 |  3 +++
 tp/t/results/misc_commands/empty_center_with_arg.pl        |  3 +++
 tp/t/results/misc_commands/footnote_in_center.pl           |  3 +++
 tp/t/results/misc_commands/heading_command_in_commands.pl  |  3 +++
 .../misc_commands/incorrect_allowcodebreaks_argument.pl    |  3 +++
 tp/t/results/misc_commands/indent_in_quotation.pl          |  3 +++
 tp/t/results/misc_commands/kbdinputstyle.pl                |  3 +++
 tp/t/results/misc_commands/kbdinputstyle_in_table.pl       |  3 +++
 .../misc_commands/no_empty_line_between_headings.pl        |  3 +++
 tp/t/results/misc_commands/noindent_after_smallexample.pl  |  3 +++
 tp/t/results/misc_commands/noindent_empty_para.pl          |  3 +++
 tp/t/results/misc_commands/noindent_in_paragraph.pl        |  3 +++
 tp/t/results/misc_commands/noindent_indent.pl              |  3 +++
 tp/t/results/misc_commands/ref_in_center.pl                |  3 +++
 tp/t/results/misc_commands/setfilename.pl                  |  3 +++
 tp/t/results/misc_commands/test_allowcodebreaks.pl         |  3 +++
 tp/t/results/misc_commands/vskip.pl                        |  3 +++
 tp/t/results/quotation/empty_quotation.pl                  |  3 +++
 tp/t/results/quotation/quotation_and_author.pl             |  3 +++
 tp/t/results/quotation/quotation_author_in_example.pl      |  3 +++
 .../quotation/space_at_commands_end_quotation_line.pl      |  3 +++
 .../res_latex/chapter_between_nodes.tex                    |  3 +++
 .../sectioning/lone_Top_node/res_latex/lone_Top_node.tex   |  3 +++
 .../results/sectioning/loop_nodes/res_latex/loop_nodes.tex |  3 +++
 .../res_latex/node_sectop_before_chapter_no_node.tex       |  3 +++
 .../res_latex/node_sectop_before_lone_node_Top.tex         |  3 +++
 .../res_latex/nodes_before_after_top.tex                   |  3 +++
 .../res_latex/nodes_before_after_top_xref.tex              |  3 +++
 .../nodes_before_top/res_latex/nodes_before_top.tex        |  3 +++
 .../res_latex/section_before_after_top_node.tex            |  3 +++
 .../res_latex/section_before_after_top_node_last_node.tex  |  3 +++
 .../res_latex/section_chapter_before_top_nodes.tex         |  3 +++
 .../top_node_part_top/res_latex/top_node_part_top.tex      |  3 +++
 .../res_latex/inter_item_commands_in_table.tex             |  3 +++
 .../res_latex/inter_item_commands_in_table_in_example.tex  |  3 +++
 .../res_parser/non_ascii_test_latex/os\303\251_utf8.tex"   |  3 +++
 .../indices_in_begin_tables_lists.tex                      |  3 +++
 .../indices_in_begin_tables_lists.tex                      |  3 +++
 tp/tests/layout/res_parser/formatting_latex/formatting.tex |  3 +++
 108 files changed, 331 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 98b2562183..466a61e1fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-10-01  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/LaTeX.pm (_latex_header):
+       Redefine \_ so to allow line breaking at underscore.  Update TODO
+       agendum.
+
 2022-10-01  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi (Contents): State that @shortcontents
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 7dc242ddc7..68f60f4b9b 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -17,12 +17,7 @@
 #
 # TODO
 #
-# LaTeX seems to always break at -, and never at _.  If @allowcodebreaks
-# is true \_ should be set to be a possible break point.  Seems that it
-# may be done with something like:
-#
-#   \let\underscore\_
-#   \newcommand{\myunderscore}{\renewcommand{\_}{\underscore\hspace{0pt}}}
+# RELEVANT BUT NOT DECISIVE
 #
 # If @allowcodebreaks is false, - should be set such that it is not a
 # breaking point anymore.  Maybe one way to do it:
@@ -35,7 +30,6 @@
 # or two hyphen, no break between __ or hyphen.  See near \global\def\code
 # in texinfo.tex.
 #
-# RELEVANT BUT NOT DECISIVE
 #
 # breaking in urls is not implemented, maybe there is some support already in
 # hyperref.  @urefbreakstyle, @/
@@ -1377,6 +1371,12 @@ roundcorner=10pt}
 
 '
   }
+
+  $header_code .= '% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
+';
+
   # this is in order to be able to run pdflatex even
   # if files do not exist, or filenames cannot be
   # processed by LaTeX
diff --git 
a/tp/t/results/converters_tests/combined_fonts/res_latex/combined_fonts.tex 
b/tp/t/results/converters_tests/combined_fonts/res_latex/combined_fonts.tex
index ab576f3400..0763d25b58 100644
--- a/tp/t/results/converters_tests/combined_fonts/res_latex/combined_fonts.tex
+++ b/tp/t/results/converters_tests/combined_fonts/res_latex/combined_fonts.tex
@@ -39,6 +39,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/definition_commands/res_latex/definition_commands.tex
 
b/tp/t/results/converters_tests/definition_commands/res_latex/definition_commands.tex
index 2c6c3298ba..2c10820afa 100644
--- 
a/tp/t/results/converters_tests/definition_commands/res_latex/definition_commands.tex
+++ 
b/tp/t/results/converters_tests/definition_commands/res_latex/definition_commands.tex
@@ -43,6 +43,9 @@
 % so it is turned off here, and turned on @def* lines
 \EmbracOff{}%
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/converters_tests/empty/res_latex/empty.tex 
b/tp/t/results/converters_tests/empty/res_latex/empty.tex
index 14e2ee58ef..2eb2a1598d 100644
--- a/tp/t/results/converters_tests/empty/res_latex/empty.tex
+++ b/tp/t/results/converters_tests/empty/res_latex/empty.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/minimal_empty_empty/res_latex/minimal_empty_empty.tex
 
b/tp/t/results/converters_tests/minimal_empty_empty/res_latex/minimal_empty_empty.tex
index 14e2ee58ef..2eb2a1598d 100644
--- 
a/tp/t/results/converters_tests/minimal_empty_empty/res_latex/minimal_empty_empty.tex
+++ 
b/tp/t/results/converters_tests/minimal_empty_empty/res_latex/minimal_empty_empty.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/minimal_empty_with_bye/res_latex/minimal_empty_with_bye.tex
 
b/tp/t/results/converters_tests/minimal_empty_with_bye/res_latex/minimal_empty_with_bye.tex
index 14e2ee58ef..2eb2a1598d 100644
--- 
a/tp/t/results/converters_tests/minimal_empty_with_bye/res_latex/minimal_empty_with_bye.tex
+++ 
b/tp/t/results/converters_tests/minimal_empty_with_bye/res_latex/minimal_empty_with_bye.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/minimal_empty_with_input/res_latex/minimal_empty_with_input.tex
 
b/tp/t/results/converters_tests/minimal_empty_with_input/res_latex/minimal_empty_with_input.tex
index 14e2ee58ef..2eb2a1598d 100644
--- 
a/tp/t/results/converters_tests/minimal_empty_with_input/res_latex/minimal_empty_with_input.tex
+++ 
b/tp/t/results/converters_tests/minimal_empty_with_input/res_latex/minimal_empty_with_input.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
 
b/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
index 4d36bbcb24..8d71f166cd 100644
--- 
a/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
+++ 
b/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
@@ -32,6 +32,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/references_to_top_no_top_output/res_latex/references_to_top_no_top_output.tex
 
b/tp/t/results/converters_tests/references_to_top_no_top_output/res_latex/references_to_top_no_top_output.tex
index 7950041b67..f626d04cfc 100644
--- 
a/tp/t/results/converters_tests/references_to_top_no_top_output/res_latex/references_to_top_no_top_output.tex
+++ 
b/tp/t/results/converters_tests/references_to_top_no_top_output/res_latex/references_to_top_no_top_output.tex
@@ -35,6 +35,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/converters_tests/simplest_no_node_section/res_latex/simplest_no_node_section.tex
 
b/tp/t/results/converters_tests/simplest_no_node_section/res_latex/simplest_no_node_section.tex
index aba95ef180..4d8a00edfb 100644
--- 
a/tp/t/results/converters_tests/simplest_no_node_section/res_latex/simplest_no_node_section.tex
+++ 
b/tp/t/results/converters_tests/simplest_no_node_section/res_latex/simplest_no_node_section.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_latex/char_latin1_latin1_in_refs.tex
 
b/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_latex/char_latin1_latin1_in_refs.tex
index a98001adc8..d8a7bf73f4 100644
--- 
a/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_latex/char_latin1_latin1_in_refs.tex
+++ 
b/tp/t/results/formats_encodings/char_latin1_latin1_in_refs/res_latex/char_latin1_latin1_in_refs.tex
@@ -32,6 +32,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding/res_latex/mathjax_with_texinfo_enable_encoding.tex
 
b/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding/res_latex/mathjax_with_texinfo_enable_encoding.tex
index 94575aebd9..e620489ced 100644
--- 
a/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding/res_latex/mathjax_with_texinfo_enable_encoding.tex
+++ 
b/tp/t/results/html_tests/mathjax_with_texinfo_enable_encoding/res_latex/mathjax_with_texinfo_enable_encoding.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/indices/def_syn_indices.pl 
b/tp/t/results/indices/def_syn_indices.pl
index 46c5632560..51b119f2c0 100644
--- a/tp/t/results/indices/def_syn_indices.pl
+++ b/tp/t/results/indices/def_syn_indices.pl
@@ -2225,6 +2225,9 @@ $result_converted{'latex'}->{'def_syn_indices'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/double_seeentry_seealso.pl 
b/tp/t/results/indices/double_seeentry_seealso.pl
index 95cfb2a799..55988b78c1 100644
--- a/tp/t/results/indices/double_seeentry_seealso.pl
+++ b/tp/t/results/indices/double_seeentry_seealso.pl
@@ -1012,6 +1012,9 @@ $result_converted{'latex'}->{'double_seeentry_seealso'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/empty_cindex_entry.pl 
b/tp/t/results/indices/empty_cindex_entry.pl
index 5cffb6383e..6744c88542 100644
--- a/tp/t/results/indices/empty_cindex_entry.pl
+++ b/tp/t/results/indices/empty_cindex_entry.pl
@@ -269,6 +269,9 @@ $result_converted{'latex'}->{'empty_cindex_entry'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/empty_index_entry.pl 
b/tp/t/results/indices/empty_index_entry.pl
index 2caccda597..4e5520525e 100644
--- a/tp/t/results/indices/empty_index_entry.pl
+++ b/tp/t/results/indices/empty_index_entry.pl
@@ -451,6 +451,9 @@ $result_converted{'latex'}->{'empty_index_entry'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/empty_string_index_entry.pl 
b/tp/t/results/indices/empty_string_index_entry.pl
index 8f61087cd2..53feab7a53 100644
--- a/tp/t/results/indices/empty_string_index_entry.pl
+++ b/tp/t/results/indices/empty_string_index_entry.pl
@@ -1097,6 +1097,9 @@ $result_converted{'latex'}->{'empty_string_index_entry'} 
= '\\documentclass{book
 % so it is turned off here, and turned on @def* lines
 \\EmbracOff{}%
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/explicit_sort_key.pl 
b/tp/t/results/indices/explicit_sort_key.pl
index d845b3ab4b..98b81ab4f5 100644
--- a/tp/t/results/indices/explicit_sort_key.pl
+++ b/tp/t/results/indices/explicit_sort_key.pl
@@ -1165,6 +1165,9 @@ $result_converted{'latex'}->{'explicit_sort_key'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git 
a/tp/t/results/indices/multiple_index_text_sortas_seeentry_seealso.pl 
b/tp/t/results/indices/multiple_index_text_sortas_seeentry_seealso.pl
index d25702cc17..4643f38f7a 100644
--- a/tp/t/results/indices/multiple_index_text_sortas_seeentry_seealso.pl
+++ b/tp/t/results/indices/multiple_index_text_sortas_seeentry_seealso.pl
@@ -840,6 +840,9 @@ 
$result_converted{'latex'}->{'multiple_index_text_sortas_seeentry_seealso'} = '\
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/same_only_seealso_seeentry.pl 
b/tp/t/results/indices/same_only_seealso_seeentry.pl
index 1094acdb2d..0ba8b3cde6 100644
--- a/tp/t/results/indices/same_only_seealso_seeentry.pl
+++ b/tp/t/results/indices/same_only_seealso_seeentry.pl
@@ -994,6 +994,9 @@ $result_converted{'latex'}->{'same_only_seealso_seeentry'} 
= '\\documentclass{bo
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/same_seealso_seeentry.pl 
b/tp/t/results/indices/same_seealso_seeentry.pl
index b66884d120..7768b7466f 100644
--- a/tp/t/results/indices/same_seealso_seeentry.pl
+++ b/tp/t/results/indices/same_seealso_seeentry.pl
@@ -1075,6 +1075,9 @@ $result_converted{'latex'}->{'same_seealso_seeentry'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/seealso_duplicate.pl 
b/tp/t/results/indices/seealso_duplicate.pl
index 62a7cb2879..921351b2f2 100644
--- a/tp/t/results/indices/seealso_duplicate.pl
+++ b/tp/t/results/indices/seealso_duplicate.pl
@@ -514,6 +514,9 @@ $result_converted{'latex'}->{'seealso_duplicate'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/seeentry.pl b/tp/t/results/indices/seeentry.pl
index b07540bf9c..063722381e 100644
--- a/tp/t/results/indices/seeentry.pl
+++ b/tp/t/results/indices/seeentry.pl
@@ -853,6 +853,9 @@ $result_converted{'latex'}->{'seeentry'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/subentries.pl 
b/tp/t/results/indices/subentries.pl
index 8788560252..050cb5df13 100644
--- a/tp/t/results/indices/subentries.pl
+++ b/tp/t/results/indices/subentries.pl
@@ -1428,6 +1428,9 @@ $result_converted{'latex'}->{'subentries'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/subentry_and_sortas.pl 
b/tp/t/results/indices/subentry_and_sortas.pl
index 783b791fc1..10d0a88037 100644
--- a/tp/t/results/indices/subentry_and_sortas.pl
+++ b/tp/t/results/indices/subentry_and_sortas.pl
@@ -849,6 +849,9 @@ $result_converted{'latex'}->{'subentry_and_sortas'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/syncode_index_print_both.pl 
b/tp/t/results/indices/syncode_index_print_both.pl
index 509ae68a51..2deb2d712d 100644
--- a/tp/t/results/indices/syncode_index_print_both.pl
+++ b/tp/t/results/indices/syncode_index_print_both.pl
@@ -850,6 +850,9 @@ $result_converted{'latex'}->{'syncode_index_print_both'} = 
'\\documentclass{book
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/indices/transparent_sort_chars.pl 
b/tp/t/results/indices/transparent_sort_chars.pl
index d54437a215..5c1f302648 100644
--- a/tp/t/results/indices/transparent_sort_chars.pl
+++ b/tp/t/results/indices/transparent_sort_chars.pl
@@ -658,6 +658,9 @@ $result_converted{'latex'}->{'transparent_sort_chars'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git 
a/tp/t/results/itemize/inter_item_commands_in_enumerate/res_latex/inter_item_commands_in_enumerate.tex
 
b/tp/t/results/itemize/inter_item_commands_in_enumerate/res_latex/inter_item_commands_in_enumerate.tex
index 5ec2230424..9814ca3740 100644
--- 
a/tp/t/results/itemize/inter_item_commands_in_enumerate/res_latex/inter_item_commands_in_enumerate.tex
+++ 
b/tp/t/results/itemize/inter_item_commands_in_enumerate/res_latex/inter_item_commands_in_enumerate.tex
@@ -36,6 +36,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/itemize/inter_item_commands_in_itemize/res_latex/inter_item_commands_in_itemize.tex
 
b/tp/t/results/itemize/inter_item_commands_in_itemize/res_latex/inter_item_commands_in_itemize.tex
index 4d7689547d..a08b036be4 100644
--- 
a/tp/t/results/itemize/inter_item_commands_in_itemize/res_latex/inter_item_commands_in_itemize.tex
+++ 
b/tp/t/results/itemize/inter_item_commands_in_itemize/res_latex/inter_item_commands_in_itemize.tex
@@ -36,6 +36,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/languages/multiple_lang_chapters_latex/res_latex/multiple_lang_chapters.tex
 
b/tp/t/results/languages/multiple_lang_chapters_latex/res_latex/multiple_lang_chapters.tex
index 0690815c6a..e63c3dc7d3 100644
--- 
a/tp/t/results/languages/multiple_lang_chapters_latex/res_latex/multiple_lang_chapters.tex
+++ 
b/tp/t/results/languages/multiple_lang_chapters_latex/res_latex/multiple_lang_chapters.tex
@@ -47,6 +47,9 @@
 % so it is turned off here, and turned on @def* lines
 \EmbracOff{}%
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/anchor_links_xref_xrefautomaticsectiontitle/res_latex/anchor_links_xref_xrefautomaticsectiontitle.tex
 
b/tp/t/results/latex_tests/anchor_links_xref_xrefautomaticsectiontitle/res_latex/anchor_links_xref_xrefautomaticsectiontitle.tex
index 5ae813e8f2..5856c044ae 100644
--- 
a/tp/t/results/latex_tests/anchor_links_xref_xrefautomaticsectiontitle/res_latex/anchor_links_xref_xrefautomaticsectiontitle.tex
+++ 
b/tp/t/results/latex_tests/anchor_links_xref_xrefautomaticsectiontitle/res_latex/anchor_links_xref_xrefautomaticsectiontitle.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/brace_in_index/res_latex/brace_in_index.tex 
b/tp/t/results/latex_tests/brace_in_index/res_latex/brace_in_index.tex
index 3c909e9e9c..32127d9196 100644
--- a/tp/t/results/latex_tests/brace_in_index/res_latex/brace_in_index.tex
+++ b/tp/t/results/latex_tests/brace_in_index/res_latex/brace_in_index.tex
@@ -40,6 +40,9 @@
 % so it is turned off here, and turned on @def* lines
 \EmbracOff{}%
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/custom_headings/res_latex/custom_headings.tex 
b/tp/t/results/latex_tests/custom_headings/res_latex/custom_headings.tex
index 0567996bbc..7b928c2ba0 100644
--- a/tp/t/results/latex_tests/custom_headings/res_latex/custom_headings.tex
+++ b/tp/t/results/latex_tests/custom_headings/res_latex/custom_headings.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/enumerate_arguments/res_latex/enumerate_arguments.tex
 
b/tp/t/results/latex_tests/enumerate_arguments/res_latex/enumerate_arguments.tex
index 62e9bcf179..ac00ab88dd 100644
--- 
a/tp/t/results/latex_tests/enumerate_arguments/res_latex/enumerate_arguments.tex
+++ 
b/tp/t/results/latex_tests/enumerate_arguments/res_latex/enumerate_arguments.tex
@@ -33,6 +33,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/error_in_sectioning_command/res_latex/error_in_sectioning_command.tex
 
b/tp/t/results/latex_tests/error_in_sectioning_command/res_latex/error_in_sectioning_command.tex
index 104d4b11a9..5e54c38774 100644
--- 
a/tp/t/results/latex_tests/error_in_sectioning_command/res_latex/error_in_sectioning_command.tex
+++ 
b/tp/t/results/latex_tests/error_in_sectioning_command/res_latex/error_in_sectioning_command.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/example_in_cartouche/res_latex/example_in_cartouche.tex
 
b/tp/t/results/latex_tests/example_in_cartouche/res_latex/example_in_cartouche.tex
index 513676c0b6..798332c757 100644
--- 
a/tp/t/results/latex_tests/example_in_cartouche/res_latex/example_in_cartouche.tex
+++ 
b/tp/t/results/latex_tests/example_in_cartouche/res_latex/example_in_cartouche.tex
@@ -36,6 +36,9 @@
 innertopmargin=10pt, innerbottommargin=10pt,%
 roundcorner=10pt}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/float_and_refs/res_latex/float_and_refs.tex 
b/tp/t/results/latex_tests/float_and_refs/res_latex/float_and_refs.tex
index 8d30956ea7..48bdb3f7a0 100644
--- a/tp/t/results/latex_tests/float_and_refs/res_latex/float_and_refs.tex
+++ b/tp/t/results/latex_tests/float_and_refs/res_latex/float_and_refs.tex
@@ -35,6 +35,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/latex_tests/fonttextsize/res_latex/fonttextsize.tex 
b/tp/t/results/latex_tests/fonttextsize/res_latex/fonttextsize.tex
index 57255985c4..fc3d1ddbc5 100644
--- a/tp/t/results/latex_tests/fonttextsize/res_latex/fonttextsize.tex
+++ b/tp/t/results/latex_tests/fonttextsize/res_latex/fonttextsize.tex
@@ -30,6 +30,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/latex_tests/indices/res_latex/indices.tex 
b/tp/t/results/latex_tests/indices/res_latex/indices.tex
index 3dfc500889..407e614493 100644
--- a/tp/t/results/latex_tests/indices/res_latex/indices.tex
+++ b/tp/t/results/latex_tests/indices/res_latex/indices.tex
@@ -33,6 +33,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/informative_commands_in_top_node/res_latex/informative_commands_in_top_node.tex
 
b/tp/t/results/latex_tests/informative_commands_in_top_node/res_latex/informative_commands_in_top_node.tex
index 0fc0ca19fc..fa43f069a6 100644
--- 
a/tp/t/results/latex_tests/informative_commands_in_top_node/res_latex/informative_commands_in_top_node.tex
+++ 
b/tp/t/results/latex_tests/informative_commands_in_top_node/res_latex/informative_commands_in_top_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/nested_enumerate/res_latex/nested_enumerate.tex 
b/tp/t/results/latex_tests/nested_enumerate/res_latex/nested_enumerate.tex
index 167a3cbd15..e0aedf2779 100644
--- a/tp/t/results/latex_tests/nested_enumerate/res_latex/nested_enumerate.tex
+++ b/tp/t/results/latex_tests/nested_enumerate/res_latex/nested_enumerate.tex
@@ -33,6 +33,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/nested_itemize/res_latex/nested_itemize.tex 
b/tp/t/results/latex_tests/nested_itemize/res_latex/nested_itemize.tex
index a9026fe4ce..81c61882cb 100644
--- a/tp/t/results/latex_tests/nested_itemize/res_latex/nested_itemize.tex
+++ b/tp/t/results/latex_tests/nested_itemize/res_latex/nested_itemize.tex
@@ -33,6 +33,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_odd/res_latex/no_titlepage_and_setchapternewpage_odd.tex
 
b/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_odd/res_latex/no_titlepage_and_setchapternewpage_odd.tex
index 86fd8424c0..d12555ae07 100644
--- 
a/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_odd/res_latex/no_titlepage_and_setchapternewpage_odd.tex
+++ 
b/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_odd/res_latex/no_titlepage_and_setchapternewpage_odd.tex
@@ -32,6 +32,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_on/res_latex/no_titlepage_and_setchapternewpage_on.tex
 
b/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_on/res_latex/no_titlepage_and_setchapternewpage_on.tex
index e568b53e47..0901b67d69 100644
--- 
a/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_on/res_latex/no_titlepage_and_setchapternewpage_on.tex
+++ 
b/tp/t/results/latex_tests/no_titlepage_and_setchapternewpage_on/res_latex/no_titlepage_and_setchapternewpage_on.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/latex_tests/pagesizes/res_latex/pagesizes.tex 
b/tp/t/results/latex_tests/pagesizes/res_latex/pagesizes.tex
index 25065fb66b..3e82932990 100644
--- a/tp/t/results/latex_tests/pagesizes/res_latex/pagesizes.tex
+++ b/tp/t/results/latex_tests/pagesizes/res_latex/pagesizes.tex
@@ -30,6 +30,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/latex_tests/pagetype/res_latex/pagetype.tex 
b/tp/t/results/latex_tests/pagetype/res_latex/pagetype.tex
index bf437a6c33..f2763e1b7b 100644
--- a/tp/t/results/latex_tests/pagetype/res_latex/pagetype.tex
+++ b/tp/t/results/latex_tests/pagetype/res_latex/pagetype.tex
@@ -30,6 +30,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/setchapternewpage_on_odd_titlepage/res_latex/setchapternewpage_on_odd_titlepage.tex
 
b/tp/t/results/latex_tests/setchapternewpage_on_odd_titlepage/res_latex/setchapternewpage_on_odd_titlepage.tex
index 94fea39d1a..2be21f3f47 100644
--- 
a/tp/t/results/latex_tests/setchapternewpage_on_odd_titlepage/res_latex/setchapternewpage_on_odd_titlepage.tex
+++ 
b/tp/t/results/latex_tests/setchapternewpage_on_odd_titlepage/res_latex/setchapternewpage_on_odd_titlepage.tex
@@ -29,6 +29,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/settitle_and_headings/res_latex/settitle_and_headings.tex
 
b/tp/t/results/latex_tests/settitle_and_headings/res_latex/settitle_and_headings.tex
index 3b9e9e71fe..f31313f8fe 100644
--- 
a/tp/t/results/latex_tests/settitle_and_headings/res_latex/settitle_and_headings.tex
+++ 
b/tp/t/results/latex_tests/settitle_and_headings/res_latex/settitle_and_headings.tex
@@ -32,6 +32,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/shorttitlepage/res_latex/shorttitlepage.tex 
b/tp/t/results/latex_tests/shorttitlepage/res_latex/shorttitlepage.tex
index e45a19eca8..20be0c22f3 100644
--- a/tp/t/results/latex_tests/shorttitlepage/res_latex/shorttitlepage.tex
+++ b/tp/t/results/latex_tests/shorttitlepage/res_latex/shorttitlepage.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/three_setchapternewpage_on_odd_off/res_latex/three_setchapternewpage_on_odd_off.tex
 
b/tp/t/results/latex_tests/three_setchapternewpage_on_odd_off/res_latex/three_setchapternewpage_on_odd_off.tex
index b402a5f894..bdbab77501 100644
--- 
a/tp/t/results/latex_tests/three_setchapternewpage_on_odd_off/res_latex/three_setchapternewpage_on_odd_off.tex
+++ 
b/tp/t/results/latex_tests/three_setchapternewpage_on_odd_off/res_latex/three_setchapternewpage_on_odd_off.tex
@@ -32,6 +32,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_and_headings/res_latex/titlepage_and_headings.tex
 
b/tp/t/results/latex_tests/titlepage_and_headings/res_latex/titlepage_and_headings.tex
index c7cbc9a4a6..3b207eead1 100644
--- 
a/tp/t/results/latex_tests/titlepage_and_headings/res_latex/titlepage_and_headings.tex
+++ 
b/tp/t/results/latex_tests/titlepage_and_headings/res_latex/titlepage_and_headings.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_and_setchapternewpage_odd/res_latex/titlepage_and_setchapternewpage_odd.tex
 
b/tp/t/results/latex_tests/titlepage_and_setchapternewpage_odd/res_latex/titlepage_and_setchapternewpage_odd.tex
index 1d9ec80025..8373a5358e 100644
--- 
a/tp/t/results/latex_tests/titlepage_and_setchapternewpage_odd/res_latex/titlepage_and_setchapternewpage_odd.tex
+++ 
b/tp/t/results/latex_tests/titlepage_and_setchapternewpage_odd/res_latex/titlepage_and_setchapternewpage_odd.tex
@@ -29,6 +29,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_and_setchapternewpage_on/res_latex/titlepage_and_setchapternewpage_on.tex
 
b/tp/t/results/latex_tests/titlepage_and_setchapternewpage_on/res_latex/titlepage_and_setchapternewpage_on.tex
index 52cd20c6c6..ebe96bc131 100644
--- 
a/tp/t/results/latex_tests/titlepage_and_setchapternewpage_on/res_latex/titlepage_and_setchapternewpage_on.tex
+++ 
b/tp/t/results/latex_tests/titlepage_and_setchapternewpage_on/res_latex/titlepage_and_setchapternewpage_on.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_classical/res_latex/titlepage_classical.tex
 
b/tp/t/results/latex_tests/titlepage_classical/res_latex/titlepage_classical.tex
index 7c8560aebc..8ac5229444 100644
--- 
a/tp/t/results/latex_tests/titlepage_classical/res_latex/titlepage_classical.tex
+++ 
b/tp/t/results/latex_tests/titlepage_classical/res_latex/titlepage_classical.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_in_top_node/res_latex/titlepage_in_top_node.tex
 
b/tp/t/results/latex_tests/titlepage_in_top_node/res_latex/titlepage_in_top_node.tex
index c24f6edbc8..4a94892868 100644
--- 
a/tp/t/results/latex_tests/titlepage_in_top_node/res_latex/titlepage_in_top_node.tex
+++ 
b/tp/t/results/latex_tests/titlepage_in_top_node/res_latex/titlepage_in_top_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_long_title/res_latex/titlepage_long_title.tex
 
b/tp/t/results/latex_tests/titlepage_long_title/res_latex/titlepage_long_title.tex
index 7263b77ddc..9dc7ef44c4 100644
--- 
a/tp/t/results/latex_tests/titlepage_long_title/res_latex/titlepage_long_title.tex
+++ 
b/tp/t/results/latex_tests/titlepage_long_title/res_latex/titlepage_long_title.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_no_author/res_latex/titlepage_no_author.tex
 
b/tp/t/results/latex_tests/titlepage_no_author/res_latex/titlepage_no_author.tex
index ee8eeec3f0..4464202b5c 100644
--- 
a/tp/t/results/latex_tests/titlepage_no_author/res_latex/titlepage_no_author.tex
+++ 
b/tp/t/results/latex_tests/titlepage_no_author/res_latex/titlepage_no_author.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_no_title/res_latex/titlepage_no_title.tex 
b/tp/t/results/latex_tests/titlepage_no_title/res_latex/titlepage_no_title.tex
index 6faed429ac..bd8e295c67 100644
--- 
a/tp/t/results/latex_tests/titlepage_no_title/res_latex/titlepage_no_title.tex
+++ 
b/tp/t/results/latex_tests/titlepage_no_title/res_latex/titlepage_no_title.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/titlepage_with_commands_classical/res_latex/titlepage_with_commands_classical.tex
 
b/tp/t/results/latex_tests/titlepage_with_commands_classical/res_latex/titlepage_with_commands_classical.tex
index ceb341dbff..2e219ac97c 100644
--- 
a/tp/t/results/latex_tests/titlepage_with_commands_classical/res_latex/titlepage_with_commands_classical.tex
+++ 
b/tp/t/results/latex_tests/titlepage_with_commands_classical/res_latex/titlepage_with_commands_classical.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/two_setchapternewpage_odd_on/res_latex/two_setchapternewpage_odd_on.tex
 
b/tp/t/results/latex_tests/two_setchapternewpage_odd_on/res_latex/two_setchapternewpage_odd_on.tex
index 28a878fe00..06e4047a8c 100644
--- 
a/tp/t/results/latex_tests/two_setchapternewpage_odd_on/res_latex/two_setchapternewpage_odd_on.tex
+++ 
b/tp/t/results/latex_tests/two_setchapternewpage_odd_on/res_latex/two_setchapternewpage_odd_on.tex
@@ -32,6 +32,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/two_setchapternewpage_on_odd/res_latex/two_setchapternewpage_on_odd.tex
 
b/tp/t/results/latex_tests/two_setchapternewpage_on_odd/res_latex/two_setchapternewpage_on_odd.tex
index 963b0223cc..db0e37b6c0 100644
--- 
a/tp/t/results/latex_tests/two_setchapternewpage_on_odd/res_latex/two_setchapternewpage_on_odd.tex
+++ 
b/tp/t/results/latex_tests/two_setchapternewpage_on_odd/res_latex/two_setchapternewpage_on_odd.tex
@@ -32,6 +32,9 @@
 \newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/latex_tests/verbatim_in_smallformat/res_latex/verbatim_in_smallformat.tex
 
b/tp/t/results/latex_tests/verbatim_in_smallformat/res_latex/verbatim_in_smallformat.tex
index 450dbebb05..96441755d7 100644
--- 
a/tp/t/results/latex_tests/verbatim_in_smallformat/res_latex/verbatim_in_smallformat.tex
+++ 
b/tp/t/results/latex_tests/verbatim_in_smallformat/res_latex/verbatim_in_smallformat.tex
@@ -30,6 +30,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl 
b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
index ac2ca9d217..aa47c60c21 100644
--- a/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
+++ b/tp/t/results/misc_commands/codequoteundirected_codequotebacktick.pl
@@ -5409,6 +5409,9 @@ 
$result_converted{'latex'}->{'codequoteundirected_codequotebacktick'} = '\\docum
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/command_in_heading_footing.pl 
b/tp/t/results/misc_commands/command_in_heading_footing.pl
index 643f910e87..95c3cc3c7e 100644
--- a/tp/t/results/misc_commands/command_in_heading_footing.pl
+++ b/tp/t/results/misc_commands/command_in_heading_footing.pl
@@ -246,6 +246,9 @@ $result_converted{'latex'}->{'command_in_heading_footing'} 
= '\\documentclass{bo
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/comment_space_command_on_line.pl 
b/tp/t/results/misc_commands/comment_space_command_on_line.pl
index aa6eb8837a..a6da7b8d0e 100644
--- a/tp/t/results/misc_commands/comment_space_command_on_line.pl
+++ b/tp/t/results/misc_commands/comment_space_command_on_line.pl
@@ -1155,6 +1155,9 @@ 
$result_converted{'latex'}->{'comment_space_command_on_line'} = '\\documentclass
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/comments_in_text.pl 
b/tp/t/results/misc_commands/comments_in_text.pl
index 8cd3070444..0031d75694 100644
--- a/tp/t/results/misc_commands/comments_in_text.pl
+++ b/tp/t/results/misc_commands/comments_in_text.pl
@@ -245,6 +245,9 @@ $result_converted{'latex'}->{'comments_in_text'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/definfoenclose.pl 
b/tp/t/results/misc_commands/definfoenclose.pl
index 009adf5f1e..081d13427b 100644
--- a/tp/t/results/misc_commands/definfoenclose.pl
+++ b/tp/t/results/misc_commands/definfoenclose.pl
@@ -504,6 +504,9 @@ $result_converted{'latex'}->{'definfoenclose'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/definfoenclose_with_empty_arg.pl 
b/tp/t/results/misc_commands/definfoenclose_with_empty_arg.pl
index 19473ca66a..e881748f81 100644
--- a/tp/t/results/misc_commands/definfoenclose_with_empty_arg.pl
+++ b/tp/t/results/misc_commands/definfoenclose_with_empty_arg.pl
@@ -196,6 +196,9 @@ 
$result_converted{'latex'}->{'definfoenclose_with_empty_arg'} = '\\documentclass
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/empty_center.pl 
b/tp/t/results/misc_commands/empty_center.pl
index f059b3957a..9bd2a2a710 100644
--- a/tp/t/results/misc_commands/empty_center.pl
+++ b/tp/t/results/misc_commands/empty_center.pl
@@ -103,6 +103,9 @@ $result_converted{'latex'}->{'empty_center'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/empty_center_with_arg.pl 
b/tp/t/results/misc_commands/empty_center_with_arg.pl
index 056358f702..47f9a26695 100644
--- a/tp/t/results/misc_commands/empty_center_with_arg.pl
+++ b/tp/t/results/misc_commands/empty_center_with_arg.pl
@@ -113,6 +113,9 @@ $result_converted{'latex'}->{'empty_center_with_arg'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/footnote_in_center.pl 
b/tp/t/results/misc_commands/footnote_in_center.pl
index b75cf00a77..016f804c51 100644
--- a/tp/t/results/misc_commands/footnote_in_center.pl
+++ b/tp/t/results/misc_commands/footnote_in_center.pl
@@ -383,6 +383,9 @@ $result_converted{'latex'}->{'footnote_in_center'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/heading_command_in_commands.pl 
b/tp/t/results/misc_commands/heading_command_in_commands.pl
index d090cdc7ea..020c594c38 100644
--- a/tp/t/results/misc_commands/heading_command_in_commands.pl
+++ b/tp/t/results/misc_commands/heading_command_in_commands.pl
@@ -374,6 +374,9 @@ $result_converted{'latex'}->{'heading_command_in_commands'} 
= '\\documentclass{b
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/incorrect_allowcodebreaks_argument.pl 
b/tp/t/results/misc_commands/incorrect_allowcodebreaks_argument.pl
index b20a8dab2e..1d1f2a93e5 100644
--- a/tp/t/results/misc_commands/incorrect_allowcodebreaks_argument.pl
+++ b/tp/t/results/misc_commands/incorrect_allowcodebreaks_argument.pl
@@ -150,6 +150,9 @@ 
$result_converted{'latex'}->{'incorrect_allowcodebreaks_argument'} = '\\document
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/indent_in_quotation.pl 
b/tp/t/results/misc_commands/indent_in_quotation.pl
index abccfc2247..f8f3ad353a 100644
--- a/tp/t/results/misc_commands/indent_in_quotation.pl
+++ b/tp/t/results/misc_commands/indent_in_quotation.pl
@@ -164,6 +164,9 @@ $result_converted{'latex'}->{'indent_in_quotation'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/kbdinputstyle.pl 
b/tp/t/results/misc_commands/kbdinputstyle.pl
index 789e513429..c102c6d388 100644
--- a/tp/t/results/misc_commands/kbdinputstyle.pl
+++ b/tp/t/results/misc_commands/kbdinputstyle.pl
@@ -2222,6 +2222,9 @@ $result_converted{'latex'}->{'kbdinputstyle'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/kbdinputstyle_in_table.pl 
b/tp/t/results/misc_commands/kbdinputstyle_in_table.pl
index 2eb7bbf402..596f429e89 100644
--- a/tp/t/results/misc_commands/kbdinputstyle_in_table.pl
+++ b/tp/t/results/misc_commands/kbdinputstyle_in_table.pl
@@ -2406,6 +2406,9 @@ $result_converted{'latex'}->{'kbdinputstyle_in_table'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/no_empty_line_between_headings.pl 
b/tp/t/results/misc_commands/no_empty_line_between_headings.pl
index 5471121a6f..930815087b 100644
--- a/tp/t/results/misc_commands/no_empty_line_between_headings.pl
+++ b/tp/t/results/misc_commands/no_empty_line_between_headings.pl
@@ -276,6 +276,9 @@ 
$result_converted{'latex'}->{'no_empty_line_between_headings'} = '\\documentclas
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/noindent_after_smallexample.pl 
b/tp/t/results/misc_commands/noindent_after_smallexample.pl
index 11414a7012..bd138ed294 100644
--- a/tp/t/results/misc_commands/noindent_after_smallexample.pl
+++ b/tp/t/results/misc_commands/noindent_after_smallexample.pl
@@ -209,6 +209,9 @@ $result_converted{'latex'}->{'noindent_after_smallexample'} 
= '\\documentclass{b
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/noindent_empty_para.pl 
b/tp/t/results/misc_commands/noindent_empty_para.pl
index 1859d42493..2bff7b3526 100644
--- a/tp/t/results/misc_commands/noindent_empty_para.pl
+++ b/tp/t/results/misc_commands/noindent_empty_para.pl
@@ -112,6 +112,9 @@ $result_converted{'latex'}->{'noindent_empty_para'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/noindent_in_paragraph.pl 
b/tp/t/results/misc_commands/noindent_in_paragraph.pl
index 43457a6c37..7f5c8f9ce0 100644
--- a/tp/t/results/misc_commands/noindent_in_paragraph.pl
+++ b/tp/t/results/misc_commands/noindent_in_paragraph.pl
@@ -166,6 +166,9 @@ $result_converted{'latex'}->{'noindent_in_paragraph'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/noindent_indent.pl 
b/tp/t/results/misc_commands/noindent_indent.pl
index e414b6b438..c58843751a 100644
--- a/tp/t/results/misc_commands/noindent_indent.pl
+++ b/tp/t/results/misc_commands/noindent_indent.pl
@@ -268,6 +268,9 @@ $result_converted{'latex'}->{'noindent_indent'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/ref_in_center.pl 
b/tp/t/results/misc_commands/ref_in_center.pl
index b6e69fe0b1..e856799b61 100644
--- a/tp/t/results/misc_commands/ref_in_center.pl
+++ b/tp/t/results/misc_commands/ref_in_center.pl
@@ -557,6 +557,9 @@ $result_converted{'latex'}->{'ref_in_center'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/setfilename.pl 
b/tp/t/results/misc_commands/setfilename.pl
index 987ea4c09c..88cc2ed6ac 100644
--- a/tp/t/results/misc_commands/setfilename.pl
+++ b/tp/t/results/misc_commands/setfilename.pl
@@ -332,6 +332,9 @@ $result_converted{'latex'}->{'setfilename'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/test_allowcodebreaks.pl 
b/tp/t/results/misc_commands/test_allowcodebreaks.pl
index 724070e5c6..e3767bc9af 100644
--- a/tp/t/results/misc_commands/test_allowcodebreaks.pl
+++ b/tp/t/results/misc_commands/test_allowcodebreaks.pl
@@ -2772,6 +2772,9 @@ $result_converted{'latex'}->{'test_allowcodebreaks'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/misc_commands/vskip.pl 
b/tp/t/results/misc_commands/vskip.pl
index c344ab97f3..0d7d27b475 100644
--- a/tp/t/results/misc_commands/vskip.pl
+++ b/tp/t/results/misc_commands/vskip.pl
@@ -88,6 +88,9 @@ $result_converted{'latex'}->{'vskip'} = '\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/quotation/empty_quotation.pl 
b/tp/t/results/quotation/empty_quotation.pl
index d93644718d..319b0693fc 100644
--- a/tp/t/results/quotation/empty_quotation.pl
+++ b/tp/t/results/quotation/empty_quotation.pl
@@ -399,6 +399,9 @@ $result_converted{'latex'}->{'empty_quotation'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/quotation/quotation_and_author.pl 
b/tp/t/results/quotation/quotation_and_author.pl
index 78fc6763a6..ff088a0adc 100644
--- a/tp/t/results/quotation/quotation_and_author.pl
+++ b/tp/t/results/quotation/quotation_and_author.pl
@@ -547,6 +547,9 @@ $result_converted{'latex'}->{'quotation_and_author'} = 
'\\documentclass{book}
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/quotation/quotation_author_in_example.pl 
b/tp/t/results/quotation/quotation_author_in_example.pl
index 80c727e436..57fa37928c 100644
--- a/tp/t/results/quotation/quotation_author_in_example.pl
+++ b/tp/t/results/quotation/quotation_author_in_example.pl
@@ -260,6 +260,9 @@ $result_converted{'latex'}->{'quotation_author_in_example'} 
= '\\documentclass{b
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git a/tp/t/results/quotation/space_at_commands_end_quotation_line.pl 
b/tp/t/results/quotation/space_at_commands_end_quotation_line.pl
index 6f8703ac4b..3cecc15787 100644
--- a/tp/t/results/quotation/space_at_commands_end_quotation_line.pl
+++ b/tp/t/results/quotation/space_at_commands_end_quotation_line.pl
@@ -334,6 +334,9 @@ 
$result_converted{'latex'}->{'space_at_commands_end_quotation_line'} = '\\docume
 \\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{} 
\\chaptertitle{}][][\\thepage]
                               {\\chaptername{} \\thechapter{} 
\\chaptertitle{}}{}{\\thepage}}
 
+% allow line breaking at underscore
+\\let\\GNUTexinfounderscore\\_
+\\renewcommand{\\_}{\\GNUTexinfounderscore\\discretionary{}{}{}}
 \\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
 
 \\makeatother
diff --git 
a/tp/t/results/sectioning/chapter_between_nodes/res_latex/chapter_between_nodes.tex
 
b/tp/t/results/sectioning/chapter_between_nodes/res_latex/chapter_between_nodes.tex
index dfa1b904f0..89a084738d 100644
--- 
a/tp/t/results/sectioning/chapter_between_nodes/res_latex/chapter_between_nodes.tex
+++ 
b/tp/t/results/sectioning/chapter_between_nodes/res_latex/chapter_between_nodes.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/sectioning/lone_Top_node/res_latex/lone_Top_node.tex 
b/tp/t/results/sectioning/lone_Top_node/res_latex/lone_Top_node.tex
index 002a2dbd83..c789a58ee5 100644
--- a/tp/t/results/sectioning/lone_Top_node/res_latex/lone_Top_node.tex
+++ b/tp/t/results/sectioning/lone_Top_node/res_latex/lone_Top_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex 
b/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
index 46752e8c39..bc53d05aa7 100644
--- a/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
+++ b/tp/t/results/sectioning/loop_nodes/res_latex/loop_nodes.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/node_sectop_before_chapter_no_node/res_latex/node_sectop_before_chapter_no_node.tex
 
b/tp/t/results/sectioning/node_sectop_before_chapter_no_node/res_latex/node_sectop_before_chapter_no_node.tex
index 6a3a9d5747..bb12ff614c 100644
--- 
a/tp/t/results/sectioning/node_sectop_before_chapter_no_node/res_latex/node_sectop_before_chapter_no_node.tex
+++ 
b/tp/t/results/sectioning/node_sectop_before_chapter_no_node/res_latex/node_sectop_before_chapter_no_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/node_sectop_before_lone_node_Top/res_latex/node_sectop_before_lone_node_Top.tex
 
b/tp/t/results/sectioning/node_sectop_before_lone_node_Top/res_latex/node_sectop_before_lone_node_Top.tex
index 9f3994c9f0..cdae126877 100644
--- 
a/tp/t/results/sectioning/node_sectop_before_lone_node_Top/res_latex/node_sectop_before_lone_node_Top.tex
+++ 
b/tp/t/results/sectioning/node_sectop_before_lone_node_Top/res_latex/node_sectop_before_lone_node_Top.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
 
b/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
index cfcfa5c45d..a7f7283554 100644
--- 
a/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
+++ 
b/tp/t/results/sectioning/nodes_before_after_top/res_latex/nodes_before_after_top.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/nodes_before_after_top_xref/res_latex/nodes_before_after_top_xref.tex
 
b/tp/t/results/sectioning/nodes_before_after_top_xref/res_latex/nodes_before_after_top_xref.tex
index ef9a0803b8..2a6826974e 100644
--- 
a/tp/t/results/sectioning/nodes_before_after_top_xref/res_latex/nodes_before_after_top_xref.tex
+++ 
b/tp/t/results/sectioning/nodes_before_after_top_xref/res_latex/nodes_before_after_top_xref.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/nodes_before_top/res_latex/nodes_before_top.tex 
b/tp/t/results/sectioning/nodes_before_top/res_latex/nodes_before_top.tex
index 66757d0d66..a15dca0666 100644
--- a/tp/t/results/sectioning/nodes_before_top/res_latex/nodes_before_top.tex
+++ b/tp/t/results/sectioning/nodes_before_top/res_latex/nodes_before_top.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/section_before_after_top_node/res_latex/section_before_after_top_node.tex
 
b/tp/t/results/sectioning/section_before_after_top_node/res_latex/section_before_after_top_node.tex
index 6b597eb4f7..38f1082090 100644
--- 
a/tp/t/results/sectioning/section_before_after_top_node/res_latex/section_before_after_top_node.tex
+++ 
b/tp/t/results/sectioning/section_before_after_top_node/res_latex/section_before_after_top_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
 
b/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
index fd4992c7e3..bb322cc09c 100644
--- 
a/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
+++ 
b/tp/t/results/sectioning/section_before_after_top_node_last_node/res_latex/section_before_after_top_node_last_node.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/section_chapter_before_top_nodes/res_latex/section_chapter_before_top_nodes.tex
 
b/tp/t/results/sectioning/section_chapter_before_top_nodes/res_latex/section_chapter_before_top_nodes.tex
index 7cf7a6a193..1656fa9dda 100644
--- 
a/tp/t/results/sectioning/section_chapter_before_top_nodes/res_latex/section_chapter_before_top_nodes.tex
+++ 
b/tp/t/results/sectioning/section_chapter_before_top_nodes/res_latex/section_chapter_before_top_nodes.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/sectioning/top_node_part_top/res_latex/top_node_part_top.tex 
b/tp/t/results/sectioning/top_node_part_top/res_latex/top_node_part_top.tex
index 72d6467741..b95b83764f 100644
--- a/tp/t/results/sectioning/top_node_part_top/res_latex/top_node_part_top.tex
+++ b/tp/t/results/sectioning/top_node_part_top/res_latex/top_node_part_top.tex
@@ -29,6 +29,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/xtable/inter_item_commands_in_table/res_latex/inter_item_commands_in_table.tex
 
b/tp/t/results/xtable/inter_item_commands_in_table/res_latex/inter_item_commands_in_table.tex
index f2d745d167..126e1bdecf 100644
--- 
a/tp/t/results/xtable/inter_item_commands_in_table/res_latex/inter_item_commands_in_table.tex
+++ 
b/tp/t/results/xtable/inter_item_commands_in_table/res_latex/inter_item_commands_in_table.tex
@@ -44,6 +44,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/t/results/xtable/inter_item_commands_in_table_in_example/res_latex/inter_item_commands_in_table_in_example.tex
 
b/tp/t/results/xtable/inter_item_commands_in_table_in_example/res_latex/inter_item_commands_in_table_in_example.tex
index b1dc715a3a..1a83573ceb 100644
--- 
a/tp/t/results/xtable/inter_item_commands_in_table_in_example/res_latex/inter_item_commands_in_table_in_example.tex
+++ 
b/tp/t/results/xtable/inter_item_commands_in_table_in_example/res_latex/inter_item_commands_in_table_in_example.tex
@@ -40,6 +40,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
"a/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.tex" 
"b/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.tex"
index e9a5cbb3d2..a5c6e95cc0 100644
--- "a/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.tex"
+++ "b/tp/tests/formatting/res_parser/non_ascii_test_latex/os\303\251_utf8.tex"
@@ -30,6 +30,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/tests/indices/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
 
b/tp/tests/indices/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
index 2fafb7644d..c8d164dcb4 100644
--- 
a/tp/tests/indices/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
+++ 
b/tp/tests/indices/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
@@ -46,6 +46,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git 
a/tp/tests/indices/res_parser_info/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
 
b/tp/tests/indices/res_parser_info/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
index 2fafb7644d..c8d164dcb4 100644
--- 
a/tp/tests/indices/res_parser_info/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
+++ 
b/tp/tests/indices/res_parser_info/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.tex
@@ -46,6 +46,9 @@
 \newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
                               {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother
diff --git a/tp/tests/layout/res_parser/formatting_latex/formatting.tex 
b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
index 433fc69b94..8f51e3ef59 100644
--- a/tp/tests/layout/res_parser/formatting_latex/formatting.tex
+++ b/tp/tests/layout/res_parser/formatting_latex/formatting.tex
@@ -73,6 +73,9 @@ roundcorner=10pt}
 % so it is turned off here, and turned on @def* lines
 \EmbracOff{}%
 
+% allow line breaking at underscore
+\let\GNUTexinfounderscore\_
+\renewcommand{\_}{\GNUTexinfounderscore\discretionary{}{}{}}
 \renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
 
 \makeatother



reply via email to

[Prev in Thread] Current Thread [Next in Thread]