[GH-ISSUE #899] Fixing inject_crossrefs.lua #4239

Closed
opened 2026-04-19 12:14:03 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @profvjreddi on GitHub (Jul 22, 2025).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/899

Originally assigned to: @hzeljko on GitHub.

I have been working on using the margin-connection callout, which works great based on what you did — where we manually insert the callout.

However, I wanted to automatically generate them from a JSON file, like we did for quizzes. So, I wrote an inject_crossrefs.lua script to accomplish this. It reads data from the data/ directory and then attempts to inject the references. Don't worry about how I generate them, there is a file in scripts/cross_refs.py.

One issue is that the first callout shows up red for some reason.

Image

From the second callout onward, it works perfectly (ignore the ??? missing — it uses \ref{...} and does build correctly. It’s not building because I disabled and commented out the other files).

Image

The issue seems to be related to how much information I’m including in the \marginpar you defined in margin-connection.

Second issue is when I use data/cross_refs.json, it fails. But when I use the same file without the explanation JSON field, it works fine. There are two files in data/ that you can take a look at.


Can you please debug this issue? Maybe we can't put explanations :(

Originally created by @profvjreddi on GitHub (Jul 22, 2025). Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/899 Originally assigned to: @hzeljko on GitHub. I have been working on using the `margin-connection` callout, which works great based on what you did — where we manually insert the callout. However, I wanted to automatically generate them from a JSON file, like we did for quizzes. So, I wrote an `inject_crossrefs.lua` script to accomplish this. It reads data from the data/ directory and then attempts to inject the references. Don't worry about how I generate them, there is a file in `scripts/cross_refs.py.` **One issue** is that the first callout shows up red for some reason. <img width="1796" height="1578" alt="Image" src="https://github.com/user-attachments/assets/c21770e4-9d49-474a-b3ac-f49fcd273279" /> --- From the second callout onward, it works perfectly (ignore the ??? missing — it uses \ref{...} and does build correctly. It’s not building because I disabled and commented out the other files). <img width="1834" height="686" alt="Image" src="https://github.com/user-attachments/assets/fe307bbe-d0ac-468d-9bfc-e2a9a301a64e" /> The issue seems to be related to how much information I’m including in the `\marginpar` you defined in `margin-connection`. **Second issue** is when I use `data/cross_refs.json`, it fails. But when I use the same file without the explanation JSON field, it works fine. There are two files in data/ that you can take a look at. --- Can you please debug this issue? Maybe we can't put explanations :(
GiteaMirror added the type: bugarea: tools labels 2026-04-19 12:14:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#4239