summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/jwjournal
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-22 03:01:19 +0000
committerNorbert Preining <norbert@preining.info>2023-10-22 03:01:19 +0000
commitd42d70e713e5b740e457a4d56e4dad6e5e0e9b94 (patch)
tree020391925db7b9afead4249591b40fc4fa292da0 /macros/latex/contrib/jwjournal
parent6deeaf1bda76263051b929f5d5401c98d85e74ef (diff)
CTAN sync 202310220301
Diffstat (limited to 'macros/latex/contrib/jwjournal')
-rw-r--r--macros/latex/contrib/jwjournal/README.md20
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdfbin115307 -> 120740 bytes
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex16
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-en.pdfbin75218 -> 77414 bytes
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-en.tex16
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-fr.pdfbin77570 -> 80058 bytes
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-fr.tex16
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal.cls84
8 files changed, 142 insertions, 10 deletions
diff --git a/macros/latex/contrib/jwjournal/README.md b/macros/latex/contrib/jwjournal/README.md
index 26caffafbf..fb3e0270a3 100644
--- a/macros/latex/contrib/jwjournal/README.md
+++ b/macros/latex/contrib/jwjournal/README.md
@@ -45,7 +45,7 @@ By the way, the conversion from plain date string like `2023-01-01` to natural l
The structure of the document is very simple:
```latex
\documentclass[11pt, paperstyle = light yellow, color entry]{jwjournal}
-\UseLanguage{⟨language⟩}
+\UseLanguage{⟨language⟩} % For English this line can be omitted.
\begin{document}
@@ -91,6 +91,21 @@ Here are the major syntaxes for your main text:
- `(( <⟨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`.
+1) Section
+ - You may start a new (*unnumbered*)
+ - section, via `## {⟨section title⟩}`;
+ - subsection, via `### {⟨subsection title⟩}`;
+ - subsubsection, via `#### {⟨subsubsection title⟩}`.
+ - If you wish to use the *numbered* version, write `##+`, `###+` and `####+` instead.
+ > It is recommanded to use the class option `title in boldface`, `title in sffamily` and `use style = classical` (these options are provided by the base class of `jwjournal`). If you also wish your section title to be in small caps shape, then you may put the `⟨section title⟩` in `\textsc`.
+
+ <!-- > Due to the current implementation of the emphasizing `*⟨text⟩*`, you cannot put two `##*`, `###*` or `####*` in the same paragraph — but this shouldn't be any problem, just put an empty line between any two sectional commands. -->
+1) Subfile
+ - With this feature you may organize your journals in a systematic way by putting the fragments of it into subfiles distributed in separate folders. For example, you may have each folder's name to be the year, and within a folder you may have `.tex` files named after each month.
+ - You may include a subfile containing journal text in one of the following ways:
+ - `:: {⟨file name⟩}` for input, similarly as `\input`.
+ - `::: {⟨file name⟩}` for include, similarly as `\include`.
+ > Explicitly, these are `\InputJournal` and `\IncludeJournal`. If in the preamble you wish to define some automatic processing involving input or inclusion of subfiles, please use these two commands.
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
@@ -132,6 +147,7 @@ With a few more for icing on the cake:
And more text.
```
- `->` 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`.
+- `---`: Three or more hyphen chars `-` in a separate paragraph would be interpreted as a separation line (as with Markdown).
- `+++`: 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:
@@ -191,7 +207,7 @@ If you are using XeLaTeX or LuaLaTeX to compile your document, then the current
- Source Han Mono, [go to its Release page](https://github.com/adobe-fonts/source-han-mono/releases).
> It is recommended to download the Super-OTC version, so that the total download size would be smaller, and the installation would be easier.
-These are necessary if you wish to write your document in Chinese (either simplified or traditional) or Japanese. Also, without these fonts installed, the compilation speed might be much slower — the compilation would still passing, but the system shall spend (quite) some time verifying that the fonts are indeed missing before switching to the fallback fonts.
+These are necessary if you wish to write your document in Chinese (either simplified or traditional) or Japanese. Also, without these fonts installed, the compilation speed might be much slower — the compilation would still pass, but the system shall spend (quite) some time verifying that the fonts are indeed missing before switching to the fallback fonts.
### Colors
The colors from Monday to Sunday have the internal names `jwjournal-color-1`, ..., `jwjournal-color-7`. Currently they are defined as:
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
index 7980506f1e..ef27817556 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
Binary files differ
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
index 9cd0937d84..78cdb86040 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
@@ -1,4 +1,5 @@
-\documentclass[11pt, paperstyle=light yellow, color entry]{jwjournal}
+\documentclass[11pt, paperstyle=light yellow, color entry,
+ title in boldface, title in sffamily, use style = classical]{jwjournal}
% paperstyle = ... 用于调节纸张颜色,可选项包括:lightyellow、yellow、parchment、green、lightgray、gray、nord、dark
% color entry 可以为每个条目的标题增添更多色彩
% scroll 可以开启卷轴模式,生成类似于长截图的单页 pdf
@@ -8,7 +9,7 @@
\begin{document}
-2023-01-01 晴 | 公寓
+2023-01-01 晴 | 地点
在文中出现的日期和标注不会被识别: 2022-12-25、[标注]、【标注】,放心使用!
@@ -31,6 +32,7 @@
)) <.4> {example-image-b} % 或者 )) {example-image-b} <.4>
+## {新篇章}
2023-01-02
不明(天气也可以写在第二行,看你的喜好)
@@ -39,6 +41,16 @@
[学习] 今天没有学习,但我写了很多很多很多很多很多很多很多很多很多很多很多很多很多很多很多很多代码。
+ -----
+
+ 三个或更多的\textquote{\texttt{-}}符号被放置在单独的段落中时,就会生成一条分割线 ---
+
+ ---
+
+ --- 不过当前这一行不会被转换,因为在 \texttt{-}\texttt{-}\texttt{-} 之后还有其他文本。
+
+ -----
+
如果标注后的文本有多段,可以合理使用 \texttt{\textbackslash\textbackslash} 与 \texttt{\slash\slash} 将它们连接起来,这样所有文本都会被正确缩进:
[标签] 一些文本。
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-en.pdf b/macros/latex/contrib/jwjournal/jwjournal-demo-en.pdf
index eeffdf0183..e93e4c83b0 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-en.pdf
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-en.pdf
Binary files differ
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-en.tex b/macros/latex/contrib/jwjournal/jwjournal-demo-en.tex
index 0fb357e3ee..32bc336ec8 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-en.tex
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-en.tex
@@ -1,4 +1,5 @@
-\documentclass[11pt, paperstyle=light yellow, color entry, month-day-year]{jwjournal}
+\documentclass[11pt, paperstyle=light yellow, color entry, month-day-year,
+ title in boldface, title in sffamily, use style = classical]{jwjournal}
% "paperstyle = ..." adjusts the paper color, options include: lightyellow、yellow、parchment、green、lightgray、gray、nord、dark
% "color entry" adds more color to the title of each entry
% "scroll" turns on the scroll mode and can generate a single-page pdf similar to a long screenshot
@@ -6,7 +7,7 @@
\begin{document}
-01/01/2023 Sunny | Apartment
+01/01/2023 Sunny | Location
Dates and annotations appearing in the text will not be recognized: 12/25/2022, [Note], so feel free to write these.
@@ -28,6 +29,7 @@
)) <.4> {example-image-b} % or )) {example-image-b} <.4>
+## {\textsc{A New Section}}
01/02/2023
Unknown (the weather can also be written on the second line, depending on your preference)
@@ -36,6 +38,16 @@ Unknown (the weather can also be written on the second line, depending on your p
[Note] I didn't study today, but I wrote many many many many many many many many many many many many code.
+ -----
+
+ Three or more \textquote{\texttt{-}} in a separate paragraph give you a separation line ---
+
+ ---
+
+ --- but the current line won't be matched since there is extra text behind \texttt{-}\texttt{-}\texttt{-}.
+
+ -----
+
If there are multiple paragraphs following the label, you may use \texttt{\textbackslash\textbackslash} and \texttt{\slash\slash} wisely to concatenate them, so that all texts would be indented properly:
[Label] Some text.
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-fr.pdf b/macros/latex/contrib/jwjournal/jwjournal-demo-fr.pdf
index 98da8d1897..f8395eeee3 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-fr.pdf
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-fr.pdf
Binary files differ
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-fr.tex b/macros/latex/contrib/jwjournal/jwjournal-demo-fr.tex
index f83a5d4ae1..e10fe350b3 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-fr.tex
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-fr.tex
@@ -1,4 +1,5 @@
-\documentclass[11pt, paperstyle=light yellow, color entry, day-month-year]{jwjournal}
+\documentclass[11pt, paperstyle=light yellow, color entry, day-month-year,
+ title in boldface, title in sffamily, use style = classical]{jwjournal}
% "paperstyle = ..." ajuste la couleur du papier, les options incluent : lightyellow、yellow、parchment、green、lightgray、gray、nord、dark
% "color entry" ajoute plus de couleur au titre de chaque entrée
% "scroll" active le mode de défilement et peut générer un pdf d'une seule page similaire à une longue capture d'écran
@@ -8,7 +9,7 @@
\begin{document}
-01/01/2023 Ensoleillé | Mon appartement
+01/01/2023 Ensoleillé | Lieu
Les dates et annotations apparaissant dans le texte ne seront pas détectées : 25/12/2022, [Note], alors n'hésitez pas à les écrire !
@@ -30,6 +31,7 @@
)) <.4> {example-image-b} % ou )) {example-image-b} <.4>
+## {\textsc{Une Nouvelle Section}}
02/01/2023
Inconnu (la météo peut aussi être écrite sur la deuxième ligne, selon votre préférence)
@@ -38,6 +40,16 @@ Inconnu (la météo peut aussi être écrite sur la deuxième ligne, selon votre
[Note] Je n'ai pas étudié aujourd'hui, mais j'ai écrit beaucoup beaucoup beaucoup beaucoup beaucoup beaucoup beaucoup beaucoup beaucoup de code.
+ -----
+
+ Trois ou plus \textquote{\texttt{-}} signes dans un paragraphe isolé vous donnent une ligne de séparation ---
+
+ ---
+
+ --- mais la ligne actuelle ne sera pas prise en compte car il y a du texte supplémentaire derrière \texttt{-}\texttt{-}\texttt{-}.
+
+ -----
+
Si l'étiquette est suivie de plusieurs paragraphes, vous pouvez utiliser \texttt{\textbackslash\textbackslash} et \texttt{\slash\slash} judicieusement pour les concaténer, de manière à ce que tous les textes soient indentés convenablement :
[Étiquette] Un peu de texte.
diff --git a/macros/latex/contrib/jwjournal/jwjournal.cls b/macros/latex/contrib/jwjournal/jwjournal.cls
index 7ba40e53e4..2a57f1064b 100644
--- a/macros/latex/contrib/jwjournal/jwjournal.cls
+++ b/macros/latex/contrib/jwjournal/jwjournal.cls
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{jwjournal}
- {2023/10/01} {}
+ {2023/10/19} {}
{JW's journal class}
\keys_define:nn { jwjournal }
@@ -56,6 +56,7 @@
\colorlet { jwjournal-color-7 } { red!20!orange }
\colorlet { jwjournal-entry } { . }
+\colorlet { jwjournal-sep-line } { .!27!paper }
\NewDocumentCommand \JWJournalSeperator { O{jwjournal-entry!60!main-text} }
{
@@ -65,6 +66,14 @@
\enspace
}
+\NewDocumentCommand \JWJournalSepLine { O{.75pt} }
+ {
+ \vspace*{-.5\baselineskip}
+ \noindent
+ \hspace*{-\paperwidth}
+ \makebox[\linewidth]{\color{jwjournal-sep-line}\rule{4\paperwidth}{#1}}
+ }
+
\NewDocumentCommand \JWJournalEntry { m m }
{
\phantomsection
@@ -83,7 +92,17 @@
\begin{tcolorbox}[enhanced~jigsaw,
enlarge~left~by=-3.5mm, width=\textwidth+3.5mm,
colback=jwjournal-entry-background,
- boxrule=0pt, top=2pt, bottom=2pt, left=2.5mm, right=
+ boxrule=0pt,
+ top=
+ \bool_if:NTF \l__jwjournal_color_entry_bool
+ { 2pt }
+ { 0pt },
+ bottom=
+ \bool_if:NTF \l__jwjournal_color_entry_bool
+ { 2pt }
+ { 0pt },
+ left=2.5mm,
+ right=
\bool_if:NTF \l__jwjournal_color_entry_bool
{ 2mm }
{ -1mm },
@@ -252,6 +271,23 @@
\tl_use:N \g_jwjournal_content_tl
}
{}
+\NewDocumentCommand \jwjournaltext { +m }
+ {
+ \tl_gset:Nn \g_jwjournal_content_tl { #1 }
+ \jwjournal_parse_content:N \g_jwjournal_content_tl
+ \tl_use:N \g_jwjournal_content_tl
+ }
+\NewDocumentCommand \InputJournal { m }
+ {
+ \file_get:nnN { #1 } { } \l_tmpa_tl
+ \exp_args:No \jwjournaltext { \l_tmpa_tl }
+ }
+\NewDocumentCommand \IncludeJournal { m }
+ {
+ \clearpage
+ \InputJournal { #1 }
+ \clearpage
+ }
\tl_const:Nn \c_jwjournal_new_line_with_skip_tl { \\[.3\baselineskip] }
\bool_new:N \l_jwjournal_regex_no_more_match_bool
@@ -271,6 +307,40 @@
{ }
\l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \:\:\: }
+ { \c{IncludeJournal} }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \:\: }
+ { \c{InputJournal} }
+ \l_jwjournal_tmp_tl
+
+ \regex_replace_all:nnN
+ { \#\#\#\#\+ }
+ { \c{subsubsection} }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\#\+ }
+ { \c{subsection} }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\+ }
+ { \c{section} }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\#\# }
+ { \c{subsubsection}\* }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \#\#\# }
+ { \c{subsection}\* }
+ \l_jwjournal_tmp_tl
+ \regex_replace_all:nnN
+ { \#\# }
+ { \c{section}\* }
+ \l_jwjournal_tmp_tl
+
\regex_match:nVT { ❄️ \ *? -> } \l_jwjournal_tmp_tl
{
\regex_match:nVTF { ❄️ \ *? -> \ *? < [\+\-\ ]*(\d+|\d*\.\d+)\ * > } \l_jwjournal_tmp_tl
@@ -407,6 +477,16 @@
}
}
+ \tl_put_right:Nn \l_jwjournal_tmp_tl { ❄️ }
+ \regex_match:nVT { ❄️ \ *? \-{3,} \ *? ❄️ } \l_jwjournal_tmp_tl
+ {
+ \regex_replace_once:nnN
+ { ❄️ \ *? \-{3,} \ *? }
+ { ❄️ \c{JWJournalSepLine} }
+ \l_jwjournal_tmp_tl
+ }
+ \regex_replace_once:nnN { ❄️ (.*) ❄️ } { ❄️ \1 } \l_jwjournal_tmp_tl
+
\regex_replace_once:nnN
{ ❄️ (\ *)? (\d{4}-\d{1,2}-\d{1,2}) (\ *)? (.*) }
{ \c{JWJournalEntry} {\2} {\4} }