changeset 1199:9941b60412bd

7901392: LaTeX result formatter should escape #
author shade
date Thu, 16 Apr 2015 18:48:54 +0300
parents 1c90c38e04d5
children 073d00004c81
files jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java	Thu Apr 16 01:22:51 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/results/format/LaTeXResultFormat.java	Thu Apr 16 18:48:54 2015 +0300
@@ -120,13 +120,14 @@
 
         if (!singleUnit) {
             out.print("& ");
-            out.printf("\\texttt{%s}", res.getScoreUnit());
+            out.printf("\\texttt{%s}", escape(res.getScoreUnit()));
         }
         out.print(" \\\\\n");
     }
 
     private static String escape(String s) {
-        return s.replaceAll("_", "\\\\_");
+        return s.replaceAll("_", "\\\\_")
+                .replaceAll("#", "\\\\#");
     }
 
 }