diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-07-18 19:04:14 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-07-18 19:04:14 +0000 |
commit | 81e6ceac0f76f0e93f65f6ab9fa8b7158ad2128f (patch) | |
tree | 8683aad2a84aaf796cfe372327400b10ddcf59c8 /lib/sbin/ThornUtils.pm | |
parent | 67d7b09601e6c4de65b7dc8883bce917e5b44c96 (diff) |
Escape "&" characters in latex.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3296 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/ThornUtils.pm')
-rw-r--r-- | lib/sbin/ThornUtils.pm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/sbin/ThornUtils.pm b/lib/sbin/ThornUtils.pm index 0235f489..8cf491b9 100644 --- a/lib/sbin/ThornUtils.pm +++ b/lib/sbin/ThornUtils.pm @@ -356,15 +356,18 @@ sub CleanForLatex { my $val = shift; - # escape \ - #$val =~ s/\\/\\\\/g; + # escape special characters + $val =~ s/\\/\{\\textbackslash\}/g; + $val =~ s/~/\{\\textasciitilde\}/g; + $val =~ s/</\{\\textless\}/g; + $val =~ s/>/\{\\textgreater\}/g; # at start of string, remove spaces before and after: " $val =~ s/^\s*?\"\s*?/\"/; - + # at end of string, remove spaces before and after: " $val =~ s/\s*?\"\s*?$/\"/; - + # escape _ $val =~ s/\_/\\\_/g; @@ -377,6 +380,9 @@ sub CleanForLatex # escape * $val =~ s/\*/\\\*/g; + # escape & + $val =~ s/\&/\\\&/g; + # UNescape " # latex gets very angry when it sees: \" |