[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_convert): when ig
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_convert): when ignoring Top node, generate @float and @anchor \label if directly in main document. |
Date: |
Fri, 29 Jul 2022 11:32:37 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new e889387f40 * tp/Texinfo/Convert/LaTeX.pm (_convert): when ignoring Top
node, generate @float and @anchor \label if directly in main document.
e889387f40 is described below
commit e889387f4051ce945a2011f06603a2ac3f235cec
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Jul 29 17:32:25 2022 +0200
* tp/Texinfo/Convert/LaTeX.pm (_convert): when ignoring
Top node, generate @float and @anchor \label if directly
in main document.
---
ChangeLog | 6 +++
tp/Texinfo/Convert/LaTeX.pm | 63 +++++++++++-----------
tp/t/converters_tests.t | 3 ++
.../res_latex/references_to_top_no_top_output.tex | 2 +
4 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f576c8f9e4..5eb702410e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-07-29 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/LaTeX.pm (_convert): when ignoring
+ Top node, generate @float and @anchor \label if directly
+ in main document.
+
2022-07-29 Patrice Dumas <pertusus@free.fr>
Fix NO_TOP_NODE_OUTPUT and title page formatting reference
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 3260a23815..d6b4598910 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -53,13 +53,10 @@
# @def* body in Texinfo TeX is narrower than the @def* line. The
# difference is more marked for @def* within a @*table or @quotation.
# Also Texinfo TeX leaves more space for the category on the right
-# if the def line is too long.
-#
-# Upright parentheses and brackets on @def* lines.
-# Could use
https://mirror.mwt.me/ctan/macros/latex/contrib/embrac/embrac_en.pdf
-# with \EmbracOff and \EmbracOn. Font is the surrounding text font.
-#
-# @deftype* in typewriter, not slanted. Other @def* in typewriter and slanted.
+# if the def line is too long. If the category is formatted with
+# @tie{}, like Escape@tie{}sequence, with Texinfo TeX the space is
+# more or less a normal space, with LaTeX, the space has shrinked so
+# much it seems that the two words are glued together.
#
# There is something about form feeds to do. There is some processing of form
# feeds right now, which simply amounts to keeping them in ignorable spaces
@@ -2211,7 +2208,9 @@ sub _convert($$)
delete $self->{'formatting_context'}->[-1]->{'in_skipped_node_top'};
} elsif (! defined($cmdname)
or (not ($informative_commands{$cmdname}
- or $sectioning_heading_commands{$cmdname}))) {
+ or $sectioning_heading_commands{$cmdname}
+ or $cmdname eq 'float'
+ or $cmdname eq 'anchor'))) {
return '';
}
}
@@ -3097,17 +3096,19 @@ sub _convert($$)
$result .= join(' ', map {'m{'.$_.'\textwidth}'} @fractions);
$result .= "}%\n";
} elsif ($cmdname eq 'float') {
- my $normalized_float_type = '';
- if ($element->{'extra'}->{'type'}) {
- $normalized_float_type =
$element->{'extra'}->{'type'}->{'normalized'};
- }
- if (not
exists($self->{'normalized_float_latex'}->{$normalized_float_type})) {
- cluck("\@float $normalized_float_type: not found\n");
- return '';
+ if (not $self->{'formatting_context'}->[-1]->{'in_skipped_node_top'}) {
+ my $normalized_float_type = '';
+ if ($element->{'extra'}->{'type'}) {
+ $normalized_float_type =
$element->{'extra'}->{'type'}->{'normalized'};
+ }
+ if (not
exists($self->{'normalized_float_latex'}->{$normalized_float_type})) {
+ cluck("\@float $normalized_float_type: not found\n");
+ return '';
+ }
+ my $latex_float_name =
$self->{'normalized_float_latex'}->{$normalized_float_type};
+ _push_new_context($self, 'float'.$latex_float_name);
+ $result .= "\\begin{$latex_float_name}\n";
}
- my $latex_float_name =
$self->{'normalized_float_latex'}->{$normalized_float_type};
- _push_new_context($self, 'float'.$latex_float_name);
- $result .= "\\begin{$latex_float_name}\n";
}
} elsif ($cmdname eq 'node' or $sectioning_heading_commands{$cmdname}) {
my $node_element;
@@ -3648,15 +3649,6 @@ sub _convert($$)
_close_preformatted_command($self, $cmdname);
}
if ($cmdname eq 'float') {
- my $normalized_float_type = '';
- if ($element->{'extra'}->{'type'}) {
- $normalized_float_type = $element->{'extra'}->{'type'}->{'normalized'};
- }
- # this should never happen as we returned at the command
- # open. If this happens it means that the tree has been modified...
- if (not
exists($self->{'normalized_float_latex'}->{$normalized_float_type})) {
- confess("\@float $normalized_float_type: not found\n");
- }
# do that at the end of the float to be sure that it is after
# the caption
if ($element->{'extra'} and $element->{'extra'}->{'node_content'}) {
@@ -3664,9 +3656,20 @@ sub _convert($$)
= _tree_anchor_label($element->{'extra'}->{'node_content'});
$result .= "\\label{$float_label}%\n";
}
- my $latex_float_name =
$self->{'normalized_float_latex'}->{$normalized_float_type};
- $result .= "\\end{$latex_float_name}\n";
- _pop_context($self);
+ if (not $self->{'formatting_context'}->[-1]->{'in_skipped_node_top'}) {
+ my $normalized_float_type = '';
+ if ($element->{'extra'}->{'type'}) {
+ $normalized_float_type =
$element->{'extra'}->{'type'}->{'normalized'};
+ }
+ # this should never happen as we returned at the command
+ # open. If this happens it means that the tree has been modified...
+ if (not
exists($self->{'normalized_float_latex'}->{$normalized_float_type})) {
+ confess("\@float $normalized_float_type: not found\n");
+ }
+ my $latex_float_name =
$self->{'normalized_float_latex'}->{$normalized_float_type};
+ $result .= "\\end{$latex_float_name}\n";
+ _pop_context($self);
+ }
} elsif ($cmdname eq 'quotation'
or $cmdname eq 'smallquotation') {
if ($element->{'extra'} and $element->{'extra'}->{'authors'}) {
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index 5e37672ca3..c3fc9e2b1b 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -918,6 +918,9 @@ $top_in_ref_text,
['non_empty_part_no_top_node_output',
$non_empty_part_text,
{}, {'NO_TOP_NODE_OUTPUT' => 1}],
+# the float defined in Top node is shown in the @listoffloats.
+# It would probably be better not to, but it is not simple to
+# do, so leave it.
['references_to_top_no_top_output',
'
@setfilename references_to_top_no_top_output.info
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 9c870fb989..3f1dde2959 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
@@ -65,6 +65,8 @@
\begin{document}
\label{anchor:Top}%
+\label{anchor:a-in-top}%
+\label{anchor:My-Flist}%
\chapter{Chap}
\label{anchor:chapter}%
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_convert): when ignoring Top node, generate @float and @anchor \label if directly in main document.,
Patrice Dumas <=