summaryrefslogtreecommitdiff
path: root/lib/sbin/ThornUtils.pm
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-07-18 19:04:14 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-07-18 19:04:14 +0000
commit81e6ceac0f76f0e93f65f6ab9fa8b7158ad2128f (patch)
tree8683aad2a84aaf796cfe372327400b10ddcf59c8 /lib/sbin/ThornUtils.pm
parent67d7b09601e6c4de65b7dc8883bce917e5b44c96 (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.pm14
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: \"