texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: @firstparagraphindent in LaTeX


From: Gavin D. Smith
Subject: branch master updated: @firstparagraphindent in LaTeX
Date: Mon, 01 Aug 2022 18:56:06 -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 3f49f11bba @firstparagraphindent in LaTeX
3f49f11bba is described below

commit 3f49f11bba0f4f27f573765e9b2283b39a9f998a
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Aug 1 23:55:37 2022 +0100

    @firstparagraphindent in LaTeX
    
    * tp/Texinfo/Convert/LaTeX.pm (_convert): Use idea from
    indentfirst LaTeX package to implement @firstparagraphindent.
    * tp/Texinfo/Convert/LaTeX.pm: Remove @firstparagraphindent
    from TODO list, as well as @indent, which was different in
    texinfo.tex due to @firstparagraphindent definition.
---
 ChangeLog                   | 10 ++++++++++
 tp/Texinfo/Convert/LaTeX.pm | 28 ++++++++++++++++------------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 19fed60a53..5190d354d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-08-01  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       @firstparagraphindent in LaTeX
+
+       * tp/Texinfo/Convert/LaTeX.pm (_convert): Use idea from
+       indentfirst LaTeX package to implement @firstparagraphindent.
+       * tp/Texinfo/Convert/LaTeX.pm: Remove @firstparagraphindent
+       from TODO list, as well as @indent, which was different in
+       texinfo.tex due to @firstparagraphindent definition.
+
 2022-08-01  Gavin Smith  <gavinsmith0123@gmail.com>
 
        @dmn in LaTeX
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index e55c463bae..86c0e02be6 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -28,16 +28,8 @@
 #\tableofcontents
 #}
 #
-# it seems that LaTeX \indent only works with \setlength{\parindent}{0pt}
-# which makes it quite different from Texinfo @indent which should require
-# a different conversion
-#
 # @exdent is not implemented
 #
-# There is no obvious way to change the first paragraph indentation
-# in a way that can be reverted as with @firstparagraphindent.
-# use of \usepackage{indentfirst} cannot be reverted.
-#
 # flushleft and flushright
 # the flushleft and flushright in Texinfo are not the same as in
 # LaTeX, as, in addition to come from a possibly different margin,
@@ -3431,10 +3423,6 @@ sub _convert($$)
       }
       return $result;
     # @-commands that have an information for the formatting
-    # TODO
-    # There is no obvious way to change the first paragraph indentation
-    # in a way that can be reverted as with @firstparagraphindent.
-    # use of \usepackage{indentfirst} cannot be reverted.
     } elsif ($informative_commands{$cmdname}) {
 
       Texinfo::Common::set_informative_command_value($self, $element);
@@ -3473,6 +3461,22 @@ sub _convert($$)
           }
           $result .= "\\setlength{\\parindent}{$indentation_spec_arg}\n";
         }
+      } elsif ($cmdname eq 'firstparagraphindent'
+          and $element->{'extra'}->{'misc_args'}->[0]) {
+        my $indentation_spec = $element->{'extra'}->{'misc_args'}->[0];
+        $result .= "\\makeatletter\n";
+        if ($indentation_spec eq 'insert') {
+          # From LaTeX indentfirst package: "LaTeX uses the switch
+          # \if@afterindent to decide whether to indent after a section
+          # heading. We just need to make sure that this is always true."
+          $result .= "\\let\\\@afterindentfalse\\\@afterindenttrue\n";
+          $result .= "\\\@afterindenttrue\n";
+        } elsif ($indentation_spec eq 'none') {
+          # restore original definition
+          $result .= '\\def\\@afterindentfalse{'
+                     . "\\let\\if\@afterindent\\iffalse}\n";
+        }
+        $result .= "\\makeatother\n";
       } elsif ($cmdname eq 'frenchspacing'
                and $element->{'extra'}->{'misc_args'}->[0]) {
         my $frenchspacing_spec = $element->{'extra'}->{'misc_args'}->[0];



reply via email to

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