Kaynağa Gözat

Fix string encoding in perf2tex

jonathanvdc 8 yıl önce
ebeveyn
işleme
93d41356f1
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 3 2
      performance/perf2tex.py

+ 3 - 2
performance/perf2tex.py

@@ -11,7 +11,8 @@ LATEX_COLORS = [
     ('chartBlue', 0x4F81BD),
     ('chartRed', 0xC0504D),
     ('chartGreen', 0x9BBB59),
-    ('chartPurple', 0x9F4C7C)
+    ('chartPurple', 0x9F4C7C),
+    ('chartDarkYellow', 0xCCCC00)
 ]
 
 LATEX_HEADER = r"""\documentclass[12pt,a4paper,onecolumn,openright]{report}
@@ -33,7 +34,7 @@ def encode_latex_string(value):
     """Encodes the given string as a LaTeX string."""
     # I guess this is good enough for now. This may need to be
     # revisited if we encounter more complicated names.
-    return value.replace('_', '\\_')
+    return '{%s}' % value.replace('_', '\\_')
 
 def assemble_latex_chart(optimization_levels, color_defs, test_names, data):
     """Assembles a LaTeX chart from the given components."""