Skip to content

Commit

Permalink
Update pre-build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
victorliu5296 committed Oct 19, 2024
1 parent 30b0e59 commit f362ca2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ replace_delimiters() {
sub process_math {
my ($content) = @_;
# Escape asterisks
$content =~ s/\*/\\\*/g;
# Escape double backslashes
$content =~ s/\\\\/\\\\\\\\/g;
Expand Down Expand Up @@ -68,7 +71,7 @@ replace_delimiters() {
# Process math environments: \( ... \), \[ ... \], $ ... $, and $$ ... $$
# This version allows for any amount of whitespace, including newlines, between delimiters
s/(\\\(|\\\[|\$\$?)\s*(.*?)\s*(\\\)|\\\]|\$\$?)/
s/(\\\(|\\\[|\$|\$\$?)\s*(.*?)\s*(\\\)|\\\]|\$|\$\$?)/
my ($open, $content, $close) = ($1, $2, $3);
$open . process_math($content) . $close;
/gsex;
Expand Down

0 comments on commit f362ca2

Please sign in to comment.