# Using the scribble-math package with relative path for katex folder

**URL:** <https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649>\
**Category:** Questions & Answers\
**Created:** [January 5, 2024, 9:34pm UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649 "2024-01-05T21:34:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![encomer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/encomer/32/280_2.png) [@encomer](https://racket.discourse.group/u/encomer)\
**Post date:** [January 5, 2024, 9:34pm UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/1 "2024-01-05T21:34:51Z")

</div>

The **scribble-math** package is great for rendering LaTeX style formatted expressions. _**When used in multiple documents (e.g. quizzes, exams, class notes, et c.) it is very convenient to save time and space requiring only one copy of the katex folder**_, and _not a katex folder for each generated scribble document_. One easy way to accomplish that (with the current scribble-math version) is changing the html file generated by the "Scribble HTML" button, in the following way:

[Relevant part of the] originally generated HTML content:

```scheme
(function() {
  document.write('<link rel="stylesheet" href="katex/katex.min.css" />');
})();(function() {document.write('<scr' + 'ipt type="text/javascript" src="katex/katex.min.js"></scr' + 'ipt>');})();

```

Modified HTML content: **Just adding the prefix "../"** in the paths for the files **katex.min.css** and **katex.min.js** , resulting as:

```scheme
(function() {
  document.write('<link rel="stylesheet" href="../katex/katex.min.css" />');
})();(function() {document.write('<scr' + 'ipt type="text/javascript" src="../katex/katex.min.js"></scr' + 'ipt>');})();

```

_Observation_: I do the above modification for each revision of the different documents (mainly quizzes, class notes) used in an academic semester.

**Question** : _Would it be possible to add some optional parameter in the scribble-math package_, in order **to just add that prefix** _to the two file paths mentioned above_? (I understand that other alternative solutions may be possible).

_Thank you very much for your comments and support on this issue_.  
E. Comer  
P. S. _Formerly I asked for this functionality, but was unable to express it in the right terms_. _I apologize for that_. _Thank you to the scribble-math package developer_ for this **very useful** and **important package** for _creating mathematically oriented documents_.

---

<div class="post-metadata">

**Author:** ![encomer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/encomer/32/280_2.png) [@encomer](https://racket.discourse.group/u/encomer)\
**Post date:** [January 7, 2024, 3:34am UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/2 "2024-01-07T03:34:41Z")

</div>

_As a **reference** _: the **katex folder** , contains two subfolders, and **84** files, mostly font files. _The quantity of files is the main reason to create the folders and files just once_, for a collection of documents, and then for each document, refer only to the katex folder in just one location.

_Thank you for your suggestions and possible solutions_.

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [January 7, 2024, 1:14pm UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/3 "2024-01-07T13:14:23Z")

</div>

I am sure Suzanne will accept a PR to that solves this.

> _Thank you for your suggestions and possible solutions_ .

An alternative solution is to make symbolic links from the "katex" subfolders to a shared folder.

BTW: It's worth sending either an email to Suzanne or making an issue at the Github repo.

---

<div class="post-metadata">

**Author:** ![encomer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/encomer/32/280_2.png) [@encomer](https://racket.discourse.group/u/encomer)\
**Post date:** [January 8, 2024, 6:28pm UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/4 "2024-01-08T18:28:13Z")

</div>

Thank you @soegaard for sharing your ideas. _I hope the eventual solution will be useful also for other users_.

---

<div class="post-metadata">

**Author:** ![encomer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/encomer/32/280_2.png) [@encomer](https://racket.discourse.group/u/encomer)\
**Post date:** [January 14, 2024, 6:45am UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/5 "2024-01-14T06:45:45Z")

</div>

Thank you again @soegaard for your previous suggestion. I just published a comment on GitHub ([Fixed bugs reported by @encomer on Slack. Thanks! · SuzanneSoy/scribble-math@a69b6fa · GitHub](https://github.com/SuzanneSoy/scribble-math/commit/a69b6fad193757de5a62b6a1cabacb7557d02ff7#commitcomment-137014392)), with what seems to be a solution to the issue.  
_Best regards_.

---

<div class="post-metadata">

**Author:** ![hendrikboom3](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/hendrikboom3/32/2748_2.png) [@hendrikboom3](https://racket.discourse.group/u/hendrikboom3)\
**Post date:** [February 23, 2024, 9:54pm UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/6 "2024-02-23T21:54:38Z")

</div>

Maybe there should be a parameter that specifies the exact path to be used to the katex folder in generated output. Default should probably be the present behaviour.

---

<div class="post-metadata">

**Author:** ![encomer](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/encomer/32/280_2.png) [@encomer](https://racket.discourse.group/u/encomer)\
**Post date:** [June 11, 2024, 5:17am UTC](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/7 "2024-06-11T05:17:43Z")

</div>

Thank you @hendrikboom3 , _it works exactly as you said_, **if the package is updated with the code changes as indicated in the comment mentioned in the post with link** : [Using the scribble-math package with relative path for katex folder - #5 by encomer](https://racket.discourse.group/t/using-the-scribble-math-package-with-relative-path-for-katex-folder/2649/5).

For example, the following code:

```scheme
#lang scribble/manual
@;; doc1.scrbl
@require[scribble-math]
@title{Testing}
@(use-external-katex
  (list "../katex/katex.min.js"
        "../katex/katex.min.css"))
@$${\sum_{i=1}^n\;i=\dfrac{n(n+1)}{2}}

```

**Change the default behaviour** , and do not create the katex folder locally, but accept the declaration that there is already a katex _sibling folder_ with the needed files, and the **doc1.html** is created accordingly, in this case, with the code:

```scheme
... href="../katex/katex.min.css" ...
... src="../katex/katex.min.js" ...

```

instead of the default code:

```scheme
... href="katex/katex.min.css" ...
... src="katex/katex.min.js" ...

```

This happily works, thanks to the previous preparatory changes made to the **dollar.rkt** file in the **scribble-math** package by _Suzanne_. _But the above mentioned changes, have to be made, in order for the function_ `(use-external-katex ..)` _to work properly_.

Thank you again @hendrikboom3 for your comment. _We hope for an update in the near future_, of this **very useful scribble-math package** , in order to be able to use it _without technical changes in the installation of our students and/or colleagues_.

Kind regards.
