Jinwen-XU / jwjournal

A personal LaTeX class for writing journals
https://ctan.org/pkg/jwjournal
LaTeX Project Public License v1.3c
13 stars 2 forks source link

Unable to use \include{} or \input{} commands #4

Closed PuyGonzalo closed 11 months ago

PuyGonzalo commented 11 months ago

Hello! When trying to write my personal diary with this beautiful package I ran into a little problem. I want my entrys to be separated by folder. Each folder would be a year, and each year would contain .tex files named after each month. Example The foder would be (Entrys/2023/10.tex).

The problem is that when i do

\documentclass[12pt, paperstyle = light yellow, color entry]{jwjournal}

\UseLanguage{Spanish}
\begin{document}

\include{Entrys/2023/10}

\end{document}

I get this

image

Is there a work around this? I would like to make a for loop for automatically adding every month on the main file.

Also I would like to know if there is a way of making some \section{} to separate each month with a little title.

EDIT: Code block

Jinwen-XU commented 11 months ago

Thank you for mentioning this nice feature on my birthday! I am also noticing that my journals are becoming a bit too much to manage. I shall take this chance to study some knowledge regarding ltfilehook. After having some progress I shall come back to you soon (hopefully within one day).

During this time, perhaps you may briefly describe what kind of \section style are you expecting? Since currently I am keeping a separate .pdf file for each half of a month, I haven't yet quite thought about this or had a nice idea regarding how this should be designed.

PuyGonzalo commented 11 months ago

Hey! Happy birthday!! Hope you had a great day :). I'm glad you like the feature.

Regarding the \section style, I wasn't aware that this class already support it (my bad). The current one It's fine, It's just what I expected. The only thing that I would like is an option to make the \section name bold. \textbf doesn't work as I intended and I can't use **(text)** as the readme says (could this happen because I'm using Overleaf?).

Best regards.

Jinwen-XU commented 11 months ago

Thank you for your well-wishes! That is very kind of you :)

In the following paragraphs there are some new features and a few explanations of it. At the end, a new candidate version of this class is provided. I hope that you could write me some feedback: then I may decide whether to upload this version to CTAN or should I make some more modifications before that.

Regarding the section style, the base class has the options title in boldface, title in sffamily and title in scshape, you may use one or multiple of them as the class option to set the title font shape. Let's suppose that you have enabled all of them (just for demonstration). There are also several already available styles for you to choose from (again, via the class option):

However, since the base class is essentially designed to write math essays, all of the above section styles are not specifically designed for this journal class. Therefore, don't hesitate to ask me to redesign it as you wish!


With the following modified version of jwjournal.sty (provided at the end), it is possible to write (unnumbered) sections as:

## {You section title}

or the numbered version

##+{You section title}

Also, unfortunately, directly using \input and \include won't work. For this purpose I have defined two new commands \InputJournal and \IncludeJournal with the same usage as \input and \include but with different internal details. The shortcuts in the document are:

:: {file you wish to input}

and

::: {file you wish to include}

However, if you are writing the for loop in the preamble, you shall need the explicit version \InputJournal and \IncludeJournal instead of the shortcuts (which only work inside \begin{document} and \end{document}).

(By the way, just out of curiosity, may I ask how are you planning to achieve such a for loop?)


Below is the modified version of jwjournal.sty. You can copy the content of it, and put it inside a new text file, and then rename it to jwjournal.sty, and upload it to the folder on Overleaf where your main document lies in.

You might notice many ❄️ in the code, this is mainly because that my country was hosting the Winter Olympics when I was building the first draft of this code :)


%%
%% Copyright (C) 2023 by Jinwen XU
%% -------------------------------
%%
%% This file 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
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{jwjournal}
{2023/10/19} {}
{JW's journal class}

\keys_define:nn { jwjournal } { , scroll .bool_set:N = \l__jwjournal_scroll_bool , scroll .initial:n = { false } , color entry .bool_set:N = \ljwjournal_color_entry_bool , color entry .initial:n = { false } , color~entry .bool_set:N = \ljwjournal_color_entry_bool , color-entry .bool_set:N = \l__jwjournal_color_entry_bool , unknown .code:n = { \PassOptionsToClass { \CurrentOption } { minimart } \PassOptionsToClass { \CurrentOption } { einfart } \PassOptionsToPackage { \CurrentOption } { ProjLib } } } \ProcessKeyOptions [ jwjournal ]

\sys_if_engine_pdftex:TF { \PassOptionsToClass { use indent = false } { minimart } \LoadClass { minimart } } { \PassOptionsToClass { use indent = false } { einfart } \LoadClass { einfart } }

\RequirePackage { ProjLib }

\PassOptionsToPackage { many } { tcolorbox } \RequirePackage { tcolorbox } \RequirePackage { needspace }

\colorlet { jwjournal-color-1 } { yellow!50!green } \colorlet { jwjournal-color-2 } { yellow!70!orange } \colorlet { jwjournal-color-3 } { cyan!70!blue } \colorlet { jwjournal-color-4 } { violet } \colorlet { jwjournal-color-5 } { yellow!40!cyan } \colorlet { jwjournal-color-6 } { yellow!20!orange } \colorlet { jwjournal-color-7 } { red!20!orange }

\colorlet { jwjournal-entry } { . }

\NewDocumentCommand \JWJournalSeperator { O{jwjournal-entry!60!main-text} } { \enspace \tikz [x=.75ex,y=.75ex,line~width=.2ex,line~join=round,baseline=-.3ex] \draw [#1] (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle; \enspace }

\NewDocumentCommand \JWJournalEntry { m m } { \phantomsection \skip_vertical:n { .5 \baselineskip } \needspace { 2 \baselineskip } \projlib_datetime_calculate_week_according_to_format:n { #1 } \colorlet { jwjournal-entry } { jwjournal-color- \int_use:N \l__projlib_datetime_day_of_week_result_int } \bool_if:NTF \ljwjournal_color_entry_bool { \colorlet { jwjournal-entry-background } { jwjournal-entry!10!paper } } { \colorlet { jwjournal-entry-background } { paper } } \addcontentsline { toc } { section } { #1 } \begin{tcolorbox}[enhanced~jigsaw, enlarge~left~by=-3.5mm, width=\textwidth+3.5mm, colback=jwjournal-entry-background, boxrule=0pt, top= \bool_if:NTF \ljwjournal_color_entry_bool { 2pt } { 0pt }, bottom= \bool_if:NTF \ljwjournal_color_entry_bool { 2pt } { 0pt }, left=2.5mm, right= \bool_if:NTF \ljwjournal_color_entry_bool { 2mm } { -1mm }, borderline~west={1.5mm}{0mm}{jwjournal-entry!90!main-text}, frame~hidden] \sffamily \bfseries \bool_if:NT \l__jwjournal_color_entry_bool { \color {jwjournal-entry!30!main-text} } \ProjLibDate { #1 } \JWJournalSeperator{} \projlib_datetime_display_week_uppercase:n { #1 } \tl_if_blank:eF { #2 } { \JWJournalSeperator{}

2

      }
\end{tcolorbox}
\nopagebreak

}

\RequirePackage { enumitem } \setlist [ description ] { font = \normalfont\sffamily, leftmargin = 3em, topsep = 0pt, labelsep = 1em } \newlist { jwjournal-continued-text } { itemize } { 1 } \setlist [ jwjournal-continued-text ] { leftmargin = 3em, topsep = 0pt, label = {} } \dim_new:N \l_jwjournal_labelsep_dim \dim_set:Nn \l_jwjournal_labelsep_dim { \labelsep } \setlist [ 2 ] { labelsep = \l_jwjournal_labelsep_dim, labelwidth = !} \RenewDocumentCommand \descriptionlabel { m } { \makebox[\maxof{\width}{2em}][l]{ \tcbox[enhanced~jigsaw, breakable, oversize, on~line, arc = .12em, outer~arc = .1em, colframe = jwjournal-entry, colupper=main-text, opacityback = 0, boxsep = .1em, boxrule = .125em, left = .1em, right = .1em, top = .05em, bottom = .05em] { #1 } } } \NewDocumentCommand \JWJournalItem { m m } { \begin{description} \item[#1] #2 \end{description} } \NewDocumentCommand \JWJournalContinue { m } { \begin{jwjournal-continued-text} \item #1 \end{jwjournal-continued-text} }

\NewDocumentCommand \JWJournalNote { m } { \bool_if:NTF \ljwjournal_color_entry_bool { \colorlet { jwjournal-note-background } { jwjournal-entry!3!paper } } { \colorlet { jwjournal-note-background } { paper } } \begin{tcolorbox}[enhanced~jigsaw, breakable, colback=jwjournal-note-background, boxrule=0pt, top=2pt, bottom=2pt, left=1em-1mm, right= \bool_if:NTF \ljwjournal_color_entry_bool { 2mm } { -1mm }, borderline~west={1mm}{0mm}{jwjournal-entry!90!main-text!60!paper}, frame~hidden]

1

\end{tcolorbox}

}

\NewDocumentCommand \JWJournalSkip { D<>{.5} } { % \vspace{#1\baselineskip} % \vskip#1\baselineskip \par\vspace{#1\baselineskip} } \NewDocumentCommand \JWJournalBack { D<>{.5} } { % \vspace{-#1\baselineskip} % \vskip-#1\baselineskip \par\vspace{-#1\baselineskip} }

\newenvironment{JWJournalCompactCenter} {\parskip=0pt\par\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \newenvironment{JWJournalCenter} {\parskip=0pt\par\medskip\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \newenvironment{JWJournalLeft} {\parskip=0pt\par\medskip\nopagebreak\raggedright} {\par\noindent\ignorespacesafterend} \newenvironment{JWJournalRight} {\parskip=0pt\par\medskip\nopagebreak\raggedleft} {\par\noindent\ignorespacesafterend} \NewDocumentCommand \JWJournalCompactCenterText { m } { \begin{JWJournalCompactCenter}

1

\end{JWJournalCompactCenter}

} \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= \tl_use:N \l_tmpa_tl \linewidth]{#2} \end{JWJournalCenter} } \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= \tl_use:N \l_tmpa_tl \linewidth]{#2} \end{JWJournalLeft} } \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= \tl_use:N \l_tmpa_tl \linewidth]{#2} \end{JWJournalRight} }

\tl_new:N \g_jwjournal_content_tl \NewDocumentEnvironment { jwjournal } { +b } { \tl_gset:Nn \g_jwjournal_content_tl { #1 } \jwjournal_parse_content:N \g_jwjournal_content_tl \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 \seq_new:N \l_jwjournal_tmp_seq \tl_new:N \l_jwjournal_tmp_tl \cs_generate_variant:Nn \regex_split:nnN { nVN } \cs_new:Nn \jwjournal_parse_content:N { \regex_split:nVN { \c{par} } #1 \l_jwjournal_tmp_seq \tl_set:Nn \g_jwjournal_content_tl {} \seq_map_inline:Nn \l_jwjournal_tmp_seq { \tl_set:Nn \l_jwjournal_tmp_tl { ❄️ ##1 }

    \regex_replace_all:nnN
      { ={3,} }
      { }
      \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
          {
            \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} }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { \(\( }
      { \c{JWJournalShowImageLeft} }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { \)\) }
      { \c{JWJournalShowImageRight} }
      \l_jwjournal_tmp_tl

    \regex_replace_once:nnN
      { \| }
      { \c{hfill} }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { [^\:]// }
      { \c{c_jwjournal_new_line_with_skip_tl} }
      \l_jwjournal_tmp_tl

    \regex_replace_all:nnN
      { \*\*\* (.*?) \*\*\* }
      { \c{textbf} { \c{emph} {\1} } }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { \*\* (.*?) \*\* }
      { \c{textbf} {\1} }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { \* (.*?) \* }
      { \c{emph} {\1} }
      \l_jwjournal_tmp_tl

    \regex_replace_once:nnN
      { >>> \ *? (.*) }
      { \c{JWJournalNote} {\1} }
      \l_jwjournal_tmp_tl
    \regex_replace_all:nnN
      { \ *? >>> \ *? }
      { }
      \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_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
    %       { \JWJournalNote { ####1 } }
    %   }

    \exp_args:Nno \regex_split:nnN { >> } { \l_jwjournal_tmp_tl } \l_tmpa_seq
    \seq_pop_left:NN \l_tmpa_seq \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
          { \JWJournalCompactCenterText { ####1 } }
      }

    \bool_set_false:N \l_jwjournal_regex_no_more_match_bool
    \bool_do_until:nn \l_jwjournal_regex_no_more_match_bool
      {
        \regex_match:nVTF { ❄️ \ *? \+{3} } \l_jwjournal_tmp_tl
          {
            \tl_gput_right:Nn \g_jwjournal_content_tl { \c_jwjournal_enlarge_page_by_one_line_tl }
            \regex_replace_once:nnN
              { ❄️ \ *? \+{3} (.*) }
              { ❄️ \1 }
              \l_jwjournal_tmp_tl
          }
          {
            \bool_set_true:N \l_jwjournal_regex_no_more_match_bool
          }
      }

    \regex_replace_once:nnN
      { ❄️ (\ *)? (\d{4}-\d{1,2}-\d{1,2}) (\ *)? (.*) }
      { \c{JWJournalEntry} {\2} {\4} }
      \l_jwjournal_tmp_tl
    \regex_replace_once:nnN
      { ❄️ (\ *)? (\d{1,2}-\d{1,2}-\d{4}) (\ *)? (.*) }
      { \c{JWJournalEntry} {\2} {\4} }
      \l_jwjournal_tmp_tl
    \regex_replace_once:nnN
      { ❄️ (\ *)? (\d{4} \D \d{1,2} \D \d{1,2}) (\ *)? (.*) }
      { \c{JWJournalEntry} {\2} {\4} }
      \l_jwjournal_tmp_tl
    \regex_replace_once:nnN
      { ❄️ (\ *)? (\d{1,2} \D \d{1,2} \D \d{4}) (\ *)? (.*) }
      { \c{JWJournalEntry} {\2} {\4} }
      \l_jwjournal_tmp_tl

    \regex_replace_once:nnN
      { ❄️ \ *? \[(.*)\] (.*) }
      { \c{JWJournalItem} {\1} {\2} }
      \l_jwjournal_tmp_tl
    \regex_replace_once:nnN
      { ❄️ \ *? 【(.*)】(.*) }
      { \c{JWJournalItem} {\1} {\2} }
      \l_jwjournal_tmp_tl

    \regex_replace_once:nnN
      { ❄️ \ *? \~\~ \ *? (.*) }
      { \c{JWJournalContinue} {\1} }
      \l_jwjournal_tmp_tl

    \regex_replace_once:nnN { ❄️ } { } \l_jwjournal_tmp_tl

    \tl_gput_right:NV \g_jwjournal_content_tl \l_jwjournal_tmp_tl
    \tl_gput_right:Nn \g_jwjournal_content_tl { \par }
  }

}

\bool_if:NTF \l__jwjournal_scroll_bool { \tl_const:Nn \c_jwjournal_enlarge_page_by_one_line_tl {} \geometry{ papersize={7in,\maxdimen}, top=.75in,bottom=.75in, left=.75in,right=.66in, marginparsep=.75em, marginparwidth=.75in, footnotesep=2em plus 2pt minus 2pt, } \hook_gput_code:nnn { begindocument } { jwjournal } { \setbox0=\vbox \bgroup \begin { jwjournal } } \providecommand{\pdfpageheight}{\pageheight} \hook_gput_code:nnn { enddocument } { jwjournal } { \end { jwjournal } \egroup \dimen0=\dp0 \pdfpageheight=\dimexpr\ht0+1.5in\relax \ifdim\pdfpageheight<10in \pdfpageheight=10in \fi \unvbox0\kern-\dimen0 } } { \tl_const:Nn \c_jwjournal_enlarge_page_by_one_line_tl { \enlargethispage{\baselineskip} } \geometry{ papersize={7in,10in}, top=.75in,bottom=.75in, left=.75in,right=.66in, marginparsep=.75em, marginparwidth=.75in, footnotesep=2em plus 2pt minus 2pt, } \hook_gput_code:nnn { begindocument } { jwjournal } { \begin { jwjournal } } \hook_gput_code:nnn { enddocument } { jwjournal } { \end { jwjournal } } }

\pagestyle { empty }

\endinput %% %% End of file `jwjournal.cls'.

PuyGonzalo commented 11 months ago

First of all, thank you for yout time. And I will be glad to share the for loop once I solve this problems.


I'm still having some issues, even after doing this

Below is the modified version of jwjournal.sty. You can copy the content of it, and put it inside a new text file, and then rename it to jwjournal.sty, and upload it to the folder on Overleaf where your main document lies in.

For context, this is my file tree on Overleaf:

.
├── main.tex
├── jwjournal.sty
└── Entradas/
    └── 2023/
        └── 10.tex

And this is my current example code (sorry for the spanish names):


\documentclass[12pt, paperstyle = light yellow, color entry, title in boldface, title in boldface, style = classical]{jwjournal}
\UseLanguage{Spanish}

% Comandos para los meses
%\newcommand{\newCommandName}{text to insert}

\begin{document}

\section*{Diario personal \\ \vspace{4mm} Año 2023}

##{October} % This doesn´t work
\subsection{October} % This does
\subsection*{October}

% Neither of this work
:: {Entradas/2023/10.tex}\\
::: {Entradas/2023/10.tex}\\
\InputJournal{Entradas/2023/10.tex}\\
\IncludeJournal{Entradas/2023/10.tex}\\

% Here is an example to show that some features don´t work at all. Don't know why
2023-01-01 Sunny | Botanical Garden

  Today I visited the botanical garden!

  [Food] And had *ice cream* for lunch!

  >>> This botanical garden has a history of nearly two hundred years, take a look at this photo:
      || <0.40> {example-image}

  (( <0.45> {example-image-a}
  <- <5>
  )) <0.50> {example-image-b}
  <- <5>
  (( <0.45> {example-image-c}

\hspace{1cm}
\hrule
\hspace{1cm}

\section*{November}

\end{document}

And the output is:

image

As you can see there's a lot of features that doesn´t work well and I don't know why.

I'm using pdfLaTex as a compiler and Tex Live Version 2023 on the project settings.


This is the Raw log I get.

Jinwen-XU commented 11 months ago

This is one of the bad feature (yet many people rely on it) of Overleaf: it will still try hard to generate the pdf file even if there are serious errors in the code :(

Regarding your code, the option has to be use style = ..., not just style = .... After correcting this things should work out :)


Please note that I have edited the code in https://github.com/Jinwen-XU/jwjournal/issues/4#issuecomment-1772196248 to slightly change the syntax for inserting sections. The ## is now the unnumbered version (as with Markdown), while the numbered version should be specified via ##+.


Suppose that the main file is:

\documentclass[12pt, paperstyle = light yellow, color entry, title in boldface, title in sffamily, use style = classical]{jwjournal}
\UseLanguage{Spanish}

\begin{document}

## {Diario personal // Año 2023}

## {October}

### {Some subtitle}

:: {Entradas/2023/10}

2023-01-01 Sunny | Botanical Garden

  Today I visited the botanical garden!

  [Food] And had *ice cream* for lunch!

  >>> This botanical garden has a history of nearly two hundred years, take a look at this photo:
      || <0.40> {example-image}

  (( <0.45> {example-image-a}
  <- <5>
  )) <0.50> {example-image-b}
  <- <5>
  (( <0.45> {example-image-c}

\hspace{1cm}
\hrule
\hspace{1cm}

\section*{November}

\end{document}

And the 10.tex is:

2023-10-01
==========

This is a subfile.

Then (part of) the result would be like:

image

By the way, I don't think \hrule is a good thing to be directly written in the document. Actually the spirit of LaTeX is that any visual design should be left to the document class. Thus if the currently provided syntax doesn't suit your need, then you should definitely open an issue to ask for new features :) I would usually be able to achieve this within 3 days.

Jinwen-XU commented 11 months ago

Since you've used separation line in your document, I believe it would be nice to have this as a new syntax.

With the following version (provided at end), three or more hyphen char --- in a separate paragraph would produce a separation line (as with Markdown) crossing the page.


A demo document:

\documentclass[11pt, paperstyle=light yellow, color entry,
  title in boldface, title in sffamily, use style = classical]{jwjournal}

\begin{document}

2023-01-01
==========

Some text

---

2023-01-02
==========

More text

----

% This won't be matched:
Text ---

% and this:
--- text

Some text below

-----

## {New Section}

2023-01-03
==========

Some text

\end{document}
image

Below is the new version of jwjournal.cls:

%%
%% Copyright (C) 2023 by Jinwen XU
%% -------------------------------
%%
%% This file 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
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
  {jwjournal}
  {2023/10/19} {}
  {JW's journal class}

\keys_define:nn { jwjournal }
  {
    , scroll      .bool_set:N   = \l__jwjournal_scroll_bool
    , scroll      .initial:n    = { false }
    , color entry .bool_set:N   = \l__jwjournal_color_entry_bool
    , color entry .initial:n    = { false }
    , color~entry .bool_set:N   = \l__jwjournal_color_entry_bool
    , color-entry .bool_set:N   = \l__jwjournal_color_entry_bool
    , unknown     .code:n       = {
                                    \PassOptionsToClass { \CurrentOption } { minimart }
                                    \PassOptionsToClass { \CurrentOption } { einfart }
                                    \PassOptionsToPackage { \CurrentOption } { ProjLib }
                                  }
  }
\ProcessKeyOptions [ jwjournal ]

\sys_if_engine_pdftex:TF
  {
    \PassOptionsToClass { use indent = false } { minimart }
    \LoadClass { minimart }
  }
  {
    \PassOptionsToClass { use indent = false } { einfart }
    \LoadClass { einfart }
  }

\RequirePackage { ProjLib }

\PassOptionsToPackage { many } { tcolorbox }
\RequirePackage { tcolorbox }
\RequirePackage { needspace }

\colorlet { jwjournal-color-1 } { yellow!50!green  }
\colorlet { jwjournal-color-2 } { yellow!70!orange }
\colorlet { jwjournal-color-3 } { cyan!70!blue     }
\colorlet { jwjournal-color-4 } { violet           }
\colorlet { jwjournal-color-5 } { yellow!40!cyan   }
\colorlet { jwjournal-color-6 } { yellow!20!orange }
\colorlet { jwjournal-color-7 } { red!20!orange    }

\colorlet { jwjournal-entry } { . }
\colorlet { jwjournal-sep-line } { .!27!paper }

\NewDocumentCommand \JWJournalSeperator { O{jwjournal-entry!60!main-text} }
  {
    \enspace
    \tikz [x=.75ex,y=.75ex,line~width=.2ex,line~join=round,baseline=-.3ex]
      \draw [#1] (0,.5) -- (.5,1) -- (1,.5) -- (.5,0) -- (0,.5) -- cycle;
    \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
    \skip_vertical:n { .5 \baselineskip }
    \needspace { 2 \baselineskip }
    \projlib_datetime_calculate_week_according_to_format:n { #1 }
    \colorlet { jwjournal-entry } { jwjournal-color- \int_use:N \l__projlib_datetime_day_of_week_result_int }
    \bool_if:NTF \l__jwjournal_color_entry_bool
      {
        \colorlet { jwjournal-entry-background } { jwjournal-entry!10!paper }
      }
      {
        \colorlet { jwjournal-entry-background } { paper }
      }
    \addcontentsline { toc } { section } { #1 }
    \begin{tcolorbox}[enhanced~jigsaw,
      enlarge~left~by=-3.5mm, width=\textwidth+3.5mm,
      colback=jwjournal-entry-background,
      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 },
      borderline~west={1.5mm}{0mm}{jwjournal-entry!90!main-text}, frame~hidden]
        \sffamily \bfseries
        \bool_if:NT \l__jwjournal_color_entry_bool
          {
            \color {jwjournal-entry!30!main-text}
          }
        \ProjLibDate { #1 }
        \JWJournalSeperator{}
        \projlib_datetime_display_week_uppercase:n { #1 }
        \tl_if_blank:eF { #2 }
          {
            \JWJournalSeperator{}
            #2
          }
    \end{tcolorbox}
    \nopagebreak
  }

\RequirePackage { enumitem }
\setlist [ description ] { font = \normalfont\sffamily, leftmargin = 3em, topsep = 0pt, labelsep = 1em }
\newlist { jwjournal-continued-text } { itemize } { 1 }
\setlist [ jwjournal-continued-text ] { leftmargin = 3em, topsep = 0pt, label = {} }
\dim_new:N \l_jwjournal_labelsep_dim
\dim_set:Nn \l_jwjournal_labelsep_dim { \labelsep }
\setlist [ 2 ] { labelsep = \l_jwjournal_labelsep_dim, labelwidth = !}
\RenewDocumentCommand \descriptionlabel { m }
  {
    \makebox[\maxof{\width}{2em}][l]{
      \tcbox[enhanced~jigsaw, breakable, oversize,
      on~line, arc = .12em, outer~arc = .1em,
      colframe = jwjournal-entry, colupper=main-text, opacityback = 0,
      boxsep = .1em, boxrule = .125em,
      left = .1em, right = .1em, top = .05em, bottom = .05em] { #1 }
    }
  }
\NewDocumentCommand \JWJournalItem { m m }
  {
    \begin{description}
      \item[#1] #2
    \end{description}
  }
\NewDocumentCommand \JWJournalContinue { m }
  {
    \begin{jwjournal-continued-text}
      \item #1
    \end{jwjournal-continued-text}
  }

\NewDocumentCommand \JWJournalNote { m }
  {
    \bool_if:NTF \l__jwjournal_color_entry_bool
      {
        \colorlet { jwjournal-note-background } { jwjournal-entry!3!paper }
      }
      {
        \colorlet { jwjournal-note-background } { paper }
      }
    \begin{tcolorbox}[enhanced~jigsaw, breakable,
      colback=jwjournal-note-background,
      boxrule=0pt, top=2pt, bottom=2pt, left=1em-1mm, right=
        \bool_if:NTF \l__jwjournal_color_entry_bool
          { 2mm }
          { -1mm },
      borderline~west={1mm}{0mm}{jwjournal-entry!90!main-text!60!paper}, frame~hidden]
        #1
    \end{tcolorbox}
  }

\NewDocumentCommand \JWJournalSkip { D<>{.5} }
  {
    % \vspace{#1\baselineskip}
    % \vskip#1\baselineskip
    \par\vspace{#1\baselineskip}
  }
\NewDocumentCommand \JWJournalBack { D<>{.5} }
  {
    % \vspace{-#1\baselineskip}
    % \vskip-#1\baselineskip
    \par\vspace{-#1\baselineskip}
  }

\newenvironment{JWJournalCompactCenter}
  {\parskip=0pt\par\nopagebreak\centering}
  {\par\noindent\ignorespacesafterend}
\newenvironment{JWJournalCenter}
  {\parskip=0pt\par\medskip\nopagebreak\centering}
  {\par\noindent\ignorespacesafterend}
\newenvironment{JWJournalLeft}
  {\parskip=0pt\par\medskip\nopagebreak\raggedright}
  {\par\noindent\ignorespacesafterend}
\newenvironment{JWJournalRight}
  {\parskip=0pt\par\medskip\nopagebreak\raggedleft}
  {\par\noindent\ignorespacesafterend}
\NewDocumentCommand \JWJournalCompactCenterText { m }
  {
    \begin{JWJournalCompactCenter}
      #1
    \end{JWJournalCompactCenter}
  }
\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= \tl_use:N \l_tmpa_tl \linewidth]{#2}
    \end{JWJournalCenter}
  }
\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= \tl_use:N \l_tmpa_tl \linewidth]{#2}
    \end{JWJournalLeft}
  }
\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= \tl_use:N \l_tmpa_tl \linewidth]{#2}
    \end{JWJournalRight}
  }

\tl_new:N \g_jwjournal_content_tl
\NewDocumentEnvironment { jwjournal } { +b }
  {
    \tl_gset:Nn \g_jwjournal_content_tl { #1 }
    \jwjournal_parse_content:N \g_jwjournal_content_tl
    \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
\seq_new:N \l_jwjournal_tmp_seq
\tl_new:N \l_jwjournal_tmp_tl
\cs_generate_variant:Nn \regex_split:nnN { nVN }
\cs_new:Nn \jwjournal_parse_content:N
  {
    \regex_split:nVN { \c{par} } #1 \l_jwjournal_tmp_seq
    \tl_set:Nn \g_jwjournal_content_tl {}
    \seq_map_inline:Nn \l_jwjournal_tmp_seq
      {
        \tl_set:Nn \l_jwjournal_tmp_tl { ❄️ ##1 }

        \regex_replace_all:nnN
          { ={3,} }
          { }
          \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
              {
                \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} }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { \(\( }
          { \c{JWJournalShowImageLeft} }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { \)\) }
          { \c{JWJournalShowImageRight} }
          \l_jwjournal_tmp_tl

        \regex_replace_once:nnN
          { \| }
          { \c{hfill} }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { [^\:]// }
          { \c{c_jwjournal_new_line_with_skip_tl} }
          \l_jwjournal_tmp_tl

        \regex_replace_all:nnN
          { \*\*\* (.*?) \*\*\* }
          { \c{textbf} { \c{emph} {\1} } }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { \*\* (.*?) \*\* }
          { \c{textbf} {\1} }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { \* (.*?) \* }
          { \c{emph} {\1} }
          \l_jwjournal_tmp_tl

        \regex_replace_once:nnN
          { >>> \ *? (.*) }
          { \c{JWJournalNote} {\1} }
          \l_jwjournal_tmp_tl
        \regex_replace_all:nnN
          { \ *? >>> \ *? }
          { }
          \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_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
        %       { \JWJournalNote { ####1 } }
        %   }

        \exp_args:Nno \regex_split:nnN { >> } { \l_jwjournal_tmp_tl } \l_tmpa_seq
        \seq_pop_left:NN \l_tmpa_seq \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
              { \JWJournalCompactCenterText { ####1 } }
          }

        \bool_set_false:N \l_jwjournal_regex_no_more_match_bool
        \bool_do_until:nn \l_jwjournal_regex_no_more_match_bool
          {
            \regex_match:nVTF { ❄️ \ *? \+{3} } \l_jwjournal_tmp_tl
              {
                \tl_gput_right:Nn \g_jwjournal_content_tl { \c_jwjournal_enlarge_page_by_one_line_tl }
                \regex_replace_once:nnN
                  { ❄️ \ *? \+{3} (.*) }
                  { ❄️ \1 }
                  \l_jwjournal_tmp_tl
              }
              {
                \bool_set_true:N \l_jwjournal_regex_no_more_match_bool
              }
          }

        \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} }
          \l_jwjournal_tmp_tl
        \regex_replace_once:nnN
          { ❄️ (\ *)? (\d{1,2}-\d{1,2}-\d{4}) (\ *)? (.*) }
          { \c{JWJournalEntry} {\2} {\4} }
          \l_jwjournal_tmp_tl
        \regex_replace_once:nnN
          { ❄️ (\ *)? (\d{4} \D \d{1,2} \D \d{1,2}) (\ *)? (.*) }
          { \c{JWJournalEntry} {\2} {\4} }
          \l_jwjournal_tmp_tl
        \regex_replace_once:nnN
          { ❄️ (\ *)? (\d{1,2} \D \d{1,2} \D \d{4}) (\ *)? (.*) }
          { \c{JWJournalEntry} {\2} {\4} }
          \l_jwjournal_tmp_tl

        \regex_replace_once:nnN
          { ❄️ \ *? \[(.*)\] (.*) }
          { \c{JWJournalItem} {\1} {\2} }
          \l_jwjournal_tmp_tl
        \regex_replace_once:nnN
          { ❄️ \ *? 【(.*)】(.*) }
          { \c{JWJournalItem} {\1} {\2} }
          \l_jwjournal_tmp_tl

        \regex_replace_once:nnN
          { ❄️ \ *? \~\~ \ *? (.*) }
          { \c{JWJournalContinue} {\1} }
          \l_jwjournal_tmp_tl

        \regex_replace_once:nnN { ❄️ } { } \l_jwjournal_tmp_tl

        \tl_gput_right:NV \g_jwjournal_content_tl \l_jwjournal_tmp_tl
        \tl_gput_right:Nn \g_jwjournal_content_tl { \par }
      }
  }

\bool_if:NTF \l__jwjournal_scroll_bool
  {
    \tl_const:Nn \c_jwjournal_enlarge_page_by_one_line_tl {}
    \geometry{
      papersize={7in,\maxdimen},
      top=.75in,bottom=.75in,
      left=.75in,right=.66in,
      marginparsep=.75em,
      marginparwidth=.75in,
      footnotesep=2em plus 2pt minus 2pt,
    }
    \hook_gput_code:nnn { begindocument } { jwjournal }
      {
        \setbox0=\vbox
        \bgroup
        \begin { jwjournal }
      }
    \providecommand{\pdfpageheight}{\pageheight}
    \hook_gput_code:nnn { enddocument } { jwjournal }
      {
        \end { jwjournal }
        \egroup
        \dimen0=\dp0
        \pdfpageheight=\dimexpr\ht0+1.5in\relax
        \ifdim\pdfpageheight<10in
            \pdfpageheight=10in
        \fi
        \unvbox0\kern-\dimen0
      }
  }
  {
    \tl_const:Nn \c_jwjournal_enlarge_page_by_one_line_tl { \enlargethispage{\baselineskip} }
    \geometry{
      papersize={7in,10in},
      top=.75in,bottom=.75in,
      left=.75in,right=.66in,
      marginparsep=.75em,
      marginparwidth=.75in,
      footnotesep=2em plus 2pt minus 2pt,
    }
    \hook_gput_code:nnn { begindocument } { jwjournal }
      {
        \begin { jwjournal }
      }
    \hook_gput_code:nnn { enddocument } { jwjournal }
      {
        \end { jwjournal }
      }
  }

\pagestyle { empty }

\endinput
%%
%% End of file `jwjournal.cls'.
PuyGonzalo commented 11 months ago

Since you've used separation line in your document, I believe it would be nice to have this as a new syntax. With the following version (provided at end), three or more hyphen char --- in a separate paragraph would produce a separation line (as with Markdown) crossing the page.

Great feature! Thank you very much.


I was able to solve the features issue #4 comment (screeshot of output). I just rename the file jwjournal.sty thath you mentioned in 4# (comment) to jwjournal.cls on Overleaf and now every feature works like a charm.


Here is my current code, with the for loop implemented. Note that it is made in order to display only one year of entrys (which seems appropriate because who would want a very long pdf?) but you can easily change the displayed year with \newcommand{\currentYear}{<year>}.

Hope you like it.

\documentclass[12pt, paperstyle = light yellow, color entry, title in boldface, title in sffamily, use style = classical]{jwjournal}
\UseLanguage{Spanish}

% Current year command
\newcommand{\currentYear}{2023}

% Switch case for months
\newcommand\monthswitch[1]{%
    \ifcase#1\relax\or % No case 0, starts from 1.
        \subsection*{Enero} 
    \or
        \subsection*{Febrero} 
    \or
        \subsection*{Marzo} 
    \or
        \subsection*{Abril}
    \or
        \subsection*{Mayo}
    \or
        \subsection*{Junio}
    \or
        \subsection*{Julio}
    \or
        \subsection*{Agosto}
    \or
        \subsection*{Septiembre}
    \or
        \subsection*{Octubre}
    \or
        \subsection*{Noviembre}
    \or
        \subsection*{Diciembre}
    \else
        % Default case (Do nothing)
    \fi
}

\begin{document}
% Some kind of title.
## {Diario personal // Año \currentYear}%

% Files MUST be named by the number of the month. e.g: '2.tex' for february. 
\foreach \month in {1,...,12}%
{   \IfFileExists{Entradas/\currentYear/\month}
    {%
        \monthswitch{\month}
        :: {Entradas/\currentYear/\month}
    }%
    {   % files does not exist, so nothing to do...
    }%
}% 
\end{document}

Best regards :).

Jinwen-XU commented 11 months ago

Thank you for this code, very enlightening!

I have uploaded this version of code to CTAN as version 2023-10-19, but since Overleaf only update their TeX distribution once per year, you would probably need to keep your local version of jwjournal.cls until then. (By the way, sorry that I mistakenly wrote jwjournal.cls as .sty.)

Since all the mentioned issues and features have been completed, I shall mark this issue as closed. If you encounter any further issue or would like to have any new feature, please feel free to open a new channel. Also, hope that every feature works fine with Spanish, and in case you find any linguistic issue with the document class please kindly inform me, I shall fix it as soon as possible :)