summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-08-30 21:22:01 +0000
committerKarl Berry <karl@freefriends.org>2023-08-30 21:22:01 +0000
commit7a294d60896335d93bc23efc8885e79988ff235b (patch)
tree545d042e7039df64e9103191b76d53410984e4a0 /Master
parent91070b658c5ac664b20b6eb0276b259a58a747f7 (diff)
jwjournal (30aug23)
git-svn-id: svn://tug.org/texlive/trunk@68116 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/jwjournal/README.md10
-rw-r--r--Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex8
-rw-r--r--Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex8
-rw-r--r--Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex8
-rw-r--r--Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls119
5 files changed, 123 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/latex/jwjournal/README.md b/Master/texmf-dist/doc/latex/jwjournal/README.md
index 41146918201..996d0376a0d 100644
--- a/Master/texmf-dist/doc/latex/jwjournal/README.md
+++ b/Master/texmf-dist/doc/latex/jwjournal/README.md
@@ -65,10 +65,10 @@ And there are only three major syntaxes for the main text:
The space(s) between `[Note]` and the text following it would be ignored.
> You may also use `【` and `】`, which is especially useful when writing Chinese.
3) Displayed images can be included via one of the following ways:
- - `|| [<width>] {<image file name>}`: show image in the middle.
- - `(( [<width>] {<image file name>}`: show image on the left.
- - `)) [<width>] {<image file name>}`: show image on the right.
- > The `[<width>]` is optional. Here `<width>` is a number like `0.75`, the unit is `\linewidth`. When `[<width>]` is not given, the width would be full `\linewidth`.
+ - `|| <⟨width⟩> {⟨image file name⟩}` or `|| {⟨image file name⟩} <⟨width⟩>`: show image in the middle.
+ - `(( <⟨width⟩> {⟨image file name⟩}` or `(( {⟨image file name⟩} <⟨width⟩>`: show image on the left.
+ - `)) <⟨width⟩> {⟨image file name⟩}` or `)) {⟨image file name⟩} <⟨width⟩>`: show image on the right.
+ > The `<⟨width⟩>` is optional. Here `⟨width⟩` is a number like `0.75`, the unit is `\linewidth`. When `<⟨width⟩>` is not given, the width would be full `\linewidth`.
With a few more for icing on the cake:
- `|`: The first vertical bar would be interpreted as `\hfill`. This allows you to write the title line as
@@ -96,7 +96,7 @@ With a few more for icing on the cake:
>> (Some remark)
>> (Another remark)
```
-- `->` and `<-`: Skip or retrieve certain vertical space, by default half of `\baselineskip`. You may specify the exact spacing in the unit of `\baselineskip`: for example, `-> [0.3]` would be skipping `0.3\baselineskip`, while `<- [.75]` means retrieving `0.75\baselineskip`.
+- `->` and `<-`: Skip or retrieve certain vertical space, by default half of `\baselineskip`. You may specify the exact spacing in the unit of `\baselineskip`: for example, `-> <0.3>` would be skipping `0.3\baselineskip`, while `<- <.75>` means retrieving `0.75\baselineskip`.
- `+++`: If a single sentence or a few words fall to the next page, you may write a `+++` before that entry to enlarge the current page by one line.
> You may write this `+++` several times if necessary, but do make sure that the number of the `+` sign is a multiple of 3.
- `===`: Three or more equal signs `=` would simply be ignored. This is for improving the readability of the code, allowing you to write your journal like:
diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex
index 81647136b9c..5ed5d235893 100644
--- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex
+++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex
@@ -19,14 +19,14 @@
图片这可以这样引入:
- || [.4] {example-image-a}
+ || <.4> {example-image-a} % 或者 || {example-image-a} <.4>
>> (图片的注释)
>> (更多注释)
也可以靠左或者靠右显示:
- (( [.4] {example-image-a}
- -> [.3] % 加入一点竖直间距,例如这里是 0.3\baselineskip
- )) [.4] {example-image-a}
+ (( <.4> {example-image-a} % 或者 (( {example-image-a} <.4>
+ -> <.3> % 加入一点竖直间距,例如这里是 0.3\baselineskip
+ )) <.4> {example-image-a} % 或者 )) {example-image-a} <.4>
diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex
index f0b85fc4849..5a5d8740c9a 100644
--- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex
+++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex
@@ -16,14 +16,14 @@
Images can be included via:
- || [.4] {example-image-a}
+ || <.4> {example-image-a} % or || {example-image-a} <.4>
>> (Remark on the image)
>> (More remark...)
You may also show the image on the left or on the right:
- (( [.4] {example-image-a}
- -> [.3] % add some vertical spacing, here is 0.3\baselineskip
- )) [.4] {example-image-a}
+ (( <.4> {example-image-a} % or (( {example-image-a} <.4>
+ -> <.3> % add some vertical spacing, here is 0.3\baselineskip
+ )) <.4> {example-image-a} % or )) {example-image-a} <.4>
diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex
index d8c6413bc8d..865402e2540 100644
--- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex
+++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex
@@ -18,14 +18,14 @@
Les images peuvent être incluses via :
- || [.4] {example-image-a}
+ || <.4> {example-image-a} % ou || {example-image-a} <.4>
>> (Remarque sur l'image)
>> (Plus de remarque...)
Vous pouvez également afficher l'image à gauche ou à droite :
- (( [.4] {example-image-a}
- -> [.3] % ajouter un certain espace vertical, ici c'est 0.3\baselineskip
- )) [.4] {example-image-a}
+ (( <.4> {example-image-a} % ou (( {example-image-a} <.4>
+ -> <.3> % ajouter un certain espace vertical, ici c'est 0.3\baselineskip
+ )) <.4> {example-image-a} % ou )) {example-image-a} <.4>
diff --git a/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls b/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls
index f7d1da7f64a..bf039931587 100644
--- a/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls
+++ b/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{jwjournal}
- {2023/08/29} {}
+ {2023/08/30} {}
{JW's journal class}
\keys_define:nn { jwjournal }
@@ -119,15 +119,17 @@
\end{description}
}
-\NewDocumentCommand \JWJournalSkip { O{.5} }
+\NewDocumentCommand \JWJournalSkip { D<>{.5} }
{
% \vspace{#1\baselineskip}
- \vskip#1\baselineskip
+ % \vskip#1\baselineskip
+ \par\vspace{#1\baselineskip}
}
-\NewDocumentCommand \JWJournalBack { O{.5} }
+\NewDocumentCommand \JWJournalBack { D<>{.5} }
{
% \vspace{-#1\baselineskip}
- \vskip-#1\baselineskip
+ % \vskip-#1\baselineskip
+ \par\vspace{-#1\baselineskip}
}
\newenvironment{JWJournalCompactCenter}
@@ -148,22 +150,61 @@
#1
\end{JWJournalCompactCenter}
}
-\NewDocumentCommand \JWJournalShowImageCenter { O{1} m }
+\NewDocumentCommand \JWJournalShowImageCenter { D<>{*} m D<>{*} }
{
+ \str_if_eq:nnTF { #1 } { * }
+ {
+ \str_if_eq:nnTF { #3 } { * }
+ {
+ \tl_set:Nn \l_tmpa_tl { 1 }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #3 }
+ }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ }
\begin{JWJournalCenter}
- \includegraphics[width=#1\linewidth]{#2}
+ \includegraphics[width= \tl_use:N \l_tmpa_tl \linewidth]{#2}
\end{JWJournalCenter}
}
-\NewDocumentCommand \JWJournalShowImageLeft { O{1} m }
+\NewDocumentCommand \JWJournalShowImageLeft { D<>{*} m D<>{*} }
{
+ \str_if_eq:nnTF { #1 } { * }
+ {
+ \str_if_eq:nnTF { #3 } { * }
+ {
+ \tl_set:Nn \l_tmpa_tl { 1 }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #3 }
+ }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ }
\begin{JWJournalLeft}
- \includegraphics[width=#1\linewidth]{#2}
+ \includegraphics[width= \tl_use:N \l_tmpa_tl \linewidth]{#2}
\end{JWJournalLeft}
}
-\NewDocumentCommand \JWJournalShowImageRight { O{1} m }
+\NewDocumentCommand \JWJournalShowImageRight { D<>{*} m D<>{*} }
{
+ \str_if_eq:nnTF { #1 } { * }
+ {
+ \str_if_eq:nnTF { #3 } { * }
+ {
+ \tl_set:Nn \l_tmpa_tl { 1 }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #3 }
+ }
+ }
+ {
+ \tl_set:Nn \l_tmpa_tl { #1 }
+ }
\begin{JWJournalRight}
- \includegraphics[width=#1\linewidth]{#2}
+ \includegraphics[width= \tl_use:N \l_tmpa_tl \linewidth]{#2}
\end{JWJournalRight}
}
@@ -193,14 +234,66 @@
{ ={3,} }
{ }
\l_jwjournal_tmp_tl
+
+ \regex_match:nVT { ❄️ \ *? -> } \l_jwjournal_tmp_tl
+ {
+ \regex_match:nVTF { ❄️ \ *? -> \ *? < [\+\-\ ]*(\d+|\d*\.\d+)\ * > } \l_jwjournal_tmp_tl
+ {
+ \exp_args:Nno \regex_extract_once:nnN
+ { ❄️ \ *? -> \ *? < ([\+\-\ ]*(?:\d+|\d*\.\d+)\ *) > }
+ { \l_jwjournal_tmp_tl }
+ \l_tmpa_seq
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ \tl_gput_right:Nn \g_jwjournal_content_tl { \JWJournalSkip }
+ \tl_gput_right:Nx \g_jwjournal_content_tl { < \l_tmpa_tl > }
+ \regex_replace_once:nnN
+ { ❄️ \ *? -> \ *? < (?:[\+\-\ ]*(?:\d+|\d*\.\d+)\ *) > (.*) }
+ { ❄️ \1 }
+ \l_jwjournal_tmp_tl
+ }
+ {
+ \tl_gput_right:Nn \g_jwjournal_content_tl { \JWJournalSkip }
+ \regex_replace_once:nnN
+ { ❄️ \ *? -> \ *? (.*) }
+ { ❄️ \1 }
+ \l_jwjournal_tmp_tl
+ }
+ }
\regex_replace_all:nnN
{ -> }
{ \c{JWJournalSkip} }
\l_jwjournal_tmp_tl
+ \regex_match:nVT { ❄️ \ *? <- } \l_jwjournal_tmp_tl
+ {
+ \regex_match:nVTF { ❄️ \ *? <- \ *? < [\+\-\ ]*(\d+|\d*\.\d+)\ * > } \l_jwjournal_tmp_tl
+ {
+ \exp_args:Nno \regex_extract_once:nnN
+ { ❄️ \ *? <- \ *? < ([\+\-\ ]*(?:\d+|\d*\.\d+)\ *) > }
+ { \l_jwjournal_tmp_tl }
+ \l_tmpa_seq
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
+ \tl_gput_right:Nn \g_jwjournal_content_tl { \JWJournalBack }
+ \tl_gput_right:Nx \g_jwjournal_content_tl { < \l_tmpa_tl > }
+ \regex_replace_once:nnN
+ { ❄️ \ *? <- \ *? < (?:[\+\-\ ]*(?:\d+|\d*\.\d+)\ *) > (.*) }
+ { ❄️ \1 }
+ \l_jwjournal_tmp_tl
+ }
+ {
+ \tl_gput_right:Nn \g_jwjournal_content_tl { \JWJournalBack }
+ \regex_replace_once:nnN
+ { ❄️ \ *? <- \ *? (.*) }
+ { ❄️ \1 }
+ \l_jwjournal_tmp_tl
+ }
+ }
\regex_replace_all:nnN
{ <- }
{ \c{JWJournalBack} }
\l_jwjournal_tmp_tl
+
\regex_replace_all:nnN
{ \|\| }
{ \c{JWJournalShowImageCenter} }
@@ -213,6 +306,7 @@
{ \)\) }
{ \c{JWJournalShowImageRight} }
\l_jwjournal_tmp_tl
+
\regex_replace_once:nnN
{ \| }
{ \c{hfill} }
@@ -228,8 +322,7 @@
% \l_jwjournal_tmp_tl
\exp_args:Nno \regex_split:nnN { >> } { \l_jwjournal_tmp_tl } \l_tmpa_seq
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
- \tl_clear:N \l_jwjournal_tmp_tl
- \tl_put_right:NV \l_jwjournal_tmp_tl \l_tmpa_tl
+ \tl_set_eq:NN \l_jwjournal_tmp_tl \l_tmpa_tl
\seq_map_inline:Nn \l_tmpa_seq
{
\tl_put_right:Nn \l_jwjournal_tmp_tl