questions on MathJax
#25
Open
opened 5 years ago by jtangpanitanon
·
11 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hi, I'm a new pollen & racket users. I am experimenting with the source code for "Typography for Laywers" and trying to add LaTex equations into it on my computer.
Here is what I added into my html.pp file
However, the latex code only appears correctly in Example 1 where '◊h1' is used but this creates a bigger font than what I need. How can I make the latex code works without '◊h1'?
Another question is how do I move the following lines to pollen.rkt file? This is not obvious to me in the tutorial.
Thanks!
Welcome to Pollen and Racket!
FYI, in Github issues, which use Markdown, you should use triple backtick when you want to show a fragment of code so that the code is displayed verbatim and not parsed as Markdown.
For your second question, put:
in
pollen.rkt
. Make sure that yourpollen.rkt
either has(provide (all-defined-out))
or(provide $ $$)
(you probably want the former).What happens to Example 2? Can you show me the output?
This is a minimal example of what you are trying to do. It seems to work fine for me.
Note that I have three files in the project directory:
pollen.rkt
,template.html.p
, andtest.html.pm
. In Pollen, the file extension is important. Not sure if the problem that you experienced is related to the fact that you name your filehtml.pp
.Hi @sorawee , thanks for your nice answer. I tried to copy your solution, it kind of works but is slightly different than yours. Any ideas what went wrong?
<test.html.pm>
<pollen.rkt>
<template.html.p>
Also, another problem is when I try to add your suggestion in <pollen.rkt> in the template for "Typography for Laywers"
with the following html.pm file
I get the following
Let me address your first comment first. That is not a Pollen issue. Different browser has different initial CSS style settings. I used Chrome when I took the screenshot above. If you use a different browser (e.g., Safari), that would explain the discrepancy.
FWIW, there are several CSS libraries that attempt to give a better default settings so that all browsers have the same appearance. For example:
So I recommend loading one of these in
template.html.p
(in the<head>
section) to make browsers appear in the same way.For your second comment: did you add
to your
template.html.p
?Yep this is my template.html.p
I believe the issue is that you didn't
(provide (all-defined-out))
inpollen.rkt
. If you don't want to provide everything that you define in that file, you can also just(provide $ $$)
to selectively provide the two tags that you created.Thanks @sorawee . It seems to solve half of the problem :)
The problem is that Typography for Lawyers (henceforth TfL) has a lot of black magic that you really don't want. In this case, the problem is caused by the automatic hyphenation, which attempts to hyphenate your LaTeX code because it doesn't know that your code is not a prose that should not be tampered with. One way to fix the problem is to add
mathjax
to the list of tags on this line inpollen-rkt.scrbl
to make the automatic hyphenation skips LaTeX code.But again, you really don't want to base your project on TfL. TfL is in fact a quite unconventional Pollen project, e.g., using literate programming instead of writing code as usual. You probably won't need any of these features.
Wow it works like magic. Thanks @sorawee ! I just found TfL template is quite beautiful and as I don't have HTML background, I won't be able to design things from scratch.