fat_table 0.4.0 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,7 +91,7 @@ module FatTable
91
91
  else
92
92
  ''
93
93
  end
94
- result += "\\usepackage[pdftex,x11names]{xcolor}\n"
94
+ result += "\\usepackage[pdftex,table,x11names]{xcolor}\n"
95
95
  result
96
96
  end
97
97
 
@@ -113,12 +113,14 @@ module FatTable
113
113
  # default.
114
114
  def decorate_string(str, istruct)
115
115
  str = quote(str)
116
- result = ''
117
- result += '\\bfseries{}' if istruct.bold
118
- result += '\\itshape{}' if istruct.italic
119
- result += "\\color{#{istruct.color}}" if istruct.color &&
120
- istruct.color != 'none'
121
- result = "#{result}#{str}"
116
+ result = istruct.italic ? "\\itshape{#{str}}" : str
117
+ result = istruct.bold ? "\\bfseries{#{result}}" : result
118
+ if istruct.color && istruct.color != 'none'
119
+ result = "{\\textcolor{#{istruct.color}}{#{result}}}"
120
+ end
121
+ if istruct.bgcolor && istruct.bgcolor != 'none'
122
+ result = "\\cellcolor{#{istruct.bgcolor}}#{result}"
123
+ end
122
124
  unless istruct.alignment == format_at[:body][istruct._h].alignment
123
125
  ac = alignment_code(istruct.alignment)
124
126
  result = "\\multicolumn{1}{#{ac}}{#{result}}"