diff options
author | Karl Berry <karl@freefriends.org> | 2023-01-07 21:22:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-01-07 21:22:18 +0000 |
commit | 1a9facaeddf02664ab807be31f6d7d77ad334c34 (patch) | |
tree | 25e17557dc4d889fa0d0edf6c7a176bc5fd6f110 /Master/texmf-dist | |
parent | f250113756f342f7c54e383d5d524c537ba23b85 (diff) |
jwjournal (7jan23)
git-svn-id: svn://tug.org/texlive/trunk@65480 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/README.md | 62 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.pdf | bin | 44037 -> 46598 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.pdf | bin | 19537 -> 19484 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex | 31 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.pdf | bin | 19476 -> 19833 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex | 31 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls | 39 |
8 files changed, 112 insertions, 66 deletions
diff --git a/Master/texmf-dist/doc/latex/jwjournal/README.md b/Master/texmf-dist/doc/latex/jwjournal/README.md index dac0d68bfbe..6432aebb1ef 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/README.md +++ b/Master/texmf-dist/doc/latex/jwjournal/README.md @@ -16,10 +16,14 @@ Codewise, it is as simple as below: [Food] And had ice-cream for lunch! ``` +> It is also possible to write the date as `2023/01/01`. + +> With the options `month-day-year` or `day-month-year`, you can also write date in the format `mm-dd-yyyy` or `dd-mm-yyyy`, respectively. You may refer to the English and French demo documents for examples. + Every day of the week has its unique color, like this: ![image](https://github.com/Jinwen-XU/jwjournal/raw/main/screenshots/demo2.png) -By the way, the conversion from plain date string like `2023-01-01` to natural language like `January 1, 2023 | Sunday` is done automatically by `jwjournal` and has multilingual support. Thus, for example (with `\UseLanguage{...}`): +By the way, the conversion from plain date string like `2023-01-01` to natural language like `January 1, 2023 | Sunday` is done automatically by `jwjournal` and has multilingual support. Thus, for example (via `\UseLanguage`): - Chinese: ![image](https://github.com/Jinwen-XU/jwjournal/raw/main/screenshots/demo3-cn.png) - French: ![image](https://github.com/Jinwen-XU/jwjournal/raw/main/screenshots/demo3-fr.png) - German: ![image](https://github.com/Jinwen-XU/jwjournal/raw/main/screenshots/demo3-de.png) @@ -39,11 +43,12 @@ The structure of the document is very simple: \end{document} ``` The options are: +- `month-day-year` or `day-month-year` for other date format - `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 -And there are only three syntaxes for the main text: +And there are only two major syntaxes for the main text: 1) Title - Any line begins with date like `2023-01-01` would be regard as the Title line. - You may write the weather and/or location after the date. @@ -57,32 +62,47 @@ And there are only three syntaxes for the main text: ``` [Note] In hindsight, it was the right decision. ``` -3) `+++` - - In some rare case, if a single sentence or a few words fall to the next page, you may write a `+++` to enlarge the current page by one line. -> You may also refer to the demo documents to see their behaviors in action. +With a few more for icing on the cake: +- `+++`: 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. +- `===`: 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: + ``` + 2023-01-01 Sunny --- Botanical Garden + ===================================== -Indentations are not important, but paragraphs need to be separated by a blank line. For the sake of readability, it is recommended to organize your text as follows: -``` -2023-01-01 Sunny + Today I visited the botanical garden! - ...... - ...... + [Food] And had ice-cream for lunch! + ``` +> You may also refer to the demo documents to see their behaviors in action. +Indentations are not important, but paragraphs need to be separated by a blank line. For the sake of readability, it is recommended to organize your text as one of the following ways: +- with indentation: + ``` + 2023-01-01 + Sunny -2023-01-02 Cloudy + ...... + ...... + ``` +- with a separation line: + ``` + 2023-01-01 Sunny + ================ ...... ...... - - - -2023-01-03 Rainy + ``` +- or maybe even: + ``` + ========== + 2023-01-01 Sunny + ========== ...... ...... -``` + ``` ## TeXnical details @@ -103,7 +123,15 @@ The colors from Monday to Sunday have the internal names `jwjournal-color-1`, .. ``` ### Functionality -The main features are achieved with the power of LaTeX3's regex functionality. It scans the content paragraph by paragraph and converts recognized patterns into corresponding TeX commands. Thus, `2023-01-01 Weather` becomes `\JWJournalEntry{2023-01-01}{Weather}`, `[Note] ...` becomes `\item[Note] ...` inside a `description` environment, and `+++` is essentially `\enlargethispage*{\baselineskip}`. However, this comes with a price: in order to scan the content, it is firstly stored in a macro `\g_jwjournal_content_tl`, and that means that you cannot use commands like `\verb` in your main text. +The main features are achieved with the power of LaTeX3's regex functionality. It scans the content paragraph by paragraph and converts recognized patterns into corresponding TeX commands. Thus, `2023-01-01 Weather` becomes `\JWJournalEntry{2023-01-01}{Weather}`, `[Note] ...` becomes `\item[Note] ...` inside a `description` environment, and `+++` is essentially `\enlargethispage*{\baselineskip}`, etc. However, this comes with a price: in order to scan the content, it is firstly stored in a macro `\g_jwjournal_content_tl`, and that means that you cannot use commands like `\verb` in your main text (unless explicitly `\end{jwjournal}`, write your code, and then `\begin{jwjournal}`). + +### Dates +The conversion of date string to natural language, and the calculation of the day of the week are accomplished by `projlib-date`, part of the `ProjLib` toolkit, which is still at its early stage, in some aspects not as functional as existing package such as `datenumber`, but should evolve through time. + +### Language and date format +Language and date format can both be set in two ways: as class option or with corresponding commands. +- The user-level command for setting language is `\UseLanguage`, provided by `projlib-language`; the one for setting date format is `\SetDatetimeInputFormat`, provided by `projlib-date`. +- When you set the language, it is not exactly the same using class option or using command: when you select a language via class option, only the setting for this language would be loaded; however, with `\UseLanguage`, it would load *all* the language settings and then switch to your selected one. Sometimes the page breaking behavior differs slightly. Personally I prefer the `\UseLanguage` approach, for this would allow you to switch language in the middle of your document. ### Scroll mode The scroll mode is achieved by directly accessing `\pdfpageheight` (pdfTeX and XeTeX) or `\pageheight` (LuaTeX). The minimal page height is set to be `10in`. It is worth noting that in order to calculate the height needed, the entire content are put into a single box, which puts a limitation on the length of your document (but this usually wouldn't be a problem). diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.pdf b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.pdf Binary files differindex ec262d7e2ab..8d393374c8f 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.pdf +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.pdf 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 4e0732a7097..0fa7c87cb09 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-cn.tex @@ -10,7 +10,7 @@ 2023-01-01 晴 —— 公寓 - 在文中出现的日期和标注不会被识别: 2022-02-02、[标注],放心使用 + 在文中出现的日期和标注不会被识别: 2022-12-25、[标注],放心使用 [体育] 一些关于体育赛事的事情 @@ -39,15 +39,18 @@ -2023-01-05 多云 - - ... +========== +2023-01-05 多云 —— 居家办公 +========== +也可以把代码排列成这样。 -2023-01-06 多云 +========== +2023-01-06 晴朗 —— 居家办公 +========== - ... +... diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.pdf b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.pdf Binary files differindex feeffd829c3..84fd7596f9a 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.pdf +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.pdf 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 217c8decf42..ae95a74d530 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-en.tex @@ -1,4 +1,4 @@ -\documentclass[11pt, paperstyle=light yellow, color entry]{jwjournal} +\documentclass[11pt, paperstyle=light yellow, color entry, month-day-year]{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,9 +6,9 @@ \begin{document} -2023-01-01 Sunny --- Apartment +01/01/2023 Sunny --- Apartment - Dates and annotations appearing in the text will not be recognized: 2022-02-02, [Annotation], so feel free to write them + Dates and annotations appearing in the text will not be recognized: 12/25/2022, [Note], so feel free to write them [Sports] something about sporting events @@ -16,7 +16,7 @@ -2023-01-02 +01/02/2023 Unknown (the weather can also be written on the second line, depending on your preference) The color of the labels will change according to the date. @@ -25,43 +25,46 @@ Unknown (the weather can also be written on the second line, depending on your p -2023-01-03 +01/03/2023 [Note] If only the date is written, then there would be no second separator after it. +++ -2023-01-04 Cloudy +01/04/2023 Cloudy Three plus signs \texttt{+++} can enlarge the current page by about one line. Sometimes a single sentence or a few words fall to the next page --- in such cases, you may use it to improve the display effect. -2023-01-05 Cloudy - - ... +========== +01-05-2023 Cloudy --- Work at home +========== +You may also organize your code like this. -2023-01-06 Cloudy +========== +01-06-2023 Sunny --- Work at home +========== - ... +... -2023-01-07 Cloudy +01/07/2023 Cloudy ... -2023-01-08 Cloudy +01/08/2023 Cloudy A week later, the color goes back to the earlier one. -2023-01-09 Cloudy +01/09/2023 Cloudy ... diff --git a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.pdf b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.pdf Binary files differindex 4ac98e94171..6986ffd900d 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.pdf +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.pdf 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 c9c1cd20cce..c5d8d7b821a 100644 --- a/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex +++ b/Master/texmf-dist/doc/latex/jwjournal/jwjournal-demo-fr.tex @@ -1,4 +1,4 @@ -\documentclass[11pt, paperstyle=light yellow, color entry]{jwjournal} +\documentclass[11pt, paperstyle=light yellow, color entry, day-month-year]{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,9 +8,9 @@ \begin{document} -2023-01-01 Ensoleillé --- Appartement +01/01/2023 Ensoleillé --- Appartement - Les dates et annotations apparaissant dans le texte ne seront pas reconnues : 2022-02-02, [Annotation], alors n'hésitez pas à les écrire. + Les dates et annotations apparaissant dans le texte ne seront pas reconnues : 25/12/2022, [Note], alors n'hésitez pas à les écrire. [Sports] quelque chose sur les événements sportifs @@ -18,7 +18,7 @@ -2023-01-02 +02/01/2023 Inconnu (la météo peut aussi être écrite sur la deuxième ligne, selon votre préférence) La couleur des étiquettes changera en fonction de la date. @@ -27,43 +27,46 @@ Inconnu (la météo peut aussi être écrite sur la deuxième ligne, selon votre -2023-01-03 +03/01/2023 [Note] Si seule la date est écrite, il n'y aura pas de deuxième séparateur après celle-ci. +++ -2023-01-04 Nuageux +04/01/2023 Nuageux Trois signes plus \texttt{+++} peuvent agrandir la page courante d'environ une ligne. Parfois, une seule phrase ou quelques mots tombent sur la page suivante --- dans de tels cas, vous pouvez l'utiliser pour améliorer l'effet d'affichage. -2023-01-05 Nuageux - - ... +========== +05-01-2023 Nuageux --- Travail à domicile +========== +Vous pouvez également organiser votre code comme ceci. -2023-01-06 Nuageux +========== +06-01-2023 Ensoleillé --- Travail à domicile +========== - ... +... -2023-01-07 Nuageux +07/01/2023 Nuageux ... -2023-01-08 Nuageux +08/01/2023 Nuageux Une semaine plus tard, la couleur revient à la précédente... -2023-01-09 Nuageux +09/01/2023 Nuageux ... diff --git a/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls b/Master/texmf-dist/tex/latex/jwjournal/jwjournal.cls index 5d0b6754dc1..4d515d580a9 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/01/05} {} + {2023/01/07} {} {JW's journal class} \keys_define:nn { jwjournal } @@ -78,7 +78,7 @@ \enspace \tikz [x=.75ex,y=.75ex,line~width=.2ex,line~join=round,baseline=-.3ex] \draw [jwjournal-entry!60!main-text] (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle; \enspace - \projlib_datetime_display_week:n { #1 } + \projlib_datetime_display_week_uppercase:n { #1 } \tl_if_blank:eF { #2 } { \enspace @@ -128,30 +128,39 @@ \seq_map_inline:Nn \l_jwjournal_tmp_seq { \tl_set:Nn \l_tmpa_tl { ❄️ ##1 } - \regex_match:nVTF { ❄️ +++ (.*) } \l_tmpa_tl + \regex_replace_all:nnN + { ={3,} } + { } + \l_tmpa_tl + \regex_match:nVT { ❄️ +++ (.*) } \l_tmpa_tl { - \bool_set_true:N \l_tmpa_bool - \regex_replace_all:nnN + \tl_gput_right:Nn \g_jwjournal_content_tl { \g_jwjournal_enlarge_page_by_one_line_tl } + \regex_replace_once:nnN { ❄️ +++ (.*) } { ❄️ \1 } \l_tmpa_tl } - { - \bool_set_false:N \l_tmpa_bool - } - \regex_replace_all:nnN + \regex_replace_once:nnN { ❄️ (\ *)? (\d{4}-\d{1,2}-\d{1,2}) (\ *)? (.*) } { \c{JWJournalEntry} {\2} {\4} } \l_tmpa_tl - \regex_replace_all:nnN + \regex_replace_once:nnN + { ❄️ (\ *)? (\d{1,2}-\d{1,2}-\d{4}) (\ *)? (.*) } + { \c{JWJournalEntry} {\2} {\4} } + \l_tmpa_tl + \regex_replace_once:nnN + { ❄️ (\ *)? (\d{4} \D \d{1,2} \D \d{1,2}) (\ *)? (.*) } + { \c{JWJournalEntry} {\2} {\4} } + \l_tmpa_tl + \regex_replace_once:nnN + { ❄️ (\ *)? (\d{1,2} \D \d{1,2} \D \d{4}) (\ *)? (.*) } + { \c{JWJournalEntry} {\2} {\4} } + \l_tmpa_tl + \regex_replace_once:nnN { ❄️ (\[.*\] .*) } { \c{JWJournalItem} {\1} } \l_tmpa_tl - \regex_replace_all:nnN { ❄️ } { } \l_tmpa_tl - \bool_if:NT \l_tmpa_bool - { - \tl_gput_right:Nn \g_jwjournal_content_tl { \g_jwjournal_enlarge_page_by_one_line_tl } - } + \regex_replace_once:nnN { ❄️ } { } \l_tmpa_tl \tl_gput_right:NV \g_jwjournal_content_tl \l_tmpa_tl \tl_gput_right:Nn \g_jwjournal_content_tl { \par } } |