summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-25 03:00:48 +0000
committerNorbert Preining <norbert@preining.info>2019-09-25 03:00:48 +0000
commitd232e1107d60e7689e706bee9705f26745ae8b9e (patch)
treef9ac3303fdb36c2eca1872286615c0931d952476 /macros/latex/contrib
parent94c2e367c3690be2a3c715b4577c81200652ad81 (diff)
CTAN sync 201909250300
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/acro/README4
-rw-r--r--macros/latex/contrib/acro/acro.sty280
-rw-r--r--macros/latex/contrib/acro/acro_en.pdfbin567835 -> 563627 bytes
-rw-r--r--macros/latex/contrib/acro/acro_en.tex57
-rw-r--r--macros/latex/contrib/chemformula/README4
-rw-r--r--macros/latex/contrib/chemformula/chemformula.sty8
-rw-r--r--macros/latex/contrib/chemformula/chemformula_en.pdfbin957854 -> 950273 bytes
-rw-r--r--macros/latex/contrib/chemformula/chemformula_en.tex7
-rw-r--r--macros/latex/contrib/chemmacros/README4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.history6
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.acid-base.code.tex11
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.all.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.base.code.tex8
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.charges.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.chemformula.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.errorcheck.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.greek.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.isotopes.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.lang.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.mechanisms.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.newman.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex56
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.orbital.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.particles.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.phases.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.polymers.code.tex28
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.reactions.code.tex93
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.scheme.code.tex57
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.spectroscopy.code.tex15
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.symbols.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.thermodynamics.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.tikz.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.module.xfrac.code.tex2
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros.sty8
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros4.sty4
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros5.sty6
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros_en.pdfbin1042240 -> 1037667 bytes
-rw-r--r--macros/latex/contrib/chemmacros/chemmacros_en.tex17
-rw-r--r--macros/latex/contrib/practicalreports/README18
-rw-r--r--macros/latex/contrib/practicalreports/practicalreports.pdfbin0 -> 179978 bytes
-rw-r--r--macros/latex/contrib/practicalreports/practicalreports.sty161
-rw-r--r--macros/latex/contrib/practicalreports/practicalreports.tex325
-rw-r--r--macros/latex/contrib/pythontex/NEWS.rst51
-rw-r--r--macros/latex/contrib/pythontex/README9
-rw-r--r--macros/latex/contrib/pythontex/depythontex2.py2
-rw-r--r--macros/latex/contrib/pythontex/depythontex3.py2
-rw-r--r--macros/latex/contrib/pythontex/pythontex.dtx183
-rw-r--r--macros/latex/contrib/pythontex/pythontex.ins4
-rw-r--r--macros/latex/contrib/pythontex/pythontex.pdfbin969134 -> 975950 bytes
-rw-r--r--macros/latex/contrib/pythontex/pythontex2.py157
-rw-r--r--macros/latex/contrib/pythontex/pythontex3.py157
-rw-r--r--macros/latex/contrib/pythontex/pythontex_engines.py235
54 files changed, 1660 insertions, 373 deletions
diff --git a/macros/latex/contrib/acro/README b/macros/latex/contrib/acro/README
index 89f9d59cdf..c9a69ddaee 100644
--- a/macros/latex/contrib/acro/README
+++ b/macros/latex/contrib/acro/README
@@ -1,9 +1,9 @@
--------------------------------------------------------------------------
-the ACRO package v2.9
+the ACRO package v2.10
Typeset Acronyms
-2019/02/17
+2019/09/23
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://bitbucket.org/cgnieder/acro
diff --git a/macros/latex/contrib/acro/acro.sty b/macros/latex/contrib/acro/acro.sty
index 21f721615e..2b5cde75b3 100644
--- a/macros/latex/contrib/acro/acro.sty
+++ b/macros/latex/contrib/acro/acro.sty
@@ -31,8 +31,8 @@
\RequirePackage{expl3,xparse,l3keys2e,xtemplate,etoolbox}
\ProvidesExplPackage
{acro}
- {2019/02/17}
- {2.9}
+ {2019/09/23}
+ {2.10}
{Typeset Acronyms}
% --------------------------------------------------------------------------
@@ -310,11 +310,13 @@
\bool_new:N \l__acro_hyperref_loaded_bool
\bool_new:N \l__acro_use_hyperref_bool
\bool_new:N \l__acro_xspace_bool
-\bool_new:N \l__acro_custom_format_bool
+\bool_new:N \l__acro_custom_short_format_bool
+\bool_new:N \l__acro_custom_alt_format_bool
\bool_new:N \l__acro_custom_long_format_bool
\bool_new:N \l__acro_strict_bool
\bool_new:N \l__acro_create_macros_bool
\bool_new:N \l__acro_first_upper_bool
+\bool_new:N \l__acro_upper_short_bool
\bool_new:N \l__acro_indefinite_bool
\bool_new:N \l__acro_upper_indefinite_bool
\bool_new:N \l__acro_foreign_bool
@@ -377,7 +379,7 @@
\tl_new:N \l__acro_list_name_tl
\tl_new:N \l__acro_list_before_tl
\tl_new:N \l__acro_list_after_tl
-\tl_new:N \l__acro_custom_format_tl
+\tl_new:N \l__acro_custom_short_format_tl
\tl_new:N \l__acro_first_between_tl
\tl_new:N \l__acro_citation_connect_tl
\tl_new:N \l__acro_between_group_connect_citation_tl
@@ -470,6 +472,8 @@
\tl_set_eq:NN \l__acro_alt_format_tl \l__acro_short_format_tl
\tl_set:Nn \l__acro_list_short_format_tl {#1} ,
short-format .value_required:n = true ,
+ alt-format .code:n =
+ \tl_set:Nn \l__acro_alt_format_tl {#1} ,
long-format .code:n =
\tl_set:Nn \l__acro_long_format_tl {#1}
\tl_set:Nn \l__acro_first_long_format_tl {#1}
@@ -574,7 +578,9 @@
index-cmd .value_required:n = true ,
uc-cmd .code:n =
\cs_set_eq:NN \__acro_first_upper_case:n #1 ,
- uc-cmd .value_required:n = true
+ uc-cmd .value_required:n = true ,
+ uppercase-short .bool_set:N = \l__acro_upper_short_bool ,
+ uppercase-short .initial:n = false
}
\AtBeginDocument
@@ -811,15 +817,18 @@
% #1: id
\cs_new_protected:Npn \__acro_print_foreign:n #1
{
- \bool_if:nT
- {
- \l__acro_foreign_bool &&
- !\l__acro_first_only_short_bool &&
- !\l__acro_first_only_long_bool
- }
+ \acro_if_foreign:nT {#1}
{
- \acro_write_foreign:n {#1}
- \acro_endings:nn {#1} {foreign}
+ \bool_if:nT
+ {
+ \l__acro_foreign_bool &&
+ !\l__acro_first_only_short_bool &&
+ !\l__acro_first_only_long_bool
+ }
+ {
+ \acro_write_foreign:n {#1}
+ \acro_endings:nn {#1} {foreign}
+ }
}
}
@@ -874,7 +883,10 @@
\__acro_open_bracket:
\__acro_print_foreign:n {#1}
\__acro_foreign_sep:n {#1}
- \__acro_print_form:nnn {long} {#1} {#2}
+ {
+ \bool_set_false:N \l__acro_first_upper_bool
+ \__acro_print_form:nnn {long} {#1} {#2}
+ }
\__acro_print_citation:n {#1}
\__acro_close_bracket:
\__acro_finalize_first:n {#1}
@@ -884,7 +896,10 @@
\__acro_open_bracket:
\__acro_print_foreign:n {#1}
\__acro_foreign_sep:n {#1}
- \__acro_print_form:nnn {short} {#1} {#2}
+ {
+ \bool_set_false:N \l__acro_first_upper_bool
+ \__acro_print_form:nnn {short} {#1} {#2}
+ }
\__acro_print_citation:n {#1}
\__acro_close_bracket:
\__acro_finalize_first:n {#1}
@@ -1394,11 +1409,8 @@
\acro_acc_supp:nn
{#1}
{
- \acro_write_short:nn {#1}
- {
- \l__acro_list_short_format_tl
- { \__acro_get_property:nn {short} {#1} }
- }
+ \l__acro_list_short_format_tl
+ \__acro_get_property:nn {short} {#1}
}
}
}
@@ -1528,18 +1540,20 @@
\tl_clear:N #1
\acro_for_all_acronyms_do:n
{% ##1: id; ##2: short form
- \acro_get:n {##1}
- \acro_if_entry:nnnT {##1} {#2} {#3}
- {
- \tl_put_right:Nn #1
- {
- \acro_print_list_entry:nnnn
- { \acro_list_entry:nn {short} {##1} }
- { \acro_list_entry:nn {long} {##1} }
- { \acro_list_entry:nn {extra} {##1} }
- { \acro_list_entry:nn {page} {##1} }
- }
- }
+ \group_begin:
+ \acro_get:n {##1}
+ \acro_if_entry:nnnT {##1} {#2} {#3}
+ {
+ \tl_gput_right:Nn #1
+ {
+ \acro_print_list_entry:nnnn
+ { \acro_list_entry:nn {short} {##1} }
+ { \acro_list_entry:nn {long} {##1} }
+ { \acro_list_entry:nn {extra} {##1} }
+ { \acro_list_entry:nn {page} {##1} }
+ }
+ }
+ \group_end:
}
}
@@ -1982,7 +1996,7 @@
\prop_get:NnNF \l__acro_short_prop {#1} \l__acro_tmpa_tl {}
\__acro_make_link:NnV \l__acro_short_tl {#1} \l__acro_tmpa_tl
% \acro_get_property:nn {#1} {short-format}
- % alt:
+ % alt:
\prop_get:NnNTF \l__acro_alt_prop {#1} \l__acro_tmpa_tl
{ \__acro_make_link:NnV \l__acro_alt_tl {#1} \l__acro_tmpa_tl }
{ \tl_set_eq:NN \l__acro_alt_tl \l__acro_short_tl }
@@ -2007,9 +2021,12 @@
{ \bool_set_true:N \l__acro_custom_long_format_bool }
{ \bool_set_false:N \l__acro_custom_long_format_bool }
\acro_get_property:nn {#1} {first-long-format}
- \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_format_tl
- { \bool_set_true:N \l__acro_custom_format_bool }
- { \bool_set_false:N \l__acro_custom_format_bool }
+ \prop_get:NnNTF \l__acro_format_prop {#1} \l__acro_custom_short_format_tl
+ { \bool_set_true:N \l__acro_custom_short_format_bool }
+ { \bool_set_false:N \l__acro_custom_short_format_bool }
+ \prop_get:NnNTF \l__acro_alt_format_prop {#1} \l__acro_custom_alt_format_tl
+ { \bool_set_true:N \l__acro_custom_alt_format_bool }
+ { \bool_set_false:N \l__acro_custom_alt_format_bool }
\acro_get_property:nn {#1} {single-format}
\acro_for_endings_do:n
{
@@ -2104,31 +2121,50 @@
\cs_new_protected:Npn \__acro_endings:nn #1#2
{
- \bool_if:NTF \l__acro_include_endings_format_bool
+ \acro_for_endings_do:n
{
- \str_if_eq:nnTF {long} {#2}
- {
- \bool_if:NTF \l__acro_custom_long_format_bool
- { \l__acro_custom_long_format_tl }
- { \tl_use:c {l__acro_#2_format_tl} }
- }
- {
- \bool_if:NTF \l__acro_custom_format_bool
- { \l__acro_custom_format_tl }
- { \tl_use:c {l__acro_#2_format_tl} }
- }
+ \__acro_set_ending_for:nnn {##1} {#1} {#2}
+ \bool_if:cT {l__acro_##1_bool}
+ { \__acro_ending_format:nn {#2} { \tl_use:c {l__acro_#2_##1_tl} } }
}
- { \use:n }
+ }
+
+% #1: long|short|alt
+% #2: string
+\cs_new_protected:Npn \__acro_ending_format:nn #1#2
+ {
+ \bool_if:NTF \l__acro_include_endings_format_bool
{
- \acro_for_endings_do:n
+ \str_case:nn {#1}
{
- \__acro_set_ending_for:nnn {##1} {#1} {#2}
- \bool_if:cT {l__acro_##1_bool}
- { \tl_use:c {l__acro_#2_##1_tl} }
+ {long}
+ {
+ \bool_if:NTF \l__acro_custom_long_format_bool
+ { \l__acro_custom_long_format_tl }
+ {
+ \bool_if:NTF \l__acro_first_instance_bool
+ { \l__acro_first_long_format_tl }
+ { \l__acro_long_format_tl }
+ }
+ }
+ {short}
+ {
+ \bool_if:NTF \l__acro_custom_short_format_bool
+ { \l__acro_custom_short_format_tl }
+ { \l__acro_short_format_tl }
+ }
+ {alt}
+ {
+ \bool_if:NTF \l__acro_custom_alt_format_bool
+ { \l__acro_custom_alt_format_tl }
+ { \l__acro_alt_format_tl }
+ }
}
}
+ { \use:n }
+ {#2}
}
-
+
\prg_new_conditional:Npnn \acro_if_ending_exist:n #1 {p,T,F,TF}
{
\seq_if_in:NnTF \l__acro_endings_seq {#1}
@@ -2377,7 +2413,10 @@
}
\bool_gset_true:c { g__acro_#1_used_bool }
}
- { \__acro_aux_file:Nxxxx \acro@used@once {#1} {} {} {} }
+ {}
+ % I can't remember why I want an empty first use case for starred
+ % acronyms…
+ % { \__acro_aux_file:Nxxxx \acro@used@once {#1} {} {} {} }
\prg_return_false:
}
}
@@ -2475,18 +2514,34 @@
\fi
% --------------------------------------------------------------------------
+% #1: short|alt|long
+% #2: string to be typeset
+\cs_new_protected:Npn \__acro_typeset:nn #1#2
+ {
+ \mode_if_horizontal:F { \leavevmode }
+ \group_begin:
+ \use:x
+ {
+ \bool_if:cTF {l__acro_custom_#1_format_bool}
+ { \exp_not:v {l__acro_custom_#1_format_tl} }
+ { \exp_not:v {l__acro_#1_format_tl} }
+ {#2}
+ }
+ \group_end:
+ }
+
% typeset the short form:
% #1: ID
% #2: short form
\cs_new_protected:Npn \acro_write_short:nn #1#2
{
- \mode_if_horizontal:F { \leavevmode }
- \group_begin:
- \bool_if:NTF \l__acro_custom_format_bool
- { \l__acro_custom_format_tl }
- { \l__acro_short_format_tl }
- {#2}
- \group_end:
+ \__acro_typeset:nn {short}
+ {
+ \bool_if:nTF
+ { \l__acro_first_upper_bool && \l__acro_upper_short_bool }
+ { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } }
+ { \exp_not:n {#2} }
+ }
}
\cs_generate_variant:Nn \acro_write_short:nn { nV , nv }
@@ -2495,13 +2550,13 @@
% #2: alt form
\cs_new_protected:Npn \acro_write_alt:nn #1#2
{
- \mode_if_horizontal:F { \leavevmode }
- \group_begin:
- \bool_if:NTF \l__acro_custom_format_bool
- { \l__acro_custom_format_tl }
- { \l__acro_alt_format_tl }
- {#2}
- \group_end:
+ \__acro_typeset:nn {alt}
+ {
+ \bool_if:nTF
+ { \l__acro_first_upper_bool && \l__acro_upper_short_bool }
+ { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } }
+ { \exp_not:n {#2} }
+ }
}
\cs_generate_variant:Nn \acro_write_alt:nn { nV , nv }
@@ -2513,23 +2568,15 @@
% #2: long form
\cs_new_protected:Npn \acro_write_long:nn #1#2
{
- \mode_if_horizontal:F { \leavevmode }
- \group_begin:
- \bool_if:NTF \l__acro_custom_long_format_bool
- { \l__acro_custom_long_format_tl }
- { \use:n }
+ \__acro_typeset:nn {long}
{
- \use:x
- {
- \exp_not:n {#1}
- {
- \bool_if:NTF \l__acro_first_upper_bool
- { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } }
- { \exp_not:n {#2} }
- }
- }
+ \exp_not:n {#1}
+ {
+ \bool_if:NTF \l__acro_first_upper_bool
+ { \exp_not:N \__acro_first_upper_case:n { \exp_not:n {#2} } }
+ { \exp_not:n {#2} }
+ }
}
- \group_end:
}
\cs_generate_variant:Nn \acro_write_long:nn { VV,Vo,Vf,V,v,vv }
@@ -3112,7 +3159,6 @@
{
activate-trailing-tokens .code:n =
\clist_map_inline:nn {#1} { \acro_activate_trailing_token:n {##1} } ,
- activate-trailing-tokens .initial:n = dot ,
deactivate-trailing-tokens .code:n =
\clist_map_inline:nn {#1} { \acro_deactivate_trailing_token:n {##1} }
}
@@ -3734,6 +3780,9 @@
% short format:
\acro_declare_property_alias:nn {short-format} {format}
+% alt format:
+\acro_declare_simple_property:n {alt-format}
+
% long format:
\acro_declare_simple_property:n {long-format}
@@ -4195,28 +4244,30 @@
\AcroRegisterTrailing - {dash}
\AcroRegisterTrailing \babelhyphen {babel-hyphen}
+\keys_set:nn {acro} { activate-trailing-tokens = dot }
+
% --------------------------------------------------------------------------
% the user commands
% automatic:
\NewAcroCommand \ac
{ \acro_use:n {#1} }
-\NewAcroCommand \iac
+\NewAcroCommand \Ac
{
- \acro_indefinite:
+ \acro_first_upper:
\acro_use:n {#1}
}
-\NewAcroCommand \Iac
+\NewAcroCommand \iac
{
- \acro_first_upper:
\acro_indefinite:
\acro_use:n {#1}
}
-\NewAcroCommand \Ac
+\NewAcroCommand \Iac
{
\acro_first_upper:
+ \acro_indefinite:
\acro_use:n {#1}
}
@@ -4250,6 +4301,12 @@
\NewAcroCommand \acs
{ \acro_short:n {#1} }
+\NewAcroCommand \Acs
+ {
+ \acro_first_upper:
+ \acro_short:n {#1}
+ }
+
\NewAcroCommand \iacs
{
\acro_indefinite:
@@ -4269,6 +4326,13 @@
\acro_short:n {#1}
}
+\NewAcroCommand \Acsp
+ {
+ \acro_first_upper:
+ \acro_plural:
+ \acro_short:n {#1}
+ }
+
% alt:
\NewAcroCommand \aca
{ \acro_alt:n {#1} }
@@ -4298,26 +4362,33 @@
\acro_alt:n {#1}
}
+\NewAcroCommand \Acap
+ {
+ \acro_first_upper:
+ \acro_plural:
+ \acro_alt:n {#1}
+ }
+
% long:
\NewAcroCommand \acl
{ \acro_long:n {#1} }
-\NewAcroCommand \iacl
+\NewAcroCommand \Acl
{
- \acro_indefinite:
+ \acro_first_upper:
\acro_long:n {#1}
}
-\NewAcroCommand \Iacl
+\NewAcroCommand \iacl
{
- \acro_first_upper:
\acro_indefinite:
\acro_long:n {#1}
}
-\NewAcroCommand \Acl
+\NewAcroCommand \Iacl
{
\acro_first_upper:
+ \acro_indefinite:
\acro_long:n {#1}
}
@@ -4338,22 +4409,22 @@
\NewAcroCommand \acf
{ \acro_first:n {#1} }
-\NewAcroCommand \iacf
+\NewAcroCommand \Acf
{
- \acro_indefinite:
+ \acro_first_upper:
\acro_first:n {#1}
}
-\NewAcroCommand \Iacf
+\NewAcroCommand \iacf
{
- \acro_first_upper:
\acro_indefinite:
\acro_first:n {#1}
}
-\NewAcroCommand \Acf
+\NewAcroCommand \Iacf
{
\acro_first_upper:
+ \acro_indefinite:
\acro_first:n {#1}
}
@@ -4690,6 +4761,15 @@
`foreign-sep' to be a &
- fix issue #116
- implemented issue #112
+2019/09/23 v2.10 - fix issue #120
+ - fix isuue #128
+ - fix issue #129
+ - fix issue #131
+ - new: \Acs \Acsp \Aca \Acap
+ - new: `alt-format'
+ - new: `uppercase-short'
+ - a change to how usage is determined (see def. of
+ \acro_is_used:nTF)
% --------------------------------------------------------------------------
% TODO:
diff --git a/macros/latex/contrib/acro/acro_en.pdf b/macros/latex/contrib/acro/acro_en.pdf
index a0cd8ab700..e816f76124 100644
--- a/macros/latex/contrib/acro/acro_en.pdf
+++ b/macros/latex/contrib/acro/acro_en.pdf
Binary files differ
diff --git a/macros/latex/contrib/acro/acro_en.tex b/macros/latex/contrib/acro/acro_en.tex
index ad807a43d0..c7caf4b7bc 100644
--- a/macros/latex/contrib/acro/acro_en.tex
+++ b/macros/latex/contrib/acro/acro_en.tex
@@ -1,8 +1,8 @@
-% !arara: pdflatex: { action: nonstopmode }
+% arara: pdflatex: { action: nonstopmode }
% !arara: biber
% !arara: pdflatex: { action: nonstopmode }
-% arara: pdflatex: { action: nonstopmode }
-% arara: pdflatex: { action: nonstopmode }
+% !arara: pdflatex: { action: nonstopmode }
+% !arara: pdflatex: { action: nonstopmode }
% --------------------------------------------------------------------------
% the ACRO package
%
@@ -322,7 +322,7 @@ documentation.
\keyval{foreign-plural}{text}\Default{s}
The\sinceversion{2.9} plural ending appended to the foreign form.
%% foreign-plural-form
- \keyval{long-plural-form}{text}
+ \keyval{foreign-plural-form}{text}
Plural\sinceversion{2.9} lforeign form of the acronym; replaces the
foreign form when used instead of appending the plural ending.
%% list
@@ -390,6 +390,10 @@ documentation.
%% long-format
\keyval{long-format}{\TeX{} code}
The format used for the long form of the acronym.
+ %% short-format
+ \keyval{alt-format}{\TeX{} code}
+ The\sinceversion{2.10} format used for the alternative form of the
+ acronym. If this is not given the short format will be used.
%% first-long-format
\keyval{first-long-format}{\TeX{} code}
The format used for the first long form of the acronym as set with \cs{ac},
@@ -521,36 +525,54 @@ This is an example of the logging info with \keyis{log}{true} or
\subsection{Using the Acronyms -- the Commands}\label{sec:using-acronyms-comm}
Acronyms are used with one of the following commands:
\begin{commands}
+ %%
\command{ac}[\sarg\marg{id}]
basic command; the first output is different from subsequent ones.
\command{Ac}[\sarg\marg{id}]
- same as \cs{ac} but capitalizes the first letter of the long form.
+ same as \cs{ac} but capitalizes the first letter.
+ %%
\command{acs}[\sarg\marg{id}]
\h{s}hort form; the actual acronym.
+ \command{Acs}[\sarg\marg{id}]
+ same\sinceversion{2.10} as \cs{acs} but capitalizes the first letter.
+ %%
\command{acl}[\sarg\marg{id}]
\h{l}ong form; the meaning of the acronym.
\command{Acl}[\sarg\marg{id}]
same as \cs{acl} but capitalizes first letter.
+ %%
\command{aca}[\sarg\marg{id}]
\h{a}lternative short form as specified in the \option{alt} key of
\cs{DeclareAcronym}; if it hasn't been specified this is identical to
\cs{acs}.
+ \command{Aca}[\sarg\marg{id}]
+ same\sinceversion{2.10} as \cs{aca} but capitalizes the first letter.
+ %%
\command{acf}[\sarg\marg{id}]
first form; output like the first time \cs{ac} is output.
\command{Acf}[\sarg\marg{id}]
- same as \cs{acf} but capitalizes first letter of the long form.
+ same as \cs{acf} but capitalizes first letter.
+ %%
\command{acp}[\sarg\marg{id}]
\h{p}lural form of \cs{ac};
\command{Acp}[\sarg\marg{id}]
- same as \cs{acp} but capitalizes first letter of the long form.
+ same as \cs{acp} but capitalizes first letter.
+ %%
\command{acsp}[\sarg\marg{id}]
plural form of \cs{acs};
+ \command{Acsp}[\sarg\marg{id}]
+ same\sinceversion{2.10} as \cs{acsp} but capitalizes the first letter.
+ %%
\command{aclp}[\sarg\marg{id}]
plural form of \cs{acl};
\command{Aclp}[\sarg\marg{id}]
same as \cs{aclp} but capitalizes first letter.
+ %%
\command{acap}[\sarg\marg{id}]
plural form of \cs{aca};
+ \command{Acap}[\sarg\marg{id}]
+ same\sinceversion{2.10} as \cs{acap} but capitalizes the first letter.
+ %%
\command{acfp}[\sarg\marg{id}]
plural form of \cs{acf};
\command{Acfp}[\sarg\marg{id}]
@@ -1104,10 +1126,16 @@ There are a few options which change the general behaviour of \acro.
then already existing macros will be overwritten.
%%
\keybool{sort}\Default{true}
- If set to \code{true} the acronym list will be sorted automatically. The
+ If set to \code{true} the acronym list will be sorted alphabetically. The
entries are sorted by their \acs{id} ignoring upper and lower case. This
option needs the experimental package \pkg{l3sort} (from the
\pkg{l3experimental} bundle) and can only be set in the preamble.
+ If set to \code{false} the acronyms are listed in order of their
+ declaration.
+ %%
+ \keybool{display-foreign}\Default{true}
+ When set to \code{false} any \option{foreign} option is ignored and
+ foreign forms are not displayed.
%%
\keychoice{cite}{\default{all},first,none}\Default{first}
\changedversion{2.4b}This option decides whether citations that are added
@@ -1167,15 +1195,20 @@ There are a few options which change the general behaviour of \acro.
the like commands. You can change it to another one like for example
\cs*{makefirstuc}\footnote{from the \pkg{mfirstuc} package} or
\cs*{MakeTextUppercase}\footnote{from the \pkg*{textcase} package}.
+ %%
+ \keybool{uppercase-short}\Default{false}
+ If\sinceversion{2.10} set to \code{true} commands like \cs{Ac}, \cs{Acs} or
+ \cs{Aca} will uppercase the first letter of the short or alternative
+ version.
\end{options}
-All options of this and the following sections can be set up either as package
-options or via the setup command:
+All options of this and the following sections can be set via the setup command:
\begin{commands}
\command{acsetup}[\marg{options}]
Set up \acro\ anywhere in the document. Or separate package loading from
setup.
\end{commands}
+They might work as package options as well but \emph{I do not recommend it}.
\begin{example}
% with \acsetup{macros}
@@ -1660,6 +1693,9 @@ commands\footnote{Which is why you need to use them inside an expl3
\command*{acro_add_action:n}[ \marg{code}]
Adds\sinceversion{2.7} code to \cs*{acro_get:n}. Inside of \meta{code}
you can refer to the \ac{id} of the acronym with \verbcode+#1+.
+ The \cs*{acro_get:n} command is called the first macro that is called by
+ \cs*{acro_use:n} which for example enables conditionals to test for
+ certain acronym properties.
\command*{acro_get_property:nn}[\TF\ \marg{id} \marg{property} \marg{true}
\marg{false}]
Fetches\sinceversion{2.7} the property \meta{property} of the acronym
@@ -2129,4 +2165,3 @@ letter (category code~11).
\printacronyms
\end{document}
-
diff --git a/macros/latex/contrib/chemformula/README b/macros/latex/contrib/chemformula/README
index b171813d7d..fda9482523 100644
--- a/macros/latex/contrib/chemformula/README
+++ b/macros/latex/contrib/chemformula/README
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
-the CHEMFORMULA package v4.15e 2017/03/23
+the CHEMFORMULA package v4.15f 2019/09/23
typeset chemical compounds and reactions
@@ -8,7 +8,7 @@ Clemens Niederberger
Web: http://www.mychemistry.eu/forums/forum/chemformula/
E-Mail: contact@mychemistry.eu
--------------------------------------------------------------------------
-Copyright 2011-2017 Clemens Niederberger
+Copyright 2011-2019 Clemens Niederberger
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemformula/chemformula.sty b/macros/latex/contrib/chemformula/chemformula.sty
index d909b17879..da9b6fe414 100644
--- a/macros/latex/contrib/chemformula/chemformula.sty
+++ b/macros/latex/contrib/chemformula/chemformula.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -30,9 +30,9 @@
\usetikzlibrary{arrows.meta}
\ExplSyntaxOn
-\tl_const:Nn \c_chemformula_date_tl {2017/03/23}
+\tl_const:Nn \c_chemformula_date_tl {2019/09/23}
\tl_const:Nn \c_chemformula_version_number_tl {4.15}
-\tl_const:Nn \c_chemformula_version_suffix_tl {e}
+\tl_const:Nn \c_chemformula_version_suffix_tl {f}
\tl_const:Nx \c_chemformula_version_tl
{ \c_chemformula_version_number_tl \c_chemformula_version_suffix_tl }
\tl_const:Nn \c_chemformula_info_tl
@@ -181,6 +181,8 @@
\seq_new:N \l__chemformula_tmpa_seq
+\bool_new:N \l__chemformula_tmpa_bool
+
% booleans:
% these are official:
\bool_new:N \l_chemformula_inside_ch_bool
diff --git a/macros/latex/contrib/chemformula/chemformula_en.pdf b/macros/latex/contrib/chemformula/chemformula_en.pdf
index f89c0d11e8..499a93ad74 100644
--- a/macros/latex/contrib/chemformula/chemformula_en.pdf
+++ b/macros/latex/contrib/chemformula/chemformula_en.pdf
Binary files differ
diff --git a/macros/latex/contrib/chemformula/chemformula_en.tex b/macros/latex/contrib/chemformula/chemformula_en.tex
index 0ff1bc0979..5dbb268e70 100644
--- a/macros/latex/contrib/chemformula/chemformula_en.tex
+++ b/macros/latex/contrib/chemformula/chemformula_en.tex
@@ -16,7 +16,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -65,7 +65,7 @@
addplot,
chemfig,
DeclareInstance, draw,
- sample, setatomsep, sfrac,
+ sample, setchemfig, sfrac,
usetikzlibrary
} ,
index-setup = { othercode=\footnotesize, level=\section , noclearpage } ,
@@ -89,6 +89,7 @@
\usepackage[biblatex]{embrac}
\ChangeEmph{[}[,.02em]{]}[.055em,-.08em]
\ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em]
+\usepackage{csquotes}
\usepackage[accsupp]{acro}
\acsetup{
@@ -1128,7 +1129,7 @@ of the labels. What stays constant is the part that protrudes the labels.
\ch{A ->[abc] B} \par
\ch{A ->[abc~abc] B} \par
% needs the `chemfig' package:
- \setatomsep{15pt}
+ \setchemfig{atom sep =15pt}
\ch{A ->[ "\chemfig{-[:30]-[:-30]OH}" ] B} \par
\end{example}
diff --git a/macros/latex/contrib/chemmacros/README b/macros/latex/contrib/chemmacros/README
index d6b3a3a4cc..22ff8e700c 100644
--- a/macros/latex/contrib/chemmacros/README
+++ b/macros/latex/contrib/chemmacros/README
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
-the CHEMMACROS package v5.8b 2017/08/28
+the CHEMMACROS package v5.8d 2019/09/23
comprehensive support for typesetting chemistry documents
@@ -8,7 +8,7 @@ Clemens Niederberger
Web: https://github.com/cgnieder/chemmacros/
E-Mail: contact@mychemistry.eu
--------------------------------------------------------------------------
-Copyright 2011-2017 Clemens Niederberger
+Copyright 2011-2019 Clemens Niederberger
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.history b/macros/latex/contrib/chemmacros/chemmacros.history
index 505e43a72f..bebe40163e 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.history
+++ b/macros/latex/contrib/chemmacros/chemmacros.history
@@ -12,7 +12,7 @@ contact@mychemistry.eu
If you have any ideas, questions, suggestions or bugs to report, please
feel free to contact me.
--------------------------------------------------------------------------
-Copyright 2011-2017 Clemens Niederberger
+Copyright 2011-2019 Clemens Niederberger
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -375,3 +375,7 @@ Version history
\__chemmacros_break_point_insert:nnn so it does
nothing as last token in \iupac (nomenclature)
2017/08/28 - version 5.8b - fix missing hyperref check
+2018/03/02 - version 5.8c - fix bug in \chemmacros_p:n (acid/base)
+ - smash sub- and superscripts of polymer delimiters
+ (polymers)
+2019/09/23 - version 5.8d - add some Norwegian translations
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.acid-base.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.acid-base.code.tex
index fb998832c9..1024cd4fac 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.acid-base.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.acid-base.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{acid-base}{2016/05/31 acid/base}
+\ChemModule{acid-base}{2018/02/22 acid/base}
\chemmacros_load_modules:n {charges}
@@ -108,7 +108,9 @@
\cs_new_protected:Npn \chemmacros_p:n #1
{
\group_begin:
- \mbox
+ \chemmacros_if_compatibility:nnTF {<=} {5.8b}
+ { \mbox }
+ { \chemmacros_text:n }
{
\chemmacros_p_style:n {p}
\ensuremath {#1}
@@ -157,8 +159,9 @@
}
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2016/02/04 - \NewChemEqConstant and family, new option `eq-constant'
2016/04/27 - moved translations from lang module to acid-base module
2016/05/31 - adapt to changes in `lang' module
+2018/02/22 - fix bug in \chemmacros_p:n (https://tex.stackexchange.com/q/416227/)
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.all.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.all.code.tex
index 599b659819..fa14ed3fdb 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.all.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.all.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -68,7 +68,7 @@
\msg_info:nn {chemmacros} {all-modules}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/10/14 - add info message discouraging the usage of this module
- add `errorcheck' module
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.base.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.base.code.tex
index 6e6b98094a..5d2e66611d 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.base.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.base.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -272,7 +272,9 @@
{
\cs_if_exist:cF {cref@#1@name}
{
- \crefname {#1} {#2} {#3}
+ \chemmacros_tex_if:nnTF {@cref@capitalise} {}
+ { \crefname {#1} {#4} {#5} }
+ { \crefname {#1} {#2} {#3} }
\Crefname {#1} {#4} {#5}
}
}
@@ -471,7 +473,7 @@
{ \bool_set_true:N \l__chemmacros_hyperref_bool }
}
-\tex_endinput:D
+\file_input_stop:
2015/09/23 - new conditionals \chemmacros_if_preamble:TF and
\chemmacros_if_document:TF
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.charges.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.charges.code.tex
index 3429727aa2..981d9d272e 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.charges.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.charges.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.chemformula.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.chemformula.code.tex
index 9f54d9317f..6a6c45d1f2 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.chemformula.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.chemformula.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -230,7 +230,7 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/09/22 - new general option `method' which allows a choice between
`chemformula' and `mhchem'
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.errorcheck.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.errorcheck.code.tex
index d7c70b5e9c..07499ef5f2 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.errorcheck.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.errorcheck.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -122,7 +122,7 @@
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/10/14 - first version
2016/03/08 - add `polymers' module
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.greek.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.greek.code.tex
index a9f96d7485..d3c9ee87ae 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.greek.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.greek.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.isotopes.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.isotopes.code.tex
index 0931c1579f..1d7ec5466c 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.isotopes.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.isotopes.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.lang.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.lang.code.tex
index b9dea089d2..7ae37a2f9f 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.lang.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.lang.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -162,7 +162,7 @@
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/11/17 - remove options `german' and `ngerman', starting with v5.3
2016/02/03 - adapt to changes in `acid-base' module
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.mechanisms.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.mechanisms.code.tex
index 662d93fbb3..22624538b6 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.mechanisms.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.mechanisms.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.newman.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.newman.code.tex
index 79d5c16ff1..7c8caa10a5 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.newman.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.newman.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -207,6 +207,6 @@
\cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf }
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2016/04/23 - some changes on how \newman is processed internally
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex
index 5a347b66e9..596d36f65a 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -456,7 +456,7 @@
}
\EndChemCompatibility
-\ChemCompatibilityFrom{5.8a}
+\ChemCompatibility{5.8a}
\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
{
\mode_if_math:TF
@@ -473,6 +473,49 @@
}
\EndChemCompatibility
+\ChemCompatibilityFrom{5.8b}
+\cs_new_protected:Npn \__chemmacros_peek_if_dash:TF #1#2
+ {
+ \peek_charcode:NTF -
+ {#1}
+ {#2}
+ }
+
+\cs_new_protected:Npn \__chemmacros_peek_if_paren:TF #1#2
+ { % (
+ \peek_charcode:NTF )
+ {#1}
+ { % [
+ \peek_charcode:NTF ]
+ {#1}
+ {#2}
+ }
+ }
+
+\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
+ {
+ \mode_if_math:TF
+ {#3}
+ {
+ \peek_meaning:NTF \group_end:
+ {#3}
+ {
+ \__chemmacros_peek_if_dash:TF
+ {#3}
+ {
+ \__chemmacros_peek_if_paren:TF
+ {#3}
+ {
+ \chemmacros_nobreak:
+ \tex_discretionary:D {#1} {#2} {#3}
+ \chemmacros_allow_hyphens:
+ }
+ }
+ }
+ }
+ }
+\EndChemCompatibility
+
\dim_new:N \l__chemmacros_iupac_hyphen_pre_dim
\dim_set:Nn \l__chemmacros_iupac_hyphen_pre_dim { .01em }
\dim_new:N \l__chemmacros_iupac_hyphen_post_dim
@@ -528,7 +571,7 @@
{ \tex_kern:D \l__chemmacros_iupac_break_dim }
}
}
-
+
\cs_new_protected:Npn \chemmacros_break_point_opening_paren:
{ \__chemmacros_break_point_insert:nnn { - } { ( } { ( } }
@@ -642,6 +685,11 @@
\NewChemIUPACShorthand ' \chemprime
\EndChemCompatibility
+\ChemCompatibilityFrom{5.8c}
+\NewChemIUPAC \nonbreakinghyphen { \mbox{-} \nobreak \hspace{0pt} }
+\NewChemIUPACShorthand = \nonbreakinghyphen
+\EndChemCompatibility
+
\cs_new_protected:Npn \chemmacros_iupac:nn #1#2
{
\group_begin:
@@ -873,7 +921,7 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/10/01 - use new function \chemmacros_if_document:TF for
\chemmacros_make_iupac:
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.orbital.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.orbital.code.tex
index d3f3a5a16f..79153b0d11 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.orbital.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.orbital.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.particles.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.particles.code.tex
index 44cde87840..9d68712f81 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.particles.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.particles.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -136,6 +136,6 @@
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2016/01/13 - new option particles/space
2016/04/02 - adapt to formula methods `chemist' and `chemfig'
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.phases.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.phases.code.tex
index 5f2bcc1dcd..da3365c038 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.phases.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.phases.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -133,7 +133,7 @@
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/06/09 - first version
2016/04/27 - moved translations from lang module to phases module
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.polymers.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.polymers.code.tex
index 8c93ff002c..f7d71c8565 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.polymers.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.polymers.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{polymers}{2016/03/08 polymers}
+\ChemModule{polymers}{2018/03/02 polymers}
\chemmacros_load_modules:n {nomenclature,tikz}
@@ -123,8 +123,24 @@
depth \l__chemmacros_polymer_delimiter_height_dim
width \c_zero_dim
\tex_right:D \l__chemmacros_polymer_delimiter_right_tl
- \c_math_subscript_token { \hbox_overlap_right:n {#5} }
- \c_math_superscript_token { \hbox_overlap_right:n {#6} }
+ \c_math_subscript_token
+ {
+ \hbox_overlap_right:n
+ {
+ \chemmacros_if_compatibility:nnTF {>} {5.8b}
+ { \smash {#5} }
+ {#5}
+ }
+ }
+ \c_math_superscript_token
+ {
+ \hbox_overlap_right:n
+ {
+ \chemmacros_if_compatibility:nnTF {>} {5.8b}
+ { \smash {#6} }
+ {#6}
+ }
+ }
\c_math_toggle_token
} ;
}
@@ -159,8 +175,8 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2016/03/07 - first version
2016/03/08 - \makepolymerdelims
-
+2018/03/02 - smash sub- and superscripts of polymer delimiters
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.reactions.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.reactions.code.tex
index 35be8b3e90..6512123897 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.reactions.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.reactions.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{reactions}{2016/05/04 reaction environments}
+\ChemModule{reactions}{2019/09/23 reaction environments}
\chemmacros_load_module:n {chemformula}
@@ -349,60 +349,68 @@
% --------------------------------------------------------------------------
\ChemCompatibilityTo{5.6}
-\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions}
-\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions}
-\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis}
-\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni}
-\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'{e}actions}
-\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties}
-
-\DeclareTranslationFallback {reaction} {Reaction}
-\DeclareTranslation {English} {reaction} {Reaction}
-\DeclareTranslation {German} {reaction} {Reaktion}
-\DeclareTranslation {Italian} {reaction} {Reazione}
-\DeclareTranslation {French} {reaction} {R\'{e}action}
-\DeclareTranslation {Dutch} {reaction} {Reactie}
+\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions}
+\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions}
+\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis}
+\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni}
+\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'{e}actions}
+\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties}
+
+\DeclareTranslationFallback {reaction} {Reaction}
+\DeclareTranslation {English} {reaction} {Reaction}
+\DeclareTranslation {German} {reaction} {Reaktion}
+\DeclareTranslation {Italian} {reaction} {Reazione}
+\DeclareTranslation {French} {reaction} {R\'{e}action}
+\DeclareTranslation {Dutch} {reaction} {Reactie}
\EndChemCompatibility
\ChemCompatibilityFrom{5.6}
\chemmacros_declare_translations:nn {list-of-reactions}
{
- fallback = List~ of~ Reactions ,
- English = List~ of~ Reactions ,
- German = Reaktionsverzeichnis ,
- Italian = Elenco~ delle~ reazioni ,
- French = Table~ des~ r\'{e}actions ,
- Dutch = Lijst~ van~ reacties
+ fallback = List~ of~ Reactions ,
+ English = List~ of~ Reactions ,
+ German = Reaktionsverzeichnis ,
+ Italian = Elenco~ delle~ reazioni ,
+ French = Table~ des~ r\'{e}actions ,
+ Dutch = Lijst~ van~ reacties ,
+ Norwegian = Reaksjonsliste ,
+ Nynorsk = Reaksjonsliste
}
\chemmacros_declare_translations:nn {reaction}
{
- fallback = reaction ,
- English = reaction ,
- German = Reaktion ,
- Italian = reazione ,
- French = r\'{e}action ,
- Dutch = reactie
+ fallback = reaction ,
+ English = reaction ,
+ German = Reaktion ,
+ Italian = reazione ,
+ French = r\'{e}action ,
+ Dutch = reactie ,
+ Norwegian = reaksjon ,
+ Nynorsk = reaksjon
}
\chemmacros_declare_translations:nn {reactions}
{
- fallback = reactions ,
- English = reactions ,
- German = Reaktionen ,
- Italian = reazioni ,
- French = r\'{e}actions ,
- Dutch = reacties
+ fallback = reactions ,
+ English = reactions ,
+ German = Reaktionen ,
+ Italian = reazioni ,
+ French = r\'{e}actions ,
+ Dutch = reacties ,
+ Norwegian = reaksjoner ,
+ Nynorsk = reaksjonar
}
\chemmacros_declare_translations:nn {Reaction}
{
- fallback = Reaction ,
- English = Reaction ,
- German = Reaktion ,
- Italian = Reazione ,
- French = R\'{e}action ,
- Dutch = Reactie
+ fallback = Reaction ,
+ English = Reaction ,
+ German = Reaktion ,
+ Italian = Reazione ,
+ French = R\'{e}action ,
+ Dutch = Reactie ,
+ Norwegian = Reaksjon ,
+ Nynorsk = Reaksjon
}
\chemmacros_declare_translations:nn {Reactions}
@@ -412,11 +420,13 @@
German = Reaktionen ,
Italian = Reazioni ,
French = R\'{e}actions ,
- Dutch = Reacties
+ Dutch = Reacties ,
+ Norwegian = Reaksjoner ,
+ Nynorsk = Reaksjonar
}
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/09/15 - adapt to `method' option => do not use chemformula's macros
directly
@@ -431,3 +441,4 @@
- add fancyref support
- moved translations from lang module to reactions module
2016/05/04 - options `tag-open', `tag-close' and `before-tag'
+2019/09/23 - added Norwegian translations
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex
index 9e95b9b076..01e629028f 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.redox.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -435,6 +435,6 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/09/30 - new option `explicit-zero-sign'
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.scheme.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.scheme.code.tex
index 1a07bd1c50..059741fe0c 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.scheme.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.scheme.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\ChemModule{scheme}{2016/04/25 a scheme floating environment}
+\ChemModule{scheme}{2019/09/23 a scheme floating environment}
\RequirePackage {chemnum}
@@ -102,7 +102,7 @@
\DeclareFloatingEnvironment[{
fileext = #2 ,
listname = {\exp_not:N \chemmacros_translate:n {#1-list}} ,
- name = #2
+ name = \chemmacros_translate:n {#1-name}
}]{#1}
}
@@ -248,13 +248,13 @@
% --------------------------------------------------------------------------
\ChemCompatibilityTo{5.6}
-\DeclareTranslationFallback {scheme-name} {Scheme}
-\DeclareTranslation {English} {scheme-name} {Scheme}
-\DeclareTranslation {German} {scheme-name} {Schema}
+\DeclareTranslationFallback {scheme-name} {Scheme}
+\DeclareTranslation {English} {scheme-name} {Scheme}
+\DeclareTranslation {German} {scheme-name} {Schema}
-\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes}
-\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes}
-\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata}
+\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes}
+\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes}
+\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata}
\EndChemCompatibility
\ChemCompatibilityFrom{5.6}
@@ -262,49 +262,62 @@
{
fallback = Scheme ,
English = Scheme ,
- German = Schema
+ German = Schema ,
+ Norwegian = Skjema ,
+ Nynorsk = Skjema
}
\chemmacros_declare_translations:nn {scheme-list}
{
- fallback = List~ of~ Schemes ,
- English = List~ of~ Schemes ,
- German = Verzeichnis~ der~ Schemata
+ fallback = List~ of~ Schemes ,
+ English = List~ of~ Schemes ,
+ German = Verzeichnis~ der~ Schemata,
+ Norwegian = Skjemaliste,
+ Nynorsk = Skjemaliste
}
\chemmacros_declare_translations:nn {scheme}
{
- fallback = scheme ,
- English = scheme ,
- German = Schema
+ fallback = scheme ,
+ English = scheme ,
+ German = Schema ,
+ Norwegian = skjema ,
+ Nynorsk = skjema
}
\chemmacros_declare_translations:nn {Scheme}
{
- fallback = Scheme ,
- English = Scheme ,
- German = Schema
+ fallback = Scheme ,
+ English = Scheme ,
+ German = Schema ,
+ Norwegian = Skjema ,
+ Nynorsk = Skjema
}
\chemmacros_declare_translations:nn {schemes}
{
fallback = schemes ,
English = schemes ,
- German = Schemata
+ German = Schemata ,
+ Norwegian = skjema ,
+ Nynorsk = skjema
}
\chemmacros_declare_translations:nn {Schemes}
{
fallback = Schemes ,
English = Schemes ,
- German = Schemata
+ German = Schemata ,
+ Norwegian = Skjema ,
+ Nynorsk = Skjema
}
\EndChemCompatibility
-\tex_endinput:D
+\file_input_stop:
% --------------------------------------------------------------------------
2015/09/19 - make the module compatible with floatrow
2015/10/23 - add info message to float method detection
2016/01/23 - make the module compatible with chemscheme
2016/04/25 - cleveref and fancyref support
2016/12/28 - bug fix: typo in \chemmacros_tex_if:nnTF usage
+2019/03/23 - added Norwegian translations
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.spectroscopy.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.spectroscopy.code.tex
index 30223fc583..87d53dd3ce 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.spectroscopy.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.spectroscopy.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -131,8 +131,8 @@
\tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2}
\chemmacros_chemformula:n { ^{#1} }
\bool_if:NTF \l__chemmacros_nmr_parse_bool
- { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
{ \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl }
+ { \g__chemmacros_nmr_element_coupled_tl }
\tl_use:N \l__chemmacros_nmr_element_method_connector_tl
\tl_use:N \l__chemmacros_nmr_method_tl
}
@@ -157,8 +157,8 @@
\tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
{
\bool_if:NTF \l__chemmacros_nmr_parse_bool
- { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
{ \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl }
+ { \g__chemmacros_nmr_element_coupled_tl }
}
\tl_use:N \l__chemmacros_nmr_element_method_connector_tl
\tl_use:N \l__chemmacros_nmr_method_tl
@@ -339,7 +339,7 @@
\bool_if:NT \l__chemmacros_nmr_solvent_bool
{
\bool_if:NTF \l__chemmacros_nmr_parse_bool
- { \chemformula_ch:nn { } {#4} }
+ { \chemmacros_chemformula:n {#4} }
{#4}
}
\bool_if:NT \l__chemmacros_nmr_delimiters_bool
@@ -404,7 +404,10 @@
\cs_new_protected:Npn \chemmacros_nmr_number:n #1
{
\__chemmacros_nmr_number:n {#1}
- \skip_horizontal:N \l__chemmacros_nmr_space_skip
+ \chemmacros_if_compatibility:nnTF {>=} {5.8c}
+ { \chemmacros_skip_nobreak:N }
+ { \skip_horizontal:N }
+ \l__chemmacros_nmr_space_skip
\chemmacros_chemformula:V \g__chemmacros_nmr_element_tl
}
@@ -509,6 +512,6 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/12/31 - new option `atom-number-space'
2017/01/27 - new option `nmr-base-format'
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.symbols.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.symbols.code.tex
index dfbc812d6f..314eeda81a 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.symbols.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.symbols.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.thermodynamics.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.thermodynamics.code.tex
index cf49fd0695..82306cc0ea 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.thermodynamics.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.thermodynamics.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.tikz.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.tikz.code.tex
index 2e8dfd243c..a656e70e5e 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.tikz.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.tikz.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -182,6 +182,6 @@
\EndChemCompatibility
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/10/26 - add decoration `wave' (complete sines)
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex
index ce7142e3dd..18bf0e5b9e 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -50,7 +50,7 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
2015/09/28 - change \AtBeginDocument into \AtEndPreamble
diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.xfrac.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.xfrac.code.tex
index 6ad2fd7771..735632beb4 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.module.xfrac.code.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros.module.xfrac.code.tex
@@ -11,7 +11,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/chemmacros/chemmacros.sty b/macros/latex/contrib/chemmacros/chemmacros.sty
index fb25545aad..badf8ddb9a 100644
--- a/macros/latex/contrib/chemmacros/chemmacros.sty
+++ b/macros/latex/contrib/chemmacros/chemmacros.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -31,10 +31,10 @@
% --------------------------------------------------------------------------
% package information:
-\tl_const:Nn \c_chemmacros_date_tl {2017/08/28}
+\tl_const:Nn \c_chemmacros_date_tl {2019/09/24}
\tl_const:Nn \c_chemmacros_version_major_number_tl {5}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {8}
-\tl_const:Nn \c_chemmacros_version_subrelease_tl {b}
+\tl_const:Nn \c_chemmacros_version_subrelease_tl {d}
\tl_const:Nx \c_chemmacros_version_number_tl
{
\c_chemmacros_version_major_number_tl .
@@ -268,5 +268,5 @@
{ \RequirePackage{chemmacros5} }
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/macros/latex/contrib/chemmacros/chemmacros4.sty b/macros/latex/contrib/chemmacros/chemmacros4.sty
index c47106a14b..ae86ebc47d 100644
--- a/macros/latex/contrib/chemmacros/chemmacros4.sty
+++ b/macros/latex/contrib/chemmacros/chemmacros4.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -4083,7 +4083,7 @@
\tl_set:Nn \reactionlistname
{ \chemmacros_translate:n {list-of-reactions} }
-\tex_endinput:D
+\file_input_stop:
% --------------------------------------------------------------------------
Version history
diff --git a/macros/latex/contrib/chemmacros/chemmacros5.sty b/macros/latex/contrib/chemmacros/chemmacros5.sty
index 6c267fe42c..c9578f737b 100644
--- a/macros/latex/contrib/chemmacros/chemmacros5.sty
+++ b/macros/latex/contrib/chemmacros/chemmacros5.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -231,7 +231,7 @@
\chemmacros_if_compatibility:nnF {>=} {#4}
{
\msg_warning:nnnn {chemmacros} {module-not-available} {#2} {#4}
- \tex_endinput:D
+ \file_input_stop:
}
\seq_gput_right:Nn \g__chemmacros_loaded_modules_seq {#2}
\prop_gput:Nnn \g__chemmacros_loaded_modules_prop {#2} {#3}
@@ -280,7 +280,7 @@
}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
% --------------------------------------------------------------------------
Modules: (* = preloaded)
diff --git a/macros/latex/contrib/chemmacros/chemmacros_en.pdf b/macros/latex/contrib/chemmacros/chemmacros_en.pdf
index 0f621ee561..e3e43444c6 100644
--- a/macros/latex/contrib/chemmacros/chemmacros_en.pdf
+++ b/macros/latex/contrib/chemmacros/chemmacros_en.pdf
Binary files differ
diff --git a/macros/latex/contrib/chemmacros/chemmacros_en.tex b/macros/latex/contrib/chemmacros/chemmacros_en.tex
index d4928256f3..feb89102c4 100644
--- a/macros/latex/contrib/chemmacros/chemmacros_en.tex
+++ b/macros/latex/contrib/chemmacros/chemmacros_en.tex
@@ -16,7 +16,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2017 Clemens Niederberger
+% Copyright 2011-2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -114,7 +114,7 @@
ominus, oplus,
percent, pgfarrowsdeclarealias, pgfarrowsrenewalias,
renewtagform, rightarrow,
- sample, scriptscriptstyle, setatomsep, setbondoffset, sfrac, shade,
+ sample, scriptscriptstyle, setchemfig, sfrac, shade,
shadedraw, shorthandoff, si, SI, sisetup, square, subsection,
textcolor, textendash, textsuperscript, tikz, tikzpicture, tiny, toprule,
upbeta, upeta, upgamma, usetikzlibrary,
@@ -1032,6 +1032,8 @@ and \cs*{textsuperscript} instead of \sym{\textasciicircum} without
\item The characters \sym{(} and \sym{)} allow the word to be hyphenated and
don't prevent further hyphenation, likewise \sym{[} and \sym{]}.
\item \sinceversion{5.3}The character \sym{'} is printed as \cs{chemprime}.
+ \item \sinceversion{5.8c}The character \sym{=} is printed ad
+ \cs{nonbreakinghyphen}.
\end{itemize}
\begin{example}[side-by-side]
\huge\iupac{2,4-Di|chlor|pentan} \par
@@ -1041,6 +1043,9 @@ and \cs*{textsuperscript} instead of \sym{\textasciicircum} without
\command{chemprime}
Prints\sinceversion{5.3} a prime character in superscript position. It is
defined as \verbcode+\ensuremath{{}^{\prime}}+.
+ \command{nonbreakinghyphen}
+ Prints\sinceversion{5.8c} a hyphen which doesn't allow a linebreak after
+ it. It is defined as \verbcode+\mbox{-}\nobreak\hspace{0pt}+.
\end{commands}
The spaces inserted by \sym{-} and \sym{\textbar} can be
@@ -1983,7 +1988,7 @@ preamble:
% No error will be raised if a translation of \meta{key} already exists.
% This command can only be used in the preamble and is defined by the
% \pkg{translations} package.
- \command{DeclareChemTranslation}[\marg{language}\marg{key}\marg{translation}]
+ \command{DeclareChemTranslation}[\marg{key}\marg{language}\marg{translation}]
\sinceversion{5.6}A command which makes an abstraction from the
\pkg{translations} package. It should be used in documents for adding
missing translations that are needed. This command can only be used in
@@ -2262,7 +2267,7 @@ changed.
overlay,
p/color = black!70
}
- \setbondoffset{0pt}
+ \setchemfig{bond offset=0pt}
\chemfig{
?\orbital{p}
-[,1.3]{\orbital[phase=-]{p}}
@@ -2276,7 +2281,7 @@ changed.
\begin{example}
\vspace{7mm}
- \setbondoffset{0pt}
+ \setchemfig{bond offset = 0pt}
\chemsetup[orbital]{
overlay ,
opacity = .75 ,
@@ -2352,7 +2357,7 @@ implements the following macro based on the same idea:
\end{options}
\begin{example}
- \setatomsep{2em}
+ \setchemfig{atom sep=2em}
\chemfig{-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
\makepolymerdelims{5pt}[27pt]{op}{cl}
\chemfig{-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
diff --git a/macros/latex/contrib/practicalreports/README b/macros/latex/contrib/practicalreports/README
new file mode 100644
index 0000000000..24a20b25aa
--- /dev/null
+++ b/macros/latex/contrib/practicalreports/README
@@ -0,0 +1,18 @@
+%% practicalreports.zip
+%% Copyright 2019 J. Cawood
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is J. Cawood.
+%
+
+
+This package provides a handful of macros for writing up science practical reports. \ No newline at end of file
diff --git a/macros/latex/contrib/practicalreports/practicalreports.pdf b/macros/latex/contrib/practicalreports/practicalreports.pdf
new file mode 100644
index 0000000000..3846092595
--- /dev/null
+++ b/macros/latex/contrib/practicalreports/practicalreports.pdf
Binary files differ
diff --git a/macros/latex/contrib/practicalreports/practicalreports.sty b/macros/latex/contrib/practicalreports/practicalreports.sty
new file mode 100644
index 0000000000..3f81259621
--- /dev/null
+++ b/macros/latex/contrib/practicalreports/practicalreports.sty
@@ -0,0 +1,161 @@
+%%Author: Justin Cawood
+%%License: LPPL 1.3c
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{practicalreports}[25/09/2019 v2.0.0 Practical Report Package]
+\RequirePackage{mathtools, array, longtable, scrextend, float, fancyhdr, lastpage}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\shift}[2]{
+\begin{addmargin}[#1cm]{0cm}
+\begin{minipage}{\textwidth}
+#2
+\end{minipage}
+\end{addmargin}
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%Create a new title page
+%\newtitlepage{Title}{Author}{Date}
+\newcommand*{\newtitlepage}[3]{
+\begin{titlepage}
+ \vspace*{\fill}
+ \begin{center}
+ {\Huge #1}\\[0.5cm]
+ {\Large #2}\\[0.4cm]
+ {\small #3}
+ \end{center}
+ \vspace*{\fill}
+ \end{titlepage}
+}
+
+%Add a new figure
+\newcommand*{\newfigure}[4]{
+\begin{figure}[H]
+ \centering \textbf{#1} \par\medskip
+ \center{\includegraphics[width=\textwidth]
+ {#3}}
+ \caption{#2}
+ \label{fig:#4}
+\end{figure}
+}
+
+%Add a new scalable figure
+\newcommand*{\newsfigure}[5]{
+\begin{figure}[H]
+ \centering \textbf{#1} \par\medskip
+ \center{\includegraphics[scale=#5]
+ {#3}}
+ \caption{#2}
+ \label{fig:#4}
+\end{figure}
+}
+
+%Reference a labeled figure
+\newcommand*{\reffigure}[1]{Figure~\ref{fig:#1}}
+
+%Create a table
+%\newtable{Caption}
+%{Columns and Alignment}
+%{Column Headings}
+%{Table Data}
+\newcommand*{\newtable}[5]{
+\begin{table}[H]
+\begin{center}
+\caption{#1}
+\vspace*{5mm}
+\begin{tabular}{#2}
+\hline
+#3\\
+\hline
+#4\\
+\hline
+\end{tabular}
+\label{table:#5}
+\end{center}
+\end{table}
+}
+
+%Create a long table
+%\newlongtable{Caption}
+%{Columns and Alignment}
+%{Column Headings}
+%{Table Data}
+\newcommand{\newlongtable}[5]{
+\begin{center}
+\begin{longtable}{#2}
+\label{table:#5} \\
+\caption{#1} \\
+\hline
+#3 \\
+\hline
+\endfirsthead
+\caption{\textit{Continued}} \\
+\hline
+#3 \\
+\hline
+\endhead
+\hline\\
+\endfoot
+\hline
+\endlastfoot
+#4
+\end{longtable}
+\end{center}
+}
+
+%Reference a labeled table
+\newcommand*{\reftable}[1]{Table~\ref{table:#1}}
+
+%Box and solotion or multiple lines of solutions
+\newcommand*{\boxanswer}[1]{
+\begin{equation*}
+ \addtolength{\fboxsep}{5pt}
+ \boxed{
+ \begin{gathered}
+ #1
+ \end{gathered}
+ }
+\end{equation*}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+%Multipleys a number by 10^{user input}
+\newcommand*{\E}[1]{$\times10^{#1}$}
+
+%Multipleys a number by 10^{user input}
+\newcommand*{\e}[1]{\times10^{#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\setpagefancy}{
+\pagestyle{fancy}
+\fancyhf{}
+}
+
+%Add a header to all pages
+\newcommand*{\header}[3]{
+\lhead{#1}
+\chead{#2}
+\rhead{#3}
+}
+
+%Add a footer to all pages
+\newcommand*{\footer}[3]{
+\lfoot{#1}
+\cfoot{#2}
+\rfoot{#3}
+}
+
+%Add a footer to all pages
+\newcommand*{\goodfoot}{
+\cfoot{Page \thepage \ of \pageref{LastPage}}
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+} \ No newline at end of file
diff --git a/macros/latex/contrib/practicalreports/practicalreports.tex b/macros/latex/contrib/practicalreports/practicalreports.tex
new file mode 100644
index 0000000000..7b6e2e811e
--- /dev/null
+++ b/macros/latex/contrib/practicalreports/practicalreports.tex
@@ -0,0 +1,325 @@
+\documentclass[12pt]{article}
+
+\usepackage[right=1in, top=1in, left=1in, bottom=1in]{geometry}
+\usepackage{amssymb,amsmath, mathtools}
+
+\usepackage[parfill]{parskip}
+
+\usepackage{practicalreports}
+
+
+\begin{document}
+
+\begin{titlepage}
+\vspace*{\fill}
+\begin{center}
+{\Huge Practical Reports Documentation}\\[0.5cm]
+{\Large Version: 2.0.0}\\[0.4cm]
+{\Large Date: $25^{th}$ of September 2019}\\[0.2cm]
+{\small Author: Justin Cawood}
+\end{center}
+\vspace*{\fill}
+\end{titlepage}
+
+\tableofcontents
+\newpage
+
+\section{Practical Reports Package}
+This package provides macros for displaying scientific notation, simple title pages, tables, figures, headers footers.
+
+\section{Importing the Package}
+Import the package by typing $\backslash$usepackage\{practicalreports\} at the top of the tex file.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Exponent Macro}
+This macro is much quicker and easier than the rest of the scientific notation macros in this package.
+
+\subsection{How to use it}
+To use this macro simply type "\textbf{value} $\backslash$E\{Power\} \textbf{units}". eg. 2.997 $\backslash$E\{8\} m\$s\^\ \{-1\}\$ This will output 2.997\E{8} m$s^{-1}$. The \textbf{value} and \textbf{units} are not required, so the macro can be also used like this, $\backslash$E\{8\}, this will output \E{8}.
+
+\subsection{Useful tricks}
+\textbf{\!\!\! If you are already in math mode use $\backslash$e instead\!\!\! }
+
+If the power/exponent being use in the scientific notation is only 1 number or character, there is no need for the curly brackets \{\}. It is much quicker to simply type $\backslash$E8 than to type $\backslash$E\{8\}. They both output the same result \E8. However this wont work for powers with more than one number or character eq. $\backslash$E88 will output \E88. Instead this will have to be written as $\backslash$E\{88\}, this will output \E{88}.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Setting the page to fancy}
+Before any headers or footers can be used the pages need to be set to fancy. This can be done by typing $\backslash$setpagefancy just below the import statements but not inside the $\backslash$begin\{document\} $\backslash$end\{document\}. Once the page is set to fancy the page numbering will go away, this can be added back in with the macros from this package. Before the page is set to fancy is shown in \reffigure{normal_page} and after the page is set to fancy is shown in \reffigure{fancy_page}
+
+\newfigure{Normal Page}{Normal page}{normal_page.png}{normal_page}
+
+\newfigure{Setting the page to fancy}{Output of the macro $\backslash$setpagefancy}{fancy_page.png}{fancy_page}
+
+\subsection{Headers}
+To add a header use the macro $\backslash$header\{left header\}\{center header\}\{right header\}. An example is shown in below and in \reffigure{fancy_header}.
+
+$\backslash$header\{left header\}\{center header\}\{right header\} this will display
+
+\newfigure{Adding a fancy header}{Output of the macro $\backslash$header\{left header\}\{center header\}\{right header\}}{fancy_header.png}{fancy_header}
+
+\subsection{Footers}
+To add a footer use the macro $\backslash$footer\{left footer\}\{center footer\}\{right footer\}. An example is shown below and in \reffigure{fancy_footer}.
+
+$\backslash$footer\{left footer\}\{center footer\}\{right footer\} this will display
+
+\newfigure{Adding a fancy footer}{Output of the macro $\backslash$footer\{left footer\}\{center footer\}\{right footer\}}{fancy_footer.png}{fancy_footer}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Title Page}
+To create a title page, at the beginning of the document after the $\backslash$begin\{document\} type $\backslash$newtitlepage\{Title\}\{Author\}\{Date\}
+An example is shown below and the result is shown in \reffigure{new-title-page}
+
+
+\newfigure{New title page}{Result of $\backslash$newtitlepage\{Title\}\{Author\}\{Date\}}{new_title_page.png}{new-title-page}
+
+\section{Figures}
+These macros can include figures and reference them in a tex file.
+
+\subsection{Including a Figure}
+To include a figure type $\backslash$newfigure\{Caption\}\{Description\}\{file\_ name.jpg\}\{reference\}.\\ \LaTeX \ accepts the file types pdf, jpg and png for figures. \reffigure{example-figure} is an example of using this macro.
+
+\newfigure{Example Figure}{Result of using $\backslash$newfigure\{Caption\}\{Description\}\{file name\}\{reference\}}{example_figure.jpeg}{example-figure}
+
+\subsection*{Scaling Figures}
+This macro allows you to shrink figures that are two large or expand figures that are too small.
+The macro is in the form
+
+$\backslash$newsfigure\{Caption\}\{Description\}\{file\_ name.jpg\}\{reference\}\{scale factor\}
+
+\subsubsection{Shrink Example}
+\reffigure{example-shrink-figure}, shows an example of decreasing the size of a figure.
+
+\newsfigure{Example Figure}{Result of using $\backslash$newfigure\{Caption\}\{Description\}\{file name\}\{reference\}\{0.4\}}{example_figure.jpeg}{example-shrink-figure}{0.4}
+
+\subsubsection{Expand Example}
+\reffigure{example-expand-figure}, shows an example of increasing the size of a figure.
+
+\newsfigure{Example Figure}{Result of using $\backslash$newfigure\{Caption\}\{Description\}\{file name\}\{reference\}\{1.6\}}{example_figure.jpeg}{example-expand-figure}{1.6}
+
+\subsection{Referencing a Figure}
+This macro allows figures to be referenced by simply typing $\backslash$reffigure\{reference\}. If a figure is ever added or removed, this macro will take care of the numbering so the figures are always referenced correctly. An example is shown below.
+
+$\backslash$reffigure\{example-figure\} this will output "\reffigure{example-figure}". This is the from the section of how to include a figure. Sometimes instead of displaying "\reffigure{example-figure}", instead it might display Figure ??. This can be fixed by building the tex file a second time. If this does not work then the reference inside the \{\} is wrong.
+
+
+\section{Tables}
+These macros can create normal tables, long tables and reference tables.
+The difference be normal tables and long tables is, once a normal table becomes large than the size of an entire page the extra content will be cut off so the table fits the page. However a long table when is becomes larger than an entire page the extra content will be pushed to the next page.
+
+\subsection{Creating a Table}
+To create a normal table use the macro
+
+$\backslash$newtable\{Caption\}
+\{Column Data Positioning\}
+\{Column Headings\}
+\{Table Data\}\\
+\{Reference\}
+
+It is often more readable to type the macro in the form below.
+
+$\backslash$newtable\{Caption\} \\
+\{Column Data Positioning\} \\
+\{Column Headings\} \\
+\{Table Data\} \\
+\{Reference\}
+
+An example of a normal table is show below and the output is \reftable{Normal-Table}
+
+$\backslash$newtable\{Normal Table Example\} \\
+\{lcr\} \\
+\{Left Positioned Column \& Center Positioned Column \& Right Positioned Column\} \\
+\{1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3\} \\
+\{Normal-Table\}
+
+\newtable{Normal Table Example}
+{lcr}
+{Left Positioned Column & Center Positioned Column & Right Positioned Column} {1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3}
+{Normal-Table}
+
+The "Column Data Positioning" field is required. It accepts any of the three positioning values "l = left c = center r = right", each column need to have a positioning value eg. if there are two columns the possible positions are " ll, lc, lr, cl, cc, cr, rl, rc, or rr". The positioning field is required however the other fields aren't. But to display something in the table the each field will need something.
+
+\subsection{Creating a Long Table}
+The long table macro is very similar to the normal table macro
+To create a long table use the macro
+
+$\backslash$newlongtable\{Caption\}
+\{Column Data Positioning\}
+\{Column Headings\}
+\{Table Data\}
+\{Reference\}
+
+It is often more readable to type the macro in the form below.
+
+$\backslash$newlongtable\{Caption\} \\
+\{Column Data Positioning\} \\
+\{Column Headings\} \\
+\{Table Data\} \\
+\{Reference\}
+
+An example of a long table is show below and the output is \reftable{Long-Table}
+
+$\backslash$newlongtable\{Long Table Example\} \\
+\{lcr\} \\
+\{Left Positioned Column \& Center Positioned Column \& Right Positioned Column\} \\
+\{1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3 $\backslash$ $\backslash$ \\
+1 \& 2 \& 3\} \\
+\{Long-Table\}
+
+\newlongtable{Long Table Example}
+{lcr}
+{Left Positioned Column & Center Positioned Column & Right Positioned Column}
+{1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3 \\
+1 & 2 & 3}
+{Long-Table}
+
+Clearly this table was too long to fit on the previous page so the long table macro pushes the excess to the next page. A normal table would have cut off the excess and wouldn't have displayed it.
+
+The column positioning for a long table is the same as for a normal table.
+
+\subsection{Referencing a Table}
+To reference a table the macro $\backslash$reftable\{reference\} can be used. If a table is ever added or removed, this macro will take care of the numbering so the tables are always referenced correctly.
+Below is an example of referencing tables.
+
+$\backslash$reftable\{Normal-Table\} is the example normal table used in this manual.
+This will output "\reftable{Normal-Table} is the example normal table used in this manual."
+
+Another example is shown below
+
+$\backslash$reftable\{Long-Table\} is the example long table used in this manual.
+This will output "\reftable{Long-Table} is the example normal table used in this manual."
+
+\section{Boxing Content}
+To place a box around content simply use the macro $\backslash$boxanswer\{Content To be boxed\} this will output
+
+\boxanswer{Content To be boxed}
+
+The words are joined together and displayed differently because this macro is already in math mode. So to display normal text use the $\backslash$text\{\} macro. So the previous example an be written as
+
+$\backslash$boxanswer\{$\backslash$text\{Content To be boxed\}\}
+This will display
+
+\boxanswer{\text{Content To be boxed}}
+
+Most of the time this will be used to box an answer to a maths question. An example of this is shown below.
+
+$\backslash$boxanswer\{$y = mx + c \\
+E = mc^2\\
+E = hf$\}
+
+This will out put
+
+\boxanswer{y = mx + c \\
+E = mc^2\\
+E = hf}
+
+\section{Other Macros}
+
+\subsection{Shift}
+The shift macro allows you to shift content left or right. $\backslash$shift\{shift amount in cm\}\{content to be shifted\}.
+
+Tables can be shifted.
+
+\subsection{Good Footer}
+
+The $\backslash$goodfoot macro will do the footer for you in the form "Page x of n". The page mus be set to fancy first though using the $\backslash$setpagefancy macro.
+
+\section{Appendices}
+
+\subsection{Appendix A - List of Figures}
+
+\listoffigures
+
+\subsection{Appendix B - List of Tables}
+
+\listoftables
+
+\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/pythontex/NEWS.rst b/macros/latex/contrib/pythontex/NEWS.rst
index 016a740794..b0eccb7df5 100644
--- a/macros/latex/contrib/pythontex/NEWS.rst
+++ b/macros/latex/contrib/pythontex/NEWS.rst
@@ -7,6 +7,57 @@ Version History
===============
+v0.17 (2019/09/22)
+------------------
+
+* Pygments syntax highlighting for the Python console (``pycon`` lexer) now
+ uses the ``python3`` option, and the default Python lexer is now
+ ``python3`` (#156).
+
+* Added support for JavaScript (#147; thanks to Nathan Carter).
+
+* Updated Julia support for Julia versions 0.6 (#107), and 0.7 and 1.0 (#126,
+ #130).
+
+* There are now meaningful error messages for the Julia console when Weave.jl
+ is not installed or raises errors (#131).
+
+* ``pythontexcustomcode`` and ``\pythontexcustomc`` now set
+ ``pytex.context`` (#65).
+
+* Added support for R. The ``R`` family of commands and environments
+ (``\R``, ``\Rc``, ``Rcode``, ...) executes code as a script.
+ There is currently no utilities class or equivalent. The ``Rcon`` family
+ (``Rconsole``) executes code to emulate an interactive R session (#121).
+
+* ``fancyvrb`` settings from ``\setpythontexfv`` and console
+ environments now work with Julia and R consoles.
+
+* ``pythontexcustomcode`` now works with ``juliacon``. There are now proper
+ ``juliaconcode`` and ``Rconcode`` environments that execute code but
+ typeset nothing, to parallel ``pyconcode`` (#134).
+
+* Added support for Perl with the ``perl`` and ``pl`` families of commands
+ and environments. There is currently no utilities class or equivalent.
+
+* Added support for Perl 6 with the ``perlsix`` and ``psix`` families of
+ commands and environments (#104). There is currently no utilities class or
+ equivalent.
+
+* Updated Rust support by using ``dyn`` with traits in utilities object.
+
+* Under Windows, capitalization of script paths in ``stderr`` is now
+ preserved.
+
+* Fixed a bug that prevented the ``sub`` environment from working with
+ ``depythontex`` (#155).
+
+* Fixed a bug in checking mtime of dependencies to see if they have been
+ modified while ``pythontex`` is running. The check failed for dependencies
+ that do not exist or were deleted before ``pythontex`` can read them
+ (#136).
+
+
v0.16 (2017/07/20)
------------------
diff --git a/macros/latex/contrib/pythontex/README b/macros/latex/contrib/pythontex/README
index 5625993676..3994eca34c 100644
--- a/macros/latex/contrib/pythontex/README
+++ b/macros/latex/contrib/pythontex/README
@@ -3,15 +3,16 @@
===================================================================
:Author: Geoffrey Poore
-:Version: 0.16 (2017/07/20)
+:Version: 0.17 (2019/09/22)
:License: LPPL v1.3 or later (LaTeX code) and BSD 3-Clause (Python code)
:Development: https://github.com/gpoore/pythontex
:Requirements: Python 2.7 or 3.2+; Pygments
-The PythonTeX package allows you to enter Python code within a LaTeX
-document, execute the code, and access its output in the original document.
-It also supports the Ruby, Julia, Octave, Sage, Bash, and Rust languages.
+The PythonTeX package allows you to enter Python code within a LaTeX document,
+execute the code, and access its output in the original document. It also
+supports the Ruby, Julia, Octave, Sage, Bash, Rust, R, Perl, Perl 6, and
+JavaScript languages.
PythonTeX provides fast, user-friendly access to Python from within LaTeX.
Python code is only executed when it has been modified, or when it meets
diff --git a/macros/latex/contrib/pythontex/depythontex2.py b/macros/latex/contrib/pythontex/depythontex2.py
index 7687e0e724..f49fd22977 100644
--- a/macros/latex/contrib/pythontex/depythontex2.py
+++ b/macros/latex/contrib/pythontex/depythontex2.py
@@ -86,7 +86,7 @@ import codecs
# Script parameters
# Version
-__version__ = '0.16'
+__version__ = '0.17'
# Functions and parameters for customizing the script output
diff --git a/macros/latex/contrib/pythontex/depythontex3.py b/macros/latex/contrib/pythontex/depythontex3.py
index bdcea2185e..2d86edb591 100644
--- a/macros/latex/contrib/pythontex/depythontex3.py
+++ b/macros/latex/contrib/pythontex/depythontex3.py
@@ -86,7 +86,7 @@ import codecs
# Script parameters
# Version
-__version__ = '0.16'
+__version__ = '0.17'
# Functions and parameters for customizing the script output
diff --git a/macros/latex/contrib/pythontex/pythontex.dtx b/macros/latex/contrib/pythontex/pythontex.dtx
index d91e6e1eac..f18d8d3fae 100644
--- a/macros/latex/contrib/pythontex/pythontex.dtx
+++ b/macros/latex/contrib/pythontex/pythontex.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2012-2017 by Geoffrey M. Poore <gpoore@gmail.com>
+% Copyright (C) 2012-2019 by Geoffrey M. Poore <gpoore@gmail.com>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -26,7 +26,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{pythontex}
%<*package>
- [2017/07/20 v0.16 execute and typeset Python code and other languages]
+ [2019/09/22 v0.17 execute and typeset Python code and other languages]
%</package>
%
%<*driver>
@@ -40,6 +40,20 @@
\usepackage{environ}
\usepackage{enumitem}
\usepackage{fvextra}
+% The typesetting for macrocode doesn't use \@noligs, which upquote modifies.
+% So apply the upquote fix to \verbatim@nolig@list as well, which is in macrocode.
+\begingroup
+\catcode`'=\active
+\catcode``=\active
+\g@addto@macro\verbatim@nolig@list{%
+ \let'\textquotesingle
+ \let`\textasciigrave
+ \ifx\encodingdefault\upquote@OTone
+ \ifx\ttdefault\upquote@cmtt
+ \def'{\char13 }%
+ \def`{\char18 }%
+ \fi\fi}
+\endgroup
\usepackage{pythontex}
\usepackage{hyperref}
\hypersetup{
@@ -134,7 +148,7 @@
%</driver>
% \fi
%
-% \CheckSum{3218}
+% \CheckSum{3289}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -153,7 +167,27 @@
% Right brace \} Tilde \~}
%
%
-
+%
+% \begin{changelog}{v0.17}{2019/09/22}
+% \begin{itemize}
+% \item Pygments syntax highlighting for the Python console (\texttt{pycon} lexer) now uses the \texttt{python3} option, and the default Python lexer is now \texttt{python3} (\#156).
+% \item Added support for JavaScript (\#147; thanks to Nathan Carter).
+% \item Updated Julia support for Julia versions 0.6 (\#107), and 0.7 and 1.0 (\#126, \#130).
+% \item There are now meaningful error messages for the Julia console when Weave.jl is not installed or raises errors (\#131).
+% \item \texttt{pythontexcustomcode} and \texttt{\string\pythontexcustomc} now set \texttt{pytex.context} (\#65).
+% \item Added support for R. The \texttt{R} family of commands and environments (\texttt{\string\R}, \texttt{\string\Rc}, \texttt{Rcode}, ...) executes code as a script. There is currently no utilities class or equivalent. The \texttt{Rcon} family (\texttt{Rconsole}) executes code to emulate an interactive R session (\#121).
+% \item \texttt{fancyvrb} settings from \texttt{\string\setpythontexfv} and console environments now work with Julia and R consoles.
+% \item \texttt{pythontexcustomcode} now works with \texttt{juliacon}. There are now proper \texttt{juliaconcode} and \texttt{Rconcode} environments that execute code but typeset nothing, to parallel \texttt{pyconcode} (\#134).
+% \item Added support for Perl with the \texttt{perl} and \texttt{pl} families of commands and environments. There is currently no utilities class or equivalent.
+% \item Added support for Perl 6 with the \texttt{perlsix} and \texttt{psix} families of commands and environments (\#104). There is currently no utilities class or equivalent.
+% \item Updated Rust support by using \texttt{dyn} with traits in utilities object.
+% \item Under Windows, capitalization of script paths in \texttt{stderr} is now preserved.
+% \item Fixed a bug that prevented the \texttt{sub} environment from working with \texttt{depythontex} (\#155).
+% \item Fixed a bug in checking mtime of dependencies to see if they have been modified while \texttt{pythontex} is running. The check failed for dependencies that do not exist or were deleted before \texttt{pythontex} can read them (\#136).
+% \end{itemize}
+% \end{changelog}
+%
+%
% \begin{changelog}{v0.16}{2017/07/20}
% \begin{itemize}
% \item Added preliminary console support for Julia (\#98).
@@ -436,8 +470,9 @@
%
% Because documents that use \pytex\ mix \LaTeX\ and Python code, they are less suitable than plain \LaTeX\ documents for journal submission, sharing, and conversion to other formats. \pytex\ includes a |depythontex| utility that creates a copy of a document in which all \pytex\ content is replaced by its output.
%
-% While Python is the focus of \pytex, adding basic support for an additional language is usually as simple as creating a new class instance and a few templates, usually totaling less than 100 lines of code. The following languages already have built-in support: Ruby, Julia, and Octave.
+% While Python is the focus of \pytex, adding basic support for an additional language is usually as simple as creating a new class instance and a few templates, usually totaling less than 100 lines of code. The following languages already have built-in support: Ruby, Julia, Octave, Bash, Rust, R, Perl, Perl 6, and JavaScript.
% \end{abstract}
+%
%
%
% \section*{\centering Warning}
@@ -660,7 +695,7 @@
%
% \DescribeMacro{usefamily=\meta{basename}/\marg{basename1,~basename2,~...}}
%
-% By default, only the |py|, |sympy|, and |pylab| families of commands and environments are defined, to prevent possible package conflicts.\footnote{For example, a \texttt{\string\ruby} command for Ruby code, and the \texttt{\string\ruby} command defined by the Ruby package in the \href{http://www.ctan.org/pkg/cjk}{CJK package}.} This option defines preconfigured families for other available languages. It takes either a single language base name, or a list of comma-separated names enclosed in curly braces. Currently, the Ruby families |rb| and |ruby|, the Julia families |jl| and |julia|, and the Octave family |octave| may be created.
+% By default, only the |py|, |sympy|, and |pylab| families of commands and environments are defined, to prevent possible package conflicts.\footnote{For example, a \texttt{\string\ruby} command for Ruby code, and the \texttt{\string\ruby} command defined by the Ruby package in the \href{http://www.ctan.org/pkg/cjk}{CJK package}.} This option defines preconfigured families for other available languages. It takes either a single language base name, or a list of comma-separated names enclosed in curly braces. For example, the Ruby families |rb| and |ruby|, the Julia families |jl| and |julia|, and the Octave family |octave| may be enabled. For a full list of supported languages, see \Cref{sec:other-languages}.
%
%
% \DescribeMacro{gobble=none/auto default:none}
@@ -1519,11 +1554,13 @@
% \section{Support for additional languages}
% \label{sec:other-languages}
%
-% Beginning with v0.12, it is much simpler to add support for languages beyond Python. Support for several additional languages will be added in coming months.
+% Details about adding support for additional languages are in \Cref{sec:other-languages:adding}. This section begins with a brief overview of supported languages and available features.
%
-% In the immediate future, support for additional languages will be part of \pytex. Later, it may make sense to provide an alternative interface for other languages. For example, a package could be created that provides access to \pytex\ internals in a language-agnostic manner, without having the word ``python'' as part of the command names.
-%
-% Languages beyond Python will typically not be enabled by default, to prevent potential macro naming conflicts with other packages. At least two possible base names for commands and environments will be provided for each language. Typically these will be the name of the language and the language's file extension. For example, Ruby has the |ruby| and |rb| base names. You can choose which base name to use for creating a family of commands and environments based on personal preference and potential naming conflicts.
+% Languages beyond Python are typically not be enabled by default to prevent potential macro naming conflicts with other packages. Languages are enabled via the |usefamily| package option (\Cref{sec:usage}). For example,
+%\begin{verbatim}
+%\usepackage[usefamily=ruby]{pythontex}
+%\end{verbatim}
+% Usually at least two possible base names for commands and environments will be provided for each language. Typically these will be the name of the language and the language's file extension. For example, Ruby has the |ruby| and |rb| base names. You can choose which base name to use for creating a family of commands and environments based on personal preference and potential naming conflicts.
%
%
% \subsection{Ruby}
@@ -1549,7 +1586,7 @@
%
% \subsubsection*{Console}
%
-% Preliminary Julia console support was added in v0.16, under the base name |juliacon|. Unlike the Python console environments that allow invalid input, currently everything entered in a |juliaconsole| environment must be valid. The Julia console uses \href{https://github.com/mpastell/Weave.jl}{\textsf{Weave.jl}} internally to evaluate code, and it currently does not support invalid input.
+% Julia console support was added in v0.16. It may be enabled by loading \pytex\ with |usefamily=juliacon|. The |juliaconsole| environment uses \href{https://github.com/mpastell/Weave.jl}{\textsf{Weave.jl}} internally to evaluate code. There is also a |juliaconcode| environment that executes code but typesets nothing.
%
%
% \subsection{Octave}
@@ -1587,7 +1624,40 @@
% Additionally, when using |\rust| and |\rs|, keep in mind that these wrap code in a block, so you \emph{cannot} use |rstex| by value in these contexts (both shared and mutable references are still fine, though).
%
%
+% \subsection{R}
+%
+% Support for R was added in v0.17.
+%
+% Loading \pytex\ with |usefamily=R| enables the |R| family of commands and environments (|\R|, |\Rc|, |Rcode|, ...). These execute code with |Rscript|. The |methods| library is loaded automatically as part of the template code. Expressions passed to the |\R| command are converted into strings via |toString()|. There is currently no utilities class or related features. A null graphics device, |pdf(file=NULL)|, is created by default to avoid the automatic, unintentional creation of plot files with default names. Plots that are to be saved require explicit graphics commands.
+%
+% \subsubsection*{Console}
+%
+% Loading \pytex\ with |usefamily=Rcon| enables the |Rconsole| environment, which executes code to emulate an interactive R session. There is also an |Rconcode| environment that executes code but typesets nothing. Code is executed with |Rscript|. The |methods| library is loaded automatically as part of the template code. The option |echo=TRUE| is used to intersperse code with output, while |error=function(){}| is used to avoid halting on errors. A null graphics device, |pdf(file=NULL)|, is created by default to avoid the automatic, unintentional creation of plot files with default names. Plots that are to be saved require explicit graphics commands.
+%
+%
+% \subsection{Perl}
+%
+% Support for Perl was added in v0.17.
+%
+% Loading \pytex\ with |usefamily=perl| enables the |perl| family of commands and environments. Alternatively, |usefamily=pl| may be used to enable the |pl| family. There is currently no utilities class or related features.
+%
+%
+% \subsection{Perl 6}
+%
+% Support for Perl 6 was added in v0.17.
+%
+% Loading \pytex\ with |usefamily=perlsix| enables the |perlsix| family of commands and environments. Alternatively, |usefamily=psix| may be used to enable the |psix| family. There is currently no utilities class or related features.
+%
+%
+% \subsection{JavaScript}
+%
+% Support for JavaScript was added in v0.17.
+%
+% Loading \pytex\ with |usefamily=javascript| enables the |javascript| family of commands and environments. Alternatively, |usefamily=js| may be used to enable the |js| family. There is a utilities object |jstex|.
+%
+%
% \subsection{Adding support for a new language}
+% \label{sec:other-languages:adding}
%
% Adding support for an additional language involves creating two templates, creating a new instance of a class, and using a \pytex\ macro. In some cases, additional changes may be necessary for full support. The information below does not deal with creating |console| families; additional support for user-defined |console| families will be added in the future.
%
@@ -1794,6 +1864,8 @@
%
% Thanks to Alexander Altman for suggesting Rust support and providing template code.
%
+% Thanks to Nathan Carter for suggesting JavaScript support and providing template code.
+%
%
% \PrintChangelog
%
@@ -1813,7 +1885,7 @@
% We store the name of the package in a macro for later use in warnings and error messages.
% \begin{macrocode}
\newcommand{\pytx@packagename}{PythonTeX}
-\newcommand{\pytx@packageversion}{0.16}
+\newcommand{\pytx@packageversion}{0.17}
% \end{macrocode}
%
% \subsection{Required packages}
@@ -3349,7 +3421,7 @@
}%
\xdef\pytx@type{CC:#2:#1}%
\edef\pytx@cmd{c}%
- \def\pytx@context{}%
+ \pytx@SetContext
\def\pytx@group{none}%
\let\pytx@InlineShow\@empty
\let\pytx@InlineSave\pytx@InlineSaveCode
@@ -3683,6 +3755,22 @@
}%
{\end{VerbatimOut}%
\xdef\pytx@stdfile{\pytx@type_\pytx@session_\pytx@group_\arabic{\pytx@counter}}%
+ \ifcsname pytx@nonpyconsole@\pytx@type\endcsname
+ \ifcsname pytx@code@as@console\endcsname
+ \setcounter{FancyVerbLine}{\value{\pytx@linecount}}%
+ \pytx@FVSet
+ \ifdefstring{\pytx@fvopttmp}{}{}{\expandafter\fvset\expandafter{\pytx@fvopttmp}}%
+ \pytx@ConfigPygments
+ \InputIfFileExists{\pytx@outputdir/\pytx@stdfile.stdout}%
+ {\DepyFile{p:\pytx@outputdir/\pytx@stdfile.stdout}}%
+ {\par\textbf{??~\pytx@packagename~??}\par
+ \PackageWarning{\pytx@packagename}{Non-existent console content}}%
+ \setcounter{\pytx@linecount}{\value{FancyVerbLine}}%
+ \else
+ \fi
+ \let\pytx@EnvAutoprint\relax
+ \else
+ \fi
\setcounter{FancyVerbLine}{\value{pytx@FancyVerbLineTemp}}%
\stepcounter{\pytx@counter}%
\pytx@EnvAutoprint
@@ -3699,6 +3787,8 @@
\ifstrempty{#1}{\edef\pytx@session{default}}{\StrSubstitute{#1}{:}{-}[\pytx@session]}%
\xdef\pytx@counter{pytx@\pytx@type @\pytx@session @\pytx@group}%
\pytx@CheckCounter{\pytx@counter}%
+ \edef\pytx@linecount{\pytx@counter @line}%
+ \pytx@CheckCounter{\pytx@linecount}%
\pytx@WriteCodefileInfo
\begingroup
\obeylines
@@ -3712,6 +3802,8 @@
% As described above, this macro captures a second optional argument, if present, and then starts the |VerbatimOut| environment. Note that |VerbatimOut| does not have a mandatory argument, because we are invoking our custom |\pytx@FVB@VerbatimOut| macro. The default |fancyvrb| macro needs an argument to tell it the name of the file to which to save the verbatim content. But in our case, we are always writing to the same file, and the custom macro accounts for this by not having a mandatory file name argument. We must perform the typical |FancyVerbLine| trickery, to prevent the |fancyvrb| line counter from being affected by \textbf{writing} content!
% \begin{macrocode}
\def\pytx@BeginCodeEnv@i[#1]{%
+ \def\pytx@fvopttmp{#1}%
+ \def\pytx@argspprint{#1}%
\setcounter{pytx@FancyVerbLineTemp}{\value{FancyVerbLine}}%
\let\FVB@VerbatimOut\pytx@FVB@VerbatimOut
\let\FVE@VerbatimOut\pytx@FVE@VerbatimOut
@@ -3742,7 +3834,7 @@
}%
\xdef\pytx@type{CC:#2:#1}%
\edef\pytx@cmd{code}%
- \def\pytx@context{}%
+ \pytx@SetContext
\def\pytx@group{none}%
\pytx@BeginCodeEnv[none]}%
{\end{VerbatimOut}%
@@ -3763,7 +3855,7 @@
\newcommand{\pytx@MakeSubFV}[1]{%
\expandafter\newenvironment{#1sub}{%
\VerbatimEnvironment
- \Depythontex{env:#1sub:om|:p}%
+ \Depythontex{env:#1sub:oo|:p}%
\xdef\pytx@type{#1}%
\edef\pytx@cmd{sub}%
\pytx@SetContext
@@ -4000,6 +4092,34 @@
% \end{macrocode}
% \end{macro}
%
+%
+% \begin{macro}{\makepythontexfamily@con}
+% This macro creates |console| and |code| environments for non-Python consoles. \pytex\ was not designed with commands and environments for non-Python consoles. Non-Python consoles are currently created via specially customized |code| environments. Note that simply creating these |console| and |code| environments is typically not enough to create non-Python consoles; |pythontex2.py| and |pythontex3.py| usually also require customization. This macro's definition should not be treated as stable; it will change in the future. The ultimate long-term goal is to eliminate it entirely, by redesigning the code execution core of \pytex\ to accomodate non-Python consoles more easily.
+% \begin{macrocode}
+\newcommand{\makepythontexfamily@con}[2][text]{%
+ \pgfkeys{/PYTX/family, name=#2con, default, pyglexer=#1, console=true}%
+ \expandafter\xdef\csname pytx@macroformatter@#2con\endcsname{\pytx@tmp@pprinter}%
+ \expandafter\gdef\csname pytx@fvsettings@#2con\endcsname{}%
+ \expandafter\xdef\csname pytx@pyglexer@#2con\endcsname{\pytx@tmp@pyglexer}%
+ \expandafter\xdef\csname pytx@pygopt@#2con\endcsname{\pytx@tmp@pygopt}%
+ \expandafter\xdef\csname pytx@console@#2con\endcsname{\pytx@tmp@console}%
+ \AtEndDocument{\immediate\write\pytx@codefile{pygfamily=#2con|%
+ \csname pytx@pyglexer@#2con\endcsname|%
+ \csname pytx@pygopt@#2con\endcsname}%
+ }%
+ \pytx@MakeCodeFV{#2con}%
+ \expandafter\global\expandafter\let\csname pytx@nonpyconsole@#2con\endcsname\relax
+ \newenvironment{#2console}%
+ {\VerbatimEnvironment
+ \def\pytx@type{#2con}%
+ \let\pytx@code@as@console\relax
+ \begin{#2concode}}%
+ {\end{#2concode}}%
+}
+% \end{macrocode}
+% \end{macro}
+
+%
% \begin{macro}{\setpythontexpyglexer}
% We need to be able to reset the lexer associated with a family after the family has already been created.
% \begin{macrocode}
@@ -4068,11 +4188,11 @@
%
% All of these command and environment families are created conditionally, depending on whether the package option |pygments| is used, via |\makepythontexfamily|. We recommend that any custom families created by the user be constructed in the same manner.
% \begin{macrocode}
-\makepythontexfamily[pyglexer=python]{py}
+\makepythontexfamily[pyglexer=python3]{py}
\makepythontexfamily[pyglexer=pycon, console=true]{pycon}
-\makepythontexfamily[pyglexer=python]{sympy}
+\makepythontexfamily[pyglexer=python3]{sympy}
\makepythontexfamily[pyglexer=pycon, console=true]{sympycon}
-\makepythontexfamily[pyglexer=python]{pylab}
+\makepythontexfamily[pyglexer=python3]{pylab}
\makepythontexfamily[pyglexer=pycon, console=true]{pylabcon}
% \end{macrocode}
% We also need to create any additional families specified via the |usefamily| package option.\footnote{The loop here is accomplished via \texttt{etoolbox}. \texttt{pgffor} might be an alternative, but making definitions global requires trickery.}
@@ -4081,24 +4201,7 @@
\ifstrequal{#1}{ruby}{\makepythontexfamily[pyglexer=ruby]{ruby}}{}%
\ifstrequal{#1}{rb}{\makepythontexfamily[pyglexer=ruby]{rb}}{}%
\ifstrequal{#1}{julia}{\makepythontexfamily[pyglexer=julia]{julia}}{}%
- \ifstrequal{#1}{juliacon}{\pgfkeys{/PYTX/family, name=juliacon, default, pyglexer=jlcon}%
- \expandafter\xdef\csname pytx@macroformatter@juliacon\endcsname{\pytx@tmp@pprinter}%
- \expandafter\gdef\csname pytx@fvsettings@juliacon\endcsname{}%
- \expandafter\xdef\csname pytx@pyglexer@juliacon\endcsname{\pytx@tmp@pyglexer}%
- \expandafter\xdef\csname pytx@pygopt@juliacon\endcsname{\pytx@tmp@pygopt}%
- \expandafter\xdef\csname pytx@console@juliacon\endcsname{\pytx@tmp@console}%
- \AtEndDocument{\immediate\write\pytx@codefile{pygfamily=juliacon|%
- \csname pytx@pyglexer@juliacon\endcsname|%
- \csname pytx@pygopt@juliacon\endcsname}%
- }%
- \pytx@MakeCodeFV{juliacon}%
- \newenvironment{juliaconsole}%
- {\VerbatimEnvironment
- \def\pytx@type{juliacon}%
- \pytx@ConfigPygments
- \begin{juliaconcode}}%
- {\end{juliaconcode}%
- \ifbool{pytx@opt@autoprint}{}{\printpythontex{}}}}{}%
+ \ifstrequal{#1}{juliacon}{\makepythontexfamily@con[jlcon]{julia}}{}%
\ifstrequal{#1}{jl}{\makepythontexfamily[pyglexer=julia]{jl}}{}%
\ifstrequal{#1}{matlab}{\makepythontexfamily[pyglexer=matlab]{matlab}}{}%
\ifstrequal{#1}{octave}{\makepythontexfamily[pyglexer=octave]{octave}}{}%
@@ -4106,6 +4209,14 @@
\ifstrequal{#1}{sage}{\makepythontexfamily[pyglexer=sage]{sage}}{}%
\ifstrequal{#1}{rust}{\makepythontexfamily[pyglexer=rust]{rust}}{}%
\ifstrequal{#1}{rs}{\makepythontexfamily[pyglexer=rust]{rs}}{}%
+ \ifstrequal{#1}{R}{\makepythontexfamily[pyglexer=r]{R}}{}%
+ \ifstrequal{#1}{Rcon}{\makepythontexfamily@con[rconsole]{R}}{}%
+ \ifstrequal{#1}{perl}{\makepythontexfamily[pyglexer=perl]{perl}}{}%
+ \ifstrequal{#1}{pl}{\makepythontexfamily[pyglexer=perl]{pl}}{}%
+ \ifstrequal{#1}{perlsix}{\makepythontexfamily[pyglexer=perl6]{perlsix}}{}%
+ \ifstrequal{#1}{psix}{\makepythontexfamily[pyglexer=perl6]{psix}}{}%
+ \ifstrequal{#1}{javascript}{\makepythontexfamily[pyglexer=js]{javascript}}{}%
+ \ifstrequal{#1}{js}{\makepythontexfamily[pyglexer=js]{js}}{}%
}
\expandafter\docsvlist\expandafter{\pytx@families}
% \end{macrocode}
diff --git a/macros/latex/contrib/pythontex/pythontex.ins b/macros/latex/contrib/pythontex/pythontex.ins
index 605cf4cc9b..aab14011f7 100644
--- a/macros/latex/contrib/pythontex/pythontex.ins
+++ b/macros/latex/contrib/pythontex/pythontex.ins
@@ -1,4 +1,4 @@
-%% Copyright (C) 2012-2016 by Geoffrey M. Poore <gpoore@gmail.com>
+%% Copyright (C) 2012-2019 by Geoffrey M. Poore <gpoore@gmail.com>
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -25,7 +25,7 @@
This is a generated file.
-Copyright (C) 2012-2016 by Geoffrey M. Poore <gpoore@gmail.com>
+Copyright (C) 2012-2019 by Geoffrey M. Poore <gpoore@gmail.com>
--------------------------------------------------------------------------
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/macros/latex/contrib/pythontex/pythontex.pdf b/macros/latex/contrib/pythontex/pythontex.pdf
index bd919b5a55..ad9183d3ac 100644
--- a/macros/latex/contrib/pythontex/pythontex.pdf
+++ b/macros/latex/contrib/pythontex/pythontex.pdf
Binary files differ
diff --git a/macros/latex/contrib/pythontex/pythontex2.py b/macros/latex/contrib/pythontex/pythontex2.py
index 871d394e37..34e151f417 100644
--- a/macros/latex/contrib/pythontex/pythontex2.py
+++ b/macros/latex/contrib/pythontex/pythontex2.py
@@ -13,7 +13,7 @@ should be in the same directory.
Licensed under the BSD 3-Clause License:
-Copyright (c) 2012-2017, Geoffrey M. Poore
+Copyright (c) 2012-2019, Geoffrey M. Poore
All rights reserved.
@@ -62,6 +62,7 @@ from pygments.styles import get_all_styles
from pythontex_engines import *
import textwrap
import platform
+import itertools
if sys.version_info[0] == 2:
try:
@@ -77,7 +78,7 @@ else:
# Script parameters
# Version
-__version__ = '0.16'
+__version__ = '0.17'
@@ -1213,9 +1214,13 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
# Must double-escape any backslashes so that they survive `shlex.split()`
script = basename
if os.path.isabs(os.path.expanduser(os.path.normcase(outputdir))):
- script_full = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(outputdir, basename))
else:
- script_full = os.path.expanduser(os.path.normcase(os.path.join(orig_cwd, outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(orig_cwd, outputdir, basename))
+ if platform.system() == 'Windows':
+ script_full = script_full.replace('/', '\\')
+ else:
+ script_full = script_full.replace('\\', '/')
# `shlex.split()` only works with Unicode after 2.7.2
if (sys.version_info.major == 2 and sys.version_info.micro < 3):
exec_cmd = shlex.split(bytes(command.format(file=script.replace('\\', '\\\\'), File=script_full.replace('\\', '\\\\'))))
@@ -1275,7 +1280,11 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
for key in code_dict:
family = key.split('#')[0]
# Uncomment the following for debugging, and comment out what follows
- '''run_code(encoding, outputdir, workingdir, code_dict[key],
+ '''run_code(encoding, outputdir,
+ workingdir,
+ cc_dict_begin[family],
+ code_dict[key],
+ cc_dict_end[family],
engine_dict[family].language,
engine_dict[family].commands,
engine_dict[family].created,
@@ -1287,9 +1296,12 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
engine_dict[family].linenumbers,
engine_dict[family].lookbehind,
keeptemps, hashdependencies,
- pygments_settings)'''
+ pygments_settings]))'''
tasks.append(pool.apply_async(run_code, [encoding, outputdir,
- workingdir, code_dict[key],
+ workingdir,
+ cc_dict_begin[family],
+ code_dict[key],
+ cc_dict_end[family],
engine_dict[family].language,
engine_dict[family].commands,
engine_dict[family].created,
@@ -1412,7 +1424,7 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
unresolved_sessions = []
for key in dependencies:
for dep, val in dependencies[key].items():
- if val[0] > start_time:
+ if val[0] is None or val[0] > start_time:
unresolved_dependencies = True
dependencies[key][dep] = (None, None)
unresolved_sessions.append(key.replace('#', ':'))
@@ -1474,7 +1486,8 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
-def run_code(encoding, outputdir, workingdir, code_list, language, commands,
+def run_code(encoding, outputdir, workingdir,
+ cc_begin_list, code_list, cc_end_list, language, commands,
command_created, extension, makestderr, stderrfilename,
code_index, errorsig, warningsig, linesig, stderrlookbehind,
keeptemps, hashdependencies, pygments_settings):
@@ -1512,11 +1525,19 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
err_file_name = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename + '.err')))
out_file = open(out_file_name, 'w', encoding=encoding)
err_file = open(err_file_name, 'w', encoding=encoding)
- script = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename)))
+ script = os.path.expanduser(os.path.join(outputdir, basename))
+ if platform.system() == 'Windows':
+ script = script.replace('/', '\\')
+ else:
+ script = script.replace('\\', '/')
if os.path.isabs(script):
script_full = script
else:
- script_full = os.path.expanduser(os.path.normcase(os.path.join(os.getcwd(), outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(os.getcwd(), outputdir, basename))
+ if platform.system() == 'Windows':
+ script_full = script_full.replace('/', '\\')
+ else:
+ script_full = script_full.replace('\\', '/')
# #### Need to revise so that intermediate files can be detected and cleaned up
for f in command_created:
files.append(f.format(file=script, File=script_full))
@@ -1535,7 +1556,10 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Add any created files due to the command
# This needs to be done before attempts to execute, to prevent orphans
try:
- proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=err_file)
+ if family != 'Rcon':
+ proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=err_file)
+ else:
+ proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=subprocess.STDOUT)
except WindowsError as e:
if e.errno == 2:
# Batch files won't be found when called without extension. They
@@ -1546,7 +1570,10 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# under Windows; a list is not required.
exec_cmd_string = ' '.join(exec_cmd)
exec_cmd_string = 'cmd /C "@echo off & call {0} & if errorlevel 1 exit 1"'.format(exec_cmd_string)
- proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=err_file)
+ if family != 'Rcon':
+ proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=err_file)
+ else:
+ proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=subprocess.STDOUT)
else:
raise
@@ -1567,15 +1594,21 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
messages.append('* PythonTeX error')
messages.append(' Missing output file for ' + key_run.replace('#', ':'))
errors += 1
+ elif family == 'juliacon' and proc.returncode == 1:
+ messages.append('* PythonTeX error')
+ messages.append(' Running code for Julia console failed')
+ with open(err_file_name, encoding='utf8') as f:
+ messages.append(f.read())
+ errors += 1
else:
if family == 'juliacon':
with open(out_file_name.rsplit('.', 1)[0] + '.tex', 'r', encoding=encoding) as f:
tex_data_lines = f.readlines()
- inst = 0
+ code_iter = itertools.chain(cc_begin_list, code_list, cc_end_list)
for n, line in enumerate(tex_data_lines):
if line.rstrip() == '\\begin{juliaterm}':
- tex_data_lines[n] = '=>PYTHONTEX:STDOUT#{0}#code#\n'.format(inst)
- inst += 1
+ c = next(code_iter)
+ tex_data_lines[n] = '=>PYTHONTEX:STDOUT#{0}#code#\n'.format(c.instance)
if n != 0:
tex_data_lines[n-1] = ''
if line.rstrip() == '\\end{juliaterm}':
@@ -1583,6 +1616,29 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
tex_data_lines.append('=>PYTHONTEX:DEPENDENCIES#\n=>PYTHONTEX:CREATED#\n')
with open(out_file_name, 'w', encoding=encoding) as f:
f.write(''.join(tex_data_lines))
+ elif family == 'Rcon':
+ with open(out_file_name, 'r', encoding=encoding) as f:
+ stdout_lines = f.readlines()
+ for n, line in enumerate(stdout_lines):
+ if line.startswith('> =>PYTHONTEX:'):
+ stdout_lines[n] = line[2:]
+ elif '> write("=>PYTHONTEX:' in line:
+ if line.startswith('> write("=>PYTHONTEX:'):
+ stdout_lines[n] = ''
+ else:
+ # cat() and similar functions can result in the
+ # prompt not being at the start of a new line. In
+ # that case, preserve the prompt to accurately
+ # emulate the console. If there is a following
+ # console environment, this effectively amounts
+ # to adding an extra empty line (pressing ENTER)
+ # between the two.
+ stdout_lines[n] = line.split('write("=>PYTHONTEX:', 1)[0]
+ while stdout_lines and (stdout_lines[-1].startswith('>') and not stdout_lines[-1][1:].strip(' \n')):
+ stdout_lines.pop()
+ stdout_lines.append('=>PYTHONTEX:DEPENDENCIES#\n=>PYTHONTEX:CREATED#\n')
+ with open(out_file_name, 'w', encoding=encoding) as f:
+ f.write(''.join(stdout_lines))
f = open(out_file_name, 'r', encoding=encoding)
out = f.read()
@@ -1640,7 +1696,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
else:
dependencies[dep] = (os.path.getmtime(dep_file), '')
- if family == 'juliacon':
+ if family in ('juliacon', 'Rcon'):
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import LatexFormatter
@@ -1655,16 +1711,21 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
for block in out.split('=>PYTHONTEX:STDOUT#')[1:]:
if block:
delims, content = block.split('#\n', 1)
+ if content and not content.endswith('\n'):
+ # Content might not end with a newline. For example,
+ # Rcon with something like cat() as the last function.
+ content += '\n'
instance, command = delims.split('#')
if content or command in ('s', 'sub'):
if instance.endswith('CC'):
- messages.append('* PythonTeX warning')
- messages.append(' Custom code for "' + family + '" attempted to print or write to stdout')
- messages.append(' This is not supported; use a normal code command or environment')
- messages.append(' The following content was written:')
- messages.append('')
- messages.extend([' ' + l for l in content.splitlines()])
- warnings += 1
+ if family not in ('juliacon', 'Rcon'):
+ messages.append('* PythonTeX warning')
+ messages.append(' Custom code for "' + family + '" attempted to print or write to stdout')
+ messages.append(' This is not supported; use a normal code command or environment')
+ messages.append(' The following content was written:')
+ messages.append('')
+ messages.extend([' ' + l for l in content.splitlines()])
+ warnings += 1
elif command == 'i':
content = r'\pytx@SVMCR{pytx@MCR@' + key_run.replace('#', '@') + '@' + instance + '}\n' + content.rstrip('\n') + '\\endpytx@SVMCR\n\n'
macros.append(content)
@@ -1682,7 +1743,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Remove newline added by printing, prevent
# LaTeX from adding a space after content
content = content.rsplit('\n', 1)[0] + '\\endinput\n'
- if family == 'juliacon':
+ if family in ('juliacon', 'Rcon'):
content = highlight(content, lexer[family], formatter[family])
f.write(content)
f.close()
@@ -1693,7 +1754,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
messages.append('* PythonTeX error')
messages.append(' Missing stderr file for ' + key_run.replace('#', ':'))
errors += 1
- elif family == 'juliacon':
+ elif family in ('juliacon', 'Rcon'):
pass
else:
# Open error and code files.
@@ -1733,7 +1794,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
index_next = index_now
start_errgobble = None
for n, line in enumerate(err_ud):
- if basename in line:
+ if basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
# Get the gobbleation. This is used to determine if
# other lines containing the basename are a continuation,
# or separate messages.
@@ -1779,7 +1840,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# both the error and warning patterns, default to
# error.
past_line = err_ud[index]
- if (index < n and basename in past_line):
+ if (index < n and basename in past_line and (family not in ('perlsix', 'psix') or '.p6:' in past_line or '.p6 line' in past_line)):
break
for pattern in warningsig:
if pattern in past_line:
@@ -1843,8 +1904,9 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
index_now_last = index_now
index_next_last = index_next
err_key_last_int = -1
+ p6_sorry_search = False
for n, line in enumerate(err_ud):
- if basename in line:
+ if basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
# Determine the corresponding line number in the document
found = False
for pattern in linesig:
@@ -1906,6 +1968,35 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
line = line.replace(fullbasename + '.' + extension, '<file>')
elif stderrfilename == 'genericscript':
line = line.replace(fullbasename + '.' + extension, '<script>')
+ if family in ('perlsix', 'psix'):
+ # Perl 6 "SORRY!" errors during compiling
+ # (before execution) need special processing,
+ # since they lack stderr delims and must
+ # include lines before the current one.
+ if p6_sorry_search: # Already handled
+ pass
+ else:
+ p6_sorry_search = True
+ p6_sorry_index = n - 1
+ while p6_sorry_index >= 0:
+ if not err_ud[p6_sorry_index].startswith('===SORRY!==='):
+ p6_sorry_index -= 1
+ continue
+ if errlinenum > index_now[1].lines_total + index_now[1].lines_input:
+ p6_linenum_offset = index_now[1].lines_total
+ else:
+ p6_linenum_offset = index_now[1].lines_total - index_now[1].lines_user + index_now[1].inline_count
+ p6_preceding_err_lines = [sub(r'line ([1-9][0-9]*)', lambda m: 'line {0}'.format(int(m.group(1)) - p6_linenum_offset), x) for x in err_ud[p6_sorry_index:n]]
+ if stderrfilename == 'full':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename, basename)
+ elif stderrfilename == 'session':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename, session)
+ elif stderrfilename == 'genericfile':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename + '.' + extension, '<file>')
+ elif stderrfilename == 'genericscript':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename + '.' + extension, '<script>')
+ err_dict[err_key].extend(p6_preceding_err_lines)
+ break
err_dict[err_key].append(line)
elif process:
err_dict[err_key].append(line)
@@ -1967,7 +2058,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Never process delimiting info until it is used
# Rather, store the index of the last delimiter
last_delim = line
- elif basename in line:
+ elif basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
found_basename = True
# Get the gobbleation. This is used to determine if
# other lines containing the basename are a continuation,
@@ -2122,7 +2213,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
else:
process = True
err_key = basename + '_' + instance
- elif process and basename in line:
+ elif process and basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
found = False
for pattern in linesig:
try:
@@ -2297,6 +2388,8 @@ def do_pygments(encoding, outputdir, fvextfile, pygments_list,
if codetype != ':GLOBAL':
p = pygments_settings[codetype]['formatter_options'].copy()
p['commandprefix'] = 'PYG'
+ if pygments_settings[codetype]['lexer'] == 'pycon':
+ p['python3'] = True
formatter[codetype] = LatexFormatter(**p)
lexer[codetype] = get_lexer_by_name(pygments_settings[codetype]['lexer'], **p)
@@ -2503,6 +2596,8 @@ def python_console(jobname, encoding, outputdir, workingdir, fvextfile,
from pygments.formatters import LatexFormatter
p = pygments_settings['formatter_options'].copy()
p['commandprefix'] = 'PYG'
+ if pygments_settings['lexer'] == 'pycon':
+ p['python3'] = True
formatter = LatexFormatter(**p)
lexer = get_lexer_by_name(pygments_settings['lexer'], **p)
else:
diff --git a/macros/latex/contrib/pythontex/pythontex3.py b/macros/latex/contrib/pythontex/pythontex3.py
index cb96f97d33..bc61f912ca 100644
--- a/macros/latex/contrib/pythontex/pythontex3.py
+++ b/macros/latex/contrib/pythontex/pythontex3.py
@@ -13,7 +13,7 @@ should be in the same directory.
Licensed under the BSD 3-Clause License:
-Copyright (c) 2012-2017, Geoffrey M. Poore
+Copyright (c) 2012-2019, Geoffrey M. Poore
All rights reserved.
@@ -62,6 +62,7 @@ from pygments.styles import get_all_styles
from pythontex_engines import *
import textwrap
import platform
+import itertools
if sys.version_info[0] == 2:
try:
@@ -77,7 +78,7 @@ else:
# Script parameters
# Version
-__version__ = '0.16'
+__version__ = '0.17'
@@ -1213,9 +1214,13 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
# Must double-escape any backslashes so that they survive `shlex.split()`
script = basename
if os.path.isabs(os.path.expanduser(os.path.normcase(outputdir))):
- script_full = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(outputdir, basename))
else:
- script_full = os.path.expanduser(os.path.normcase(os.path.join(orig_cwd, outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(orig_cwd, outputdir, basename))
+ if platform.system() == 'Windows':
+ script_full = script_full.replace('/', '\\')
+ else:
+ script_full = script_full.replace('\\', '/')
# `shlex.split()` only works with Unicode after 2.7.2
if (sys.version_info.major == 2 and sys.version_info.micro < 3):
exec_cmd = shlex.split(bytes(command.format(file=script.replace('\\', '\\\\'), File=script_full.replace('\\', '\\\\'))))
@@ -1275,7 +1280,11 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
for key in code_dict:
family = key.split('#')[0]
# Uncomment the following for debugging, and comment out what follows
- '''run_code(encoding, outputdir, workingdir, code_dict[key],
+ '''run_code(encoding, outputdir,
+ workingdir,
+ cc_dict_begin[family],
+ code_dict[key],
+ cc_dict_end[family],
engine_dict[family].language,
engine_dict[family].commands,
engine_dict[family].created,
@@ -1287,9 +1296,12 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
engine_dict[family].linenumbers,
engine_dict[family].lookbehind,
keeptemps, hashdependencies,
- pygments_settings)'''
+ pygments_settings]))'''
tasks.append(pool.apply_async(run_code, [encoding, outputdir,
- workingdir, code_dict[key],
+ workingdir,
+ cc_dict_begin[family],
+ code_dict[key],
+ cc_dict_end[family],
engine_dict[family].language,
engine_dict[family].commands,
engine_dict[family].created,
@@ -1412,7 +1424,7 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
unresolved_sessions = []
for key in dependencies:
for dep, val in dependencies[key].items():
- if val[0] > start_time:
+ if val[0] is None or val[0] > start_time:
unresolved_dependencies = True
dependencies[key][dep] = (None, None)
unresolved_sessions.append(key.replace('#', ':'))
@@ -1474,7 +1486,8 @@ def do_multiprocessing(data, temp_data, old_data, engine_dict):
-def run_code(encoding, outputdir, workingdir, code_list, language, commands,
+def run_code(encoding, outputdir, workingdir,
+ cc_begin_list, code_list, cc_end_list, language, commands,
command_created, extension, makestderr, stderrfilename,
code_index, errorsig, warningsig, linesig, stderrlookbehind,
keeptemps, hashdependencies, pygments_settings):
@@ -1512,11 +1525,19 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
err_file_name = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename + '.err')))
out_file = open(out_file_name, 'w', encoding=encoding)
err_file = open(err_file_name, 'w', encoding=encoding)
- script = os.path.expanduser(os.path.normcase(os.path.join(outputdir, basename)))
+ script = os.path.expanduser(os.path.join(outputdir, basename))
+ if platform.system() == 'Windows':
+ script = script.replace('/', '\\')
+ else:
+ script = script.replace('\\', '/')
if os.path.isabs(script):
script_full = script
else:
- script_full = os.path.expanduser(os.path.normcase(os.path.join(os.getcwd(), outputdir, basename)))
+ script_full = os.path.expanduser(os.path.join(os.getcwd(), outputdir, basename))
+ if platform.system() == 'Windows':
+ script_full = script_full.replace('/', '\\')
+ else:
+ script_full = script_full.replace('\\', '/')
# #### Need to revise so that intermediate files can be detected and cleaned up
for f in command_created:
files.append(f.format(file=script, File=script_full))
@@ -1535,7 +1556,10 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Add any created files due to the command
# This needs to be done before attempts to execute, to prevent orphans
try:
- proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=err_file)
+ if family != 'Rcon':
+ proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=err_file)
+ else:
+ proc = subprocess.Popen(exec_cmd, stdout=out_file, stderr=subprocess.STDOUT)
except WindowsError as e:
if e.errno == 2:
# Batch files won't be found when called without extension. They
@@ -1546,7 +1570,10 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# under Windows; a list is not required.
exec_cmd_string = ' '.join(exec_cmd)
exec_cmd_string = 'cmd /C "@echo off & call {0} & if errorlevel 1 exit 1"'.format(exec_cmd_string)
- proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=err_file)
+ if family != 'Rcon':
+ proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=err_file)
+ else:
+ proc = subprocess.Popen(exec_cmd_string, stdout=out_file, stderr=subprocess.STDOUT)
else:
raise
@@ -1567,15 +1594,21 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
messages.append('* PythonTeX error')
messages.append(' Missing output file for ' + key_run.replace('#', ':'))
errors += 1
+ elif family == 'juliacon' and proc.returncode == 1:
+ messages.append('* PythonTeX error')
+ messages.append(' Running code for Julia console failed')
+ with open(err_file_name, encoding='utf8') as f:
+ messages.append(f.read())
+ errors += 1
else:
if family == 'juliacon':
with open(out_file_name.rsplit('.', 1)[0] + '.tex', 'r', encoding=encoding) as f:
tex_data_lines = f.readlines()
- inst = 0
+ code_iter = itertools.chain(cc_begin_list, code_list, cc_end_list)
for n, line in enumerate(tex_data_lines):
if line.rstrip() == '\\begin{juliaterm}':
- tex_data_lines[n] = '=>PYTHONTEX:STDOUT#{0}#code#\n'.format(inst)
- inst += 1
+ c = next(code_iter)
+ tex_data_lines[n] = '=>PYTHONTEX:STDOUT#{0}#code#\n'.format(c.instance)
if n != 0:
tex_data_lines[n-1] = ''
if line.rstrip() == '\\end{juliaterm}':
@@ -1583,6 +1616,29 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
tex_data_lines.append('=>PYTHONTEX:DEPENDENCIES#\n=>PYTHONTEX:CREATED#\n')
with open(out_file_name, 'w', encoding=encoding) as f:
f.write(''.join(tex_data_lines))
+ elif family == 'Rcon':
+ with open(out_file_name, 'r', encoding=encoding) as f:
+ stdout_lines = f.readlines()
+ for n, line in enumerate(stdout_lines):
+ if line.startswith('> =>PYTHONTEX:'):
+ stdout_lines[n] = line[2:]
+ elif '> write("=>PYTHONTEX:' in line:
+ if line.startswith('> write("=>PYTHONTEX:'):
+ stdout_lines[n] = ''
+ else:
+ # cat() and similar functions can result in the
+ # prompt not being at the start of a new line. In
+ # that case, preserve the prompt to accurately
+ # emulate the console. If there is a following
+ # console environment, this effectively amounts
+ # to adding an extra empty line (pressing ENTER)
+ # between the two.
+ stdout_lines[n] = line.split('write("=>PYTHONTEX:', 1)[0]
+ while stdout_lines and (stdout_lines[-1].startswith('>') and not stdout_lines[-1][1:].strip(' \n')):
+ stdout_lines.pop()
+ stdout_lines.append('=>PYTHONTEX:DEPENDENCIES#\n=>PYTHONTEX:CREATED#\n')
+ with open(out_file_name, 'w', encoding=encoding) as f:
+ f.write(''.join(stdout_lines))
f = open(out_file_name, 'r', encoding=encoding)
out = f.read()
@@ -1640,7 +1696,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
else:
dependencies[dep] = (os.path.getmtime(dep_file), '')
- if family == 'juliacon':
+ if family in ('juliacon', 'Rcon'):
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import LatexFormatter
@@ -1655,16 +1711,21 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
for block in out.split('=>PYTHONTEX:STDOUT#')[1:]:
if block:
delims, content = block.split('#\n', 1)
+ if content and not content.endswith('\n'):
+ # Content might not end with a newline. For example,
+ # Rcon with something like cat() as the last function.
+ content += '\n'
instance, command = delims.split('#')
if content or command in ('s', 'sub'):
if instance.endswith('CC'):
- messages.append('* PythonTeX warning')
- messages.append(' Custom code for "' + family + '" attempted to print or write to stdout')
- messages.append(' This is not supported; use a normal code command or environment')
- messages.append(' The following content was written:')
- messages.append('')
- messages.extend([' ' + l for l in content.splitlines()])
- warnings += 1
+ if family not in ('juliacon', 'Rcon'):
+ messages.append('* PythonTeX warning')
+ messages.append(' Custom code for "' + family + '" attempted to print or write to stdout')
+ messages.append(' This is not supported; use a normal code command or environment')
+ messages.append(' The following content was written:')
+ messages.append('')
+ messages.extend([' ' + l for l in content.splitlines()])
+ warnings += 1
elif command == 'i':
content = r'\pytx@SVMCR{pytx@MCR@' + key_run.replace('#', '@') + '@' + instance + '}\n' + content.rstrip('\n') + '\\endpytx@SVMCR\n\n'
macros.append(content)
@@ -1682,7 +1743,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Remove newline added by printing, prevent
# LaTeX from adding a space after content
content = content.rsplit('\n', 1)[0] + '\\endinput\n'
- if family == 'juliacon':
+ if family in ('juliacon', 'Rcon'):
content = highlight(content, lexer[family], formatter[family])
f.write(content)
f.close()
@@ -1693,7 +1754,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
messages.append('* PythonTeX error')
messages.append(' Missing stderr file for ' + key_run.replace('#', ':'))
errors += 1
- elif family == 'juliacon':
+ elif family in ('juliacon', 'Rcon'):
pass
else:
# Open error and code files.
@@ -1733,7 +1794,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
index_next = index_now
start_errgobble = None
for n, line in enumerate(err_ud):
- if basename in line:
+ if basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
# Get the gobbleation. This is used to determine if
# other lines containing the basename are a continuation,
# or separate messages.
@@ -1779,7 +1840,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# both the error and warning patterns, default to
# error.
past_line = err_ud[index]
- if (index < n and basename in past_line):
+ if (index < n and basename in past_line and (family not in ('perlsix', 'psix') or '.p6:' in past_line or '.p6 line' in past_line)):
break
for pattern in warningsig:
if pattern in past_line:
@@ -1843,8 +1904,9 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
index_now_last = index_now
index_next_last = index_next
err_key_last_int = -1
+ p6_sorry_search = False
for n, line in enumerate(err_ud):
- if basename in line:
+ if basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
# Determine the corresponding line number in the document
found = False
for pattern in linesig:
@@ -1906,6 +1968,35 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
line = line.replace(fullbasename + '.' + extension, '<file>')
elif stderrfilename == 'genericscript':
line = line.replace(fullbasename + '.' + extension, '<script>')
+ if family in ('perlsix', 'psix'):
+ # Perl 6 "SORRY!" errors during compiling
+ # (before execution) need special processing,
+ # since they lack stderr delims and must
+ # include lines before the current one.
+ if p6_sorry_search: # Already handled
+ pass
+ else:
+ p6_sorry_search = True
+ p6_sorry_index = n - 1
+ while p6_sorry_index >= 0:
+ if not err_ud[p6_sorry_index].startswith('===SORRY!==='):
+ p6_sorry_index -= 1
+ continue
+ if errlinenum > index_now[1].lines_total + index_now[1].lines_input:
+ p6_linenum_offset = index_now[1].lines_total
+ else:
+ p6_linenum_offset = index_now[1].lines_total - index_now[1].lines_user + index_now[1].inline_count
+ p6_preceding_err_lines = [sub(r'line ([1-9][0-9]*)', lambda m: 'line {0}'.format(int(m.group(1)) - p6_linenum_offset), x) for x in err_ud[p6_sorry_index:n]]
+ if stderrfilename == 'full':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename, basename)
+ elif stderrfilename == 'session':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename, session)
+ elif stderrfilename == 'genericfile':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename + '.' + extension, '<file>')
+ elif stderrfilename == 'genericscript':
+ p6_preceding_err_lines[0] = p6_preceding_err_lines[0].replace(fullbasename + '.' + extension, '<script>')
+ err_dict[err_key].extend(p6_preceding_err_lines)
+ break
err_dict[err_key].append(line)
elif process:
err_dict[err_key].append(line)
@@ -1967,7 +2058,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
# Never process delimiting info until it is used
# Rather, store the index of the last delimiter
last_delim = line
- elif basename in line:
+ elif basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
found_basename = True
# Get the gobbleation. This is used to determine if
# other lines containing the basename are a continuation,
@@ -2122,7 +2213,7 @@ def run_code(encoding, outputdir, workingdir, code_list, language, commands,
else:
process = True
err_key = basename + '_' + instance
- elif process and basename in line:
+ elif process and basename in line and (family not in ('perlsix', 'psix') or '.p6:' in line or '.p6 line' in line):
found = False
for pattern in linesig:
try:
@@ -2297,6 +2388,8 @@ def do_pygments(encoding, outputdir, fvextfile, pygments_list,
if codetype != ':GLOBAL':
p = pygments_settings[codetype]['formatter_options'].copy()
p['commandprefix'] = 'PYG'
+ if pygments_settings[codetype]['lexer'] == 'pycon':
+ p['python3'] = True
formatter[codetype] = LatexFormatter(**p)
lexer[codetype] = get_lexer_by_name(pygments_settings[codetype]['lexer'], **p)
@@ -2503,6 +2596,8 @@ def python_console(jobname, encoding, outputdir, workingdir, fvextfile,
from pygments.formatters import LatexFormatter
p = pygments_settings['formatter_options'].copy()
p['commandprefix'] = 'PYG'
+ if pygments_settings['lexer'] == 'pycon':
+ p['python3'] = True
formatter = LatexFormatter(**p)
lexer = get_lexer_by_name(pygments_settings['lexer'], **p)
else:
diff --git a/macros/latex/contrib/pythontex/pythontex_engines.py b/macros/latex/contrib/pythontex/pythontex_engines.py
index 38fea5efc4..4928826bf1 100644
--- a/macros/latex/contrib/pythontex/pythontex_engines.py
+++ b/macros/latex/contrib/pythontex/pythontex_engines.py
@@ -17,7 +17,7 @@ document (script for execution).
-Copyright (c) 2012-2017, Geoffrey M. Poore
+Copyright (c) 2012-2018, Geoffrey M. Poore
All rights reserved.
Licensed under the BSD 3-Clause License:
http://www.opensource.org/licenses/BSD-3-Clause
@@ -33,7 +33,8 @@ from hashlib import sha1
from collections import OrderedDict, namedtuple
-interpreter_dict = {k:k for k in ('python', 'ruby', 'julia', 'octave', 'bash', 'sage', 'rustc')}
+interpreter_dict = {k:k for k in ('python', 'ruby', 'julia', 'octave', 'bash',
+ 'sage', 'rustc', 'Rscript', 'perl', 'perl6')}
# The {file} field needs to be replaced by itself, since the actual
# substitution of the real file can only be done at runtime, whereas the
# substitution for the interpreter should be done when the engine is
@@ -194,7 +195,7 @@ class CodeEngine(object):
if not isinstance(l, str):
raise TypeError('CodeEngine needs "linenumbers" to contain strings')
# Need to replace tags
- linenumbers = [l.replace('{number}', r'(\d+)') for l in linenumbers]
+ linenumbers = [r'(\d+)'.join(re.escape(x) for x in l.split('{number}')) if '{number}' in l else l for l in linenumbers]
self.linenumbers = linenumbers
# Type check lookbehind
@@ -950,7 +951,7 @@ julia_template = '''
# Currently, Julia only supports UTF-8
# So can't set stdout and stderr encoding
- type JuliaTeXUtils
+ mutable struct JuliaTeXUtils
id::AbstractString
family::AbstractString
session::AbstractString
@@ -983,8 +984,8 @@ julia_template = '''
function JuliaTeXUtils()
self = new()
self.self = self
- self._dependencies = Array(AbstractString, 0)
- self._created = Array(AbstractString, 0)
+ self._dependencies = AbstractString[]
+ self._created = AbstractString[]
self._context_raw = ""
function formatter(expr)
@@ -1095,7 +1096,7 @@ julia_wrapper = '''
jltex.line = "{line}"
println("{stdoutdelim}")
- write(STDERR, "{stderrdelim}\\n")
+ write(stderr, "{stderrdelim}\\n")
jltex.before()
{code}
@@ -1267,6 +1268,7 @@ CodeEngine('octave', 'octave', '.m',
octave_template, octave_wrapper, 'disp({code})', octave_sub,
'error', 'warning', 'line {number}')
+
bash_template = '''
cd "{workingdir}"
{body}
@@ -1297,7 +1299,7 @@ rust_template = '''
use std::{{borrow, collections, fmt, fs, io, iter, ops, path}};
use self::OpenMode::{{ReadMode, WriteMode, AppendMode, TruncateMode, CreateMode, CreateNewMode}};
pub struct UserAction<'u> {{
- _act: Box<FnMut() + 'u>
+ _act: Box<dyn FnMut() + 'u>
}}
impl<'u> UserAction<'u> {{
pub fn new() -> Self {{
@@ -1323,8 +1325,8 @@ rust_template = '''
impl<'u, U: Into<UserAction<'u>> + 'u> ops::Add<U> for UserAction<'u> {{
type Output = UserAction<'u>;
fn add(self, f: U) -> Self::Output {{
- let mut self_act: Box<FnMut() + 'u> = self._act;
- let mut other_act: Box<FnMut() + 'u> = f.into()._act;
+ let mut self_act: Box<dyn FnMut() + 'u> = self._act;
+ let mut other_act: Box<dyn FnMut() + 'u> = f.into()._act;
Self::from(move || {{ self_act.as_mut()(); other_act.as_mut()(); }})
}}
}}
@@ -1335,7 +1337,7 @@ rust_template = '''
}}
}}
impl<'u> ops::Deref for UserAction<'u> {{
- type Target = FnMut() + 'u;
+ type Target = dyn FnMut() + 'u;
fn deref(&self) -> &Self::Target {{
&*self._act
}}
@@ -1346,7 +1348,7 @@ rust_template = '''
}}
}}
pub struct RustTeXUtils<'u> {{
- _formatter: Box<FnMut(&fmt::Display) -> String + 'u>,
+ _formatter: Box<dyn FnMut(&dyn fmt::Display) -> String + 'u>,
pub before: UserAction<'u>,
pub after: UserAction<'u>,
pub family: &'u str,
@@ -1410,7 +1412,7 @@ rust_template = '''
impl<'u> RustTeXUtils<'u> {{
pub fn new() -> Self {{
RustTeXUtils {{
- _formatter: Box::new(|x: &fmt::Display| format!("{{}}", x)),
+ _formatter: Box::new(|x: &dyn fmt::Display| format!("{{}}", x)),
before: UserAction::new(),
after: UserAction::new(),
family: "{family}",
@@ -1428,7 +1430,7 @@ rust_template = '''
pub fn formatter<A: fmt::Display>(&mut self, x: A) -> String {{
(self._formatter)(&x)
}}
- pub fn set_formatter<F: FnMut(&fmt::Display) -> String + 'u>(&mut self, f: F) {{
+ pub fn set_formatter<F: FnMut(&dyn fmt::Display) -> String + 'u>(&mut self, f: F) {{
self._formatter = Box::new(f);
}}
pub fn add_dependencies<SS: IntoIterator>(&mut self, deps: SS)
@@ -1541,3 +1543,208 @@ CodeEngine('rust', 'rust', '.rs',
created='{File}.exe')
SubCodeEngine('rust', 'rs')
+
+
+r_template = '''
+ library(methods)
+ setwd("{workingdir}")
+ pdf(file=NULL)
+ {body}
+ write("{dependencies_delim}", stdout())
+ write("{created_delim}", stdout())
+ '''
+
+r_wrapper = '''
+ write("{stdoutdelim}", stdout())
+ write("{stderrdelim}", stderr())
+ {code}
+ '''
+
+r_sub = '''
+ write("{field_delim}", stdout())
+ write(toString({field}), stdout())
+ '''
+
+CodeEngine('R', 'R', '.R',
+ '{Rscript} "{file}.R"',
+ r_template, r_wrapper, 'write(toString({code}), stdout())', r_sub,
+ ['error', 'Error'], ['warning', 'Warning'],
+ 'line {number}')
+
+
+rcon_template = '''
+ options(echo=TRUE, error=function(){{}})
+ library(methods)
+ setwd("{workingdir}")
+ pdf(file=NULL)
+ {body}
+ '''
+
+rcon_wrapper = '''
+ write("{stdoutdelim}", stdout())
+ {code}
+ '''
+
+CodeEngine('Rcon', 'R', '.R',
+ '{Rscript} "{file}.R"',
+ rcon_template, rcon_wrapper, '', '',
+ ['error', 'Error'], ['warning', 'Warning'],
+ '')
+
+
+perl_template = '''
+ use v5.14;
+ use utf8;
+ use strict;
+ use autodie;
+ use warnings;
+ use warnings qw(FATAL utf8);
+ use feature qw(unicode_strings);
+ use open qw(:encoding(UTF-8) :std);
+ chdir("{workingdir}");
+ {body}
+ print STDOUT "{dependencies_delim}\\n";
+ print STDOUT "{created_delim}\\n";
+ '''
+
+perl_wrapper = '''
+ print STDOUT "{stdoutdelim}\\n";
+ print STDERR "{stderrdelim}\\n";
+ {code}
+ '''
+
+perl_sub = '''
+ print STDOUT "{field_delim}\\n";
+ print STDOUT "" . ({field});
+ '''
+
+CodeEngine('perl', 'perl', '.pl',
+ '{perl} "{file}.pl"',
+ perl_template, perl_wrapper, 'print STDOUT "" . ({code});', perl_sub,
+ ['error', 'Error'], ['warning', 'Warning'],
+ 'line {number}')
+
+SubCodeEngine('perl', 'pl')
+
+
+perl6_template = '''
+ use v6;
+ chdir("{workingdir}");
+ {body}
+ put "{dependencies_delim}";
+ put "{created_delim}";
+ '''
+
+perl6_wrapper = '''
+ put "{stdoutdelim}";
+ note "{stderrdelim}";
+ {code}
+ '''
+
+perl6_sub = '''
+ put "{field_delim}";
+ put ({field});
+ '''
+
+CodeEngine('perlsix', 'perl6', '.p6',
+ '{perl6} "{File}.p6"',
+ perl6_template, perl6_wrapper, 'put ({code});', perl6_sub,
+ ['error', 'Error', 'Cannot'], ['warning', 'Warning'],
+ ['.p6:{number}', '.p6 line {number}'], True)
+
+SubCodeEngine('perlsix', 'psix')
+
+javascript_template = '''
+ jstex = {{
+ before : function () {{ }},
+ after : function () {{ }},
+ _dependencies : [ ],
+ _created : [ ],
+ add_dependencies : function () {{
+ jstex._dependencies = jstex._dependencies.concat(
+ Array.prototype.slice.apply( arguments ) );
+ }},
+ add_created : function () {{
+ jstex._created = jstex._created.concat(
+ Array.prototype.slice.apply( arguments ) );
+ }},
+ cleanup : function () {{
+ console.log( "{dependencies_delim}" );
+ jstex._dependencies.map(
+ dep => console.log( dep ) );
+ console.log( "{created_delim}" );
+ jstex._dependencies.map(
+ cre => console.log( cre ) );
+ }},
+ formatter : function ( x ) {{
+ return String( x );
+ }},
+ escape : function ( x ) {{
+ return String( x ).replace( /_/g, '\\\\_' )
+ .replace( /\\$/g, '\\\\$' )
+ .replace( /\\^/g, '\\\\^' );
+ }},
+ docdir : process.cwd(),
+ context : {{ }},
+ _context_raw : '',
+ set_context : function ( expr ) {{
+ if ( expr != '' && expr != jstex._context_raw ) {{
+ jstex.context = {{ }};
+ expr.split( ',' ).map( pair => {{
+ const halves = pair.split( '=' );
+ jstex.context[halves[0].trim()] = halves[1].trim();
+ }} );
+ }}
+ }}
+ }};
+
+ try {{
+ process.chdir( "{workingdir}" );
+ }} catch ( e ) {{
+ if ( process.argv.indexOf( '--manual' ) == -1 )
+ console.error( e );
+ }}
+ if ( module.paths.indexOf( jstex.docdir ) == -1 )
+ module.paths.unshift( jstex.docdir );
+
+ {extend}
+
+ jstex.id = "{family}_{session}_{restart}";
+ jstex.family = "{family}";
+ jstex.session = "{session}";
+ jstex.restart = "{restart}";
+
+ {body}
+
+ jstex.cleanup();
+ '''
+
+javascript_wrapper = '''
+ jstex.command = "{command}";
+ jstex.set_context( "{context}" );
+ jstex.args = "{args}";
+ jstex.instance = "{instance}";
+ jstex.line = "{line}";
+
+ console.log( "{stdoutdelim}" );
+ console.error( "{stderrdelim}" );
+ jstex.before();
+
+ {code}
+
+ jstex.after();
+ '''
+
+javascript_sub = '''
+ console.log( "{field_delim}" );
+ console.log( {field} );
+ '''
+
+CodeEngine('javascript', 'javascript', '.js',
+ 'node "{file}.js"',
+ javascript_template, javascript_wrapper,
+ 'console.log( jstex.formatter( {code} ) )',
+ javascript_sub,
+ ['error', 'Error'], ['warning', 'Warning'],
+ ':{number}')
+