Jinwen-XU / colorist

Write your articles or books in a colorful way
https://ctan.org/pkg/colorist
LaTeX Project Public License v1.3c
24 stars 2 forks source link

`hyperref` Functionality Support for Fast Mode #4

Closed Teddy-van-Jerry closed 1 year ago

Teddy-van-Jerry commented 1 year ago

Current Situation

Hi, I know that hyperref is turned off in the fast mode, as can been seen here.

Problem of the fast Mode with hyperref

  • Class: beaulivre
  • LaTeX Engine: TeX Live 2022 on macOS (with all updates)

However, turning that off completely can introduce some trouble in the document. I have been using this code (repo here) in the preamble to do hyperref stuff only when fast mode is false:

\newcommand{\turnoffhypercolor}{\relax}

\ExplSyntaxOn
\bool_if:NF \l__colorclass_fast_bool
  {
    \hypersetup
      {
        , pdfauthor  = { Wuqiong~Zhao~(Teddy~van~Jerry) }
        , pdftitle   = { mmCEsim~Documentation~\&~Tutorials }
        , pdfsubject = { mmCEsim }
        , colorlinks = true
        , urlcolor   = blue
        , linkcolor  = purple
        , citecolor  = red
      }
    \renewcommand{\turnoffhypercolor}{\hypersetup{hidelinks}}
  }
\ExplSyntaxOff

But in the document, we may sometimes use the \hyperref macro, for example

% Though \ref would do, we are just using this as an exmaple.
View \hyperref[sec:foo]{this section} for details.
\section{Foo}\label{sec:foo}

Check the fast mode in the main document can be tedious.

Possible Solution

I have tested by changing this line in the generated colorist-fancy.sty and it worked properly. With my limited LaTeX knowledge, I reckon hyperref in the draft mode should work since no actual link is activated.

\bool_if:NTF \l__colorist_fast_bool
  {
    \RequirePackage { hyperref } % <- added
    \hypersetup { draft }        % <- added
    % original setup for `\href` or `\texorpdfstring` removed
  }
  {
    \RequirePackage { hyperref }
    \RequirePackage { bookmark }
    \hypersetup{ hidelinks, linktoc = all }
    \bookmarksetup{ numbered }
    % other stuff
  }

The original way is to provide frequently used macros, but that can miss some (for instance \hyperref or \hypertarget) which can be dangerous, so maybe draft mode of hyperref should be more desirable? I noticed that the compiling speed is quite okay.


Additional Question

I really love this template and am wondering if pull requests are accepted. Since I have noticed that all commit messages are written in that format, I am not quite sure what to do if I submit a pull request to provide more functionality or enhance the documentation.

Here is a small list I propose to work on:

Thanks again for your work in providing this beautiful template.

Jinwen-XU commented 1 year ago

Thank you for this proposal! I have changed it in Update 2023-01-02 (9757f76419347d722d2f6d699e6104f71724a5a3).

I didn't think about it too much when creating the fast mode. There was originally an efficiency issue with the command \CreateTheorem, which motivated me to introduce the fast mode, and the other changes like the one with hyperref are just "made along the way". However, when this has been fixed with the introduction of the package create-theorem, I hardly use that fast mode ever since, left it less tested and maintained.

Regarding pull requests, I would be most delightful to receive other people's contributions to this project. However, to be frank, I'm not very familiar with the feature of GitHub other than using the official GUI application GitHub Desktop, so I know very little about this process.

Some notes on the next steps of this project:

  1. New styles. Recently I have been mainly focusing on the parallel project minimalist. If you compare the commits, you would probably find that recent changes of the current project are mostly the same as there. For now, minimalist already contains 4 styles plain, classical, stream and flow (the latter two yet to be integrated into the .dtx file), while coloristhas only one style currently named fancy. A good news is that there are 5 more styles already in my mind (two of which resemble the stream and flow styles of minimalist, the other three come from a few beautiful designs I've seen recently) yet to be realized, which should be finished in the next two years.
  2. Doc and demo. The documentations are, unfortunately, completely out-of-date and require a thorough rewriting -- and it is also the case for minimalist and ProjLib. However, I still haven't yet came up with a good framework to begin with, nor have sufficient time to develop the ideas. For the TeX Live 2023 coming this April, I would probably just remove the currently documentations but keep the code to be the newest version. However, documentations and demos are always on the schedule.
  3. Code clear up. The current code is build up gradually in two years and there is a major update early last year with the transition to expl3. The resulting code is poorly formatted and less organized comparing to smaller (and newer) project like create-theorem.
  4. Details. The design of ToC, the font issues, the fast mode, the behaviors under different engines...
Teddy-van-Jerry commented 1 year ago

Thank you for your detailed explanations, and now I have a big picture of this project (as well as minimalist).

I personally love fancy and colourful stuff, so I am currently using the colorist series most. I assume that minimalist will suit many course reports perfectly!

Pull requests are quite simple and can be manipulated on github.com readily. The process will be:

  1. I commit changes in my fork of colorist or minimalist;
  2. I start the pull request, and you will see that on github.com;
  3. You review my changes and make comments;
  4. I make changes according to your comments, until you find them satisfactory;
  5. You then click the button to merge the changes;
  6. A result different from 5 can also be rejecting the changes.

I have gained some experience writing LaTeX2e documents (and publishing a naive package to CTAN) and I am learning expl3 recently. So I am willing to contribute to this project (as well as minimalist), maybe starting with small issues including enhancement of documentation which I am capable to help.

Jinwen-XU commented 1 year ago

Thank you for this explanation! Seems that this would be a nice interacting process :)

To leave you some impression of minimalist, here are a few documents I've created recently:

(These files are just for demonstrating the typographic result, I do not claim the copyright of their content.)

As for colorist, there would also be a style possibly named classical similar to the book Linear Algebra Done Right; a style possibly named simple similar to the various titles from the "Sciences Sup" collections in French; I'm also considering learning from the styles of the new book Explorations in Number Theory, various titles from the series "Oxford Graduate Texts in Mathematics" and some other nice-looking books -- once there is a good design on paper, writing the code won't be too hard -- but of course, all these have to wait until new documentations and demo documents are prepared.