[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_latex_header), do
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_latex_header), doc/texinfo.texi (@LaTeX{} Customization Variables), tp/Texinfo/Common.pm (@variable_string_settables): add experimental LaTeX documentclass and packages customization, using two customization variables, CLASS_BEGIN_USEPACKAGE and END_USEPACKAGE. |
Date: |
Tue, 27 Dec 2022 06:42:43 -0500 |
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 e5b8d589ec * tp/Texinfo/Convert/LaTeX.pm (_latex_header),
doc/texinfo.texi (@LaTeX{} Customization Variables), tp/Texinfo/Common.pm
(@variable_string_settables): add experimental LaTeX documentclass and packages
customization, using two customization variables, CLASS_BEGIN_USEPACKAGE and
END_USEPACKAGE.
e5b8d589ec is described below
commit e5b8d589ec56e2a13e3da630065b402590f80555
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 27 12:42:32 2022 +0100
* tp/Texinfo/Convert/LaTeX.pm (_latex_header), doc/texinfo.texi
(@LaTeX{} Customization Variables), tp/Texinfo/Common.pm
(@variable_string_settables): add experimental LaTeX documentclass and
packages customization, using two customization variables,
CLASS_BEGIN_USEPACKAGE and END_USEPACKAGE.
---
ChangeLog | 8 +++
doc/texinfo.texi | 58 ++++++++++++++++++++
tp/Texinfo/Common.pm | 2 +
tp/Texinfo/Convert/LaTeX.pm | 125 +++++++++++++++++++++++---------------------
4 files changed, 132 insertions(+), 61 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5626abc61f..880b4c8b39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-12-27 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/LaTeX.pm (_latex_header), doc/texinfo.texi
+ (@LaTeX{} Customization Variables), tp/Texinfo/Common.pm
+ (@variable_string_settables): add experimental LaTeX documentclass and
+ packages customization, using two customization variables,
+ CLASS_BEGIN_USEPACKAGE and END_USEPACKAGE.
+
2022-12-27 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): format @bye line
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index f8cfdb9347..22f6d17872 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16710,6 +16710,64 @@ defined.
@end vtable
+@node @LaTeX{} Customization Variables
+@subsection @LaTeX{} Customization Variables
+
+@cartouche
+@quotation warning
+@LaTeX{} output customization is experimental. Nothing is decided,
+everything can change, and we would welcome any feedback.
+@end quotation
+@end cartouche
+
+This table gives the customization variables which apply to @LaTeX{} output
+only.
+
+@vtable @code
+@item CLASS_BEGIN_USEPACKAGE
+If set, the corresponding text will replace the @LaTeX{} @code{\documentclass},
+package imports that are always output and are output right after
+@code{\documentclass}, and package imports that depend on the document encoding
+setting the input and font encoding (@code{inputenc} and @code{fontenc}).
+
+The text replaced is along:
+@example LaTeX
+\documentclass@{book@}
+\usepackage@{amsfonts@}
+\usepackage@{amsmath@}
+\usepackage[gen]@{eurosym@}
+\usepackage@{textcomp@}
+\usepackage@{graphicx@}
+\usepackage@{etoolbox@}
+\usepackage@{titleps@}
+\usepackage[utf8]@{inputenc@}
+\usepackage[T1]@{fontenc@}
+@end example
+
+@item END_USEPACKAGE
+If set, the corresponding text will replace the package imports that depend
+on the Texinfo commands used, and the last packages imports that are always
+output and output after all the other packages imports. The last package
+imports corresponds to @samp{\usepackage[hidelinks]@{hyperref@}}.
+
+Here is an example of the corresponding text for a document with indices,
+@code{@@need}, @code{@@multitable}, definition commands, @code{@@cartouche},
+lists, and @code{@@float}:
+@example LaTeX
+\usepackage@{imakeidx@}
+\usepackage@{needspace@}
+\usepackage@{array@}
+\usepackage@{embrac@}
+\usepackage@{expl3@}
+\usepackage@{tabularx@}
+\usepackage[framemethod=tikz]@{mdframed@}
+\usepackage@{enumitem@}
+\usepackage@{float@}
+\usepackage[hidelinks]@{hyperref@}
+@end example
+@end vtable
+
+
@node Other Customization Variables
@subsection Other Customization Variables
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 322cac45d1..6683eb5c3f 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -345,6 +345,7 @@ our @variable_string_settables = (
'BEFORE_TOC_LINES',
'BIG_RULE',
'BODYTEXT',
+'CLASS_BEGIN_USEPACKAGE', # for LaTeX
'COPIABLE_LINKS',
'CHAPTER_HEADER_LEVEL',
'CHECK_HTMLXREF',
@@ -360,6 +361,7 @@ our @variable_string_settables = (
'DOC_ENCODING_FOR_INPUT_FILE_NAME',
'DOC_ENCODING_FOR_OUTPUT_FILE_NAME',
'DOCTYPE',
+'END_USEPACKAGE', # for LaTeX
'EPUB_CREATE_CONTAINER_FILE', # for ext/epub3.pm
'EPUB_KEEP_CONTAINER_FOLDER', # for ext/epub3.pm
'EXTENSION',
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index b1cb349906..ef9485c581 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1526,8 +1526,10 @@ roundcorner=10pt}
# \usepackage[linkbordercolor={0 0 0}]{hyperref}
# titleps is used and not fancyhdr as with fancyhdr it is hard to get
# the section or chapter title
- my $header = "\\documentclass{$documentclass}\n";
- $header .= '\usepackage{amsfonts}
+ my $class_and_usepackage_begin = $self->get_conf('CLASS_BEGIN_USEPACKAGE');
+ if (!defined($class_and_usepackage_begin)) {
+ $class_and_usepackage_begin = "\\documentclass{$documentclass}\n";
+ $class_and_usepackage_begin .= '\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage[gen]{eurosym}
\usepackage{textcomp}
@@ -1535,69 +1537,70 @@ roundcorner=10pt}
\usepackage{etoolbox}
\usepackage{titleps}
';
- my $fontenc = 'T1';
- if ($self->{'output_encoding_name'}) {
- my $output_encoding = $self->{'output_encoding_name'};
- my $encoding = $output_encoding;
- if (defined($LaTeX_encoding_names_map{$output_encoding})) {
- ($encoding, $fontenc) = @{$LaTeX_encoding_names_map{$output_encoding}};
+ my $fontenc = 'T1';
+ if ($self->{'output_encoding_name'}) {
+ my $output_encoding = $self->{'output_encoding_name'};
+ my $encoding = $output_encoding;
+ if (defined($LaTeX_encoding_names_map{$output_encoding})) {
+ ($encoding, $fontenc) = @{$LaTeX_encoding_names_map{$output_encoding}};
+ }
+ $class_and_usepackage_begin .= "\\usepackage[$encoding]{inputenc}\n";
}
- $header .= "\\usepackage[$encoding]{inputenc}\n";
- }
- $header .= "\\usepackage[$fontenc]{fontenc}\n";
-
- if ($self->{'index_entries'}
- and scalar(keys(%{$self->{'index_entries'}}))) {
- $header .= "\\usepackage{imakeidx}\n";
- }
- if ($self->{'packages'}->{'needspace'}) {
- $header .= "\\usepackage{needspace}\n";
- }
- if ($self->{'packages'}->{'microtype'}) {
- $header .= "\\usepackage[activate=false]{microtype}\n";
- }
- if ($self->{'packages'}->{'array'}) {
- $header .= "\\usepackage{array}\n";
- }
- if ($self->{'packages'}->{'embrac'}) {
- $header .= "\\usepackage{embrac}\n";
- $header .= "\\usepackage{expl3}\n";
- }
- if ($self->{'packages'}->{'tabularx'}) {
- $header .= "\\usepackage{tabularx}\n";
- }
- if ($self->{'packages'}->{'mdframed'}) {
- # framemethod=tikz needed for roundcorners for @cartouche
- $header .= "\\usepackage[framemethod=tikz]{mdframed}\n";
- }
- if ($self->{'packages'}->{'caption'}) {
- # capt-of gives an error for float.t float_in_block_commands test
- #$header .= "\\usepackage{capt-of}\n";
- $header .= "\\usepackage{caption}\n";
- }
- if ($self->{'packages'}->{'fontsize'}) {
- $header .= "\\usepackage{fontsize}\n";
- }
- if (scalar(keys(%{$self->{'list_environments'}}))) {
- $header .= "\\usepackage{enumitem}\n";
- }
- if ($self->{'packages'}->{'geometry'}) {
- $header .= "\\usepackage{geometry}\n";
- }
- if ($self->{'floats'}) {
- $header .= "\\usepackage{float}\n";
- }
- if ($self->{'packages'}->{'babel'}) {
- $header .= "\\usepackage{babel}\n";
+ $class_and_usepackage_begin .= "\\usepackage[$fontenc]{fontenc}\n";
}
- # Documentation says to include last
- $header
- .= '% use hidelinks to remove boxes around links to be similar to Texinfo
TeX
+ my $usepackage_end = $self->get_conf('END_USEPACKAGE');
+ if (!defined($usepackage_end)) {
+ if ($self->{'index_entries'}
+ and scalar(keys(%{$self->{'index_entries'}}))) {
+ $usepackage_end .= "\\usepackage{imakeidx}\n";
+ }
+ if ($self->{'packages'}->{'needspace'}) {
+ $usepackage_end .= "\\usepackage{needspace}\n";
+ }
+ if ($self->{'packages'}->{'microtype'}) {
+ $usepackage_end .= "\\usepackage[activate=false]{microtype}\n";
+ }
+ if ($self->{'packages'}->{'array'}) {
+ $usepackage_end .= "\\usepackage{array}\n";
+ }
+ if ($self->{'packages'}->{'embrac'}) {
+ $usepackage_end .= "\\usepackage{embrac}\n";
+ $usepackage_end .= "\\usepackage{expl3}\n";
+ }
+ if ($self->{'packages'}->{'tabularx'}) {
+ $usepackage_end .= "\\usepackage{tabularx}\n";
+ }
+ if ($self->{'packages'}->{'mdframed'}) {
+ # framemethod=tikz needed for roundcorners for @cartouche
+ $usepackage_end .= "\\usepackage[framemethod=tikz]{mdframed}\n";
+ }
+ if ($self->{'packages'}->{'caption'}) {
+ # capt-of gives an error for float.t float_in_block_commands test
+ #$usepackage_end .= "\\usepackage{capt-of}\n";
+ $usepackage_end .= "\\usepackage{caption}\n";
+ }
+ if ($self->{'packages'}->{'fontsize'}) {
+ $usepackage_end .= "\\usepackage{fontsize}\n";
+ }
+ if (scalar(keys(%{$self->{'list_environments'}}))) {
+ $usepackage_end .= "\\usepackage{enumitem}\n";
+ }
+ if ($self->{'packages'}->{'geometry'}) {
+ $usepackage_end .= "\\usepackage{geometry}\n";
+ }
+ if ($self->{'floats'}) {
+ $usepackage_end .= "\\usepackage{float}\n";
+ }
+ if ($self->{'packages'}->{'babel'}) {
+ $usepackage_end .= "\\usepackage{babel}\n";
+ }
+ # Documentation says to include last
+ $usepackage_end
+ .= '% use hidelinks to remove boxes around links to be similar to Texinfo
TeX
\usepackage[hidelinks]{hyperref}
';
- $header .= "\n";
-
- return $header . $header_code;
+ }
+ return $class_and_usepackage_begin . $usepackage_end . "\n" . $header_code;
}
sub _latex_begin_output($)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/LaTeX.pm (_latex_header), doc/texinfo.texi (@LaTeX{} Customization Variables), tp/Texinfo/Common.pm (@variable_string_settables): add experimental LaTeX documentclass and packages customization, using two customization variables, CLASS_BEGIN_USEPACKAGE and END_USEPACKAGE.,
Patrice Dumas <=