Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
To accommodate non-Computer Modern LaTeX fonts.
Updated LaTeX super/subscript translation per "LaTeX 2ε
for Authors," http://www.latex-project.org/guides/usrguide.pdf,

  New feature 1995/06/01

  In LaTeX 2.09 textual superscripts such as footnote markers were produced
  by internally entering math mode and typesetting the number as a math
  superscript. This normally looked fine since the digits in math fonts
  are the same as those in text fonts when Computer Modern fonts are used.
  But when a different document font (such as Times) is selected, the
  results look rather strange. For this reason the command \textsuperscript
  has been introduced which typesets its argument in the current text font,
  in a superscript position and in the correct size.
  • Loading branch information
kleb committed Mar 7, 2009
1 parent 9715b8e commit f9a00ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/redcloth/formatters/latex.rb
Expand Up @@ -48,8 +48,8 @@ def latex_image_styles
end

# sub/superscripts
{ :sup => '\ensuremath{^\textrm{#1}}',
:sub => '\ensuremath{_\textrm{#1}}',
{ :sup => '\textsuperscript{#1}',
:sub => '\textsubscript{#1}',
}.each do |m, expr|
define_method(m) do |opts|
expr.sub('#1', opts[:text])
Expand Down
3 changes: 2 additions & 1 deletion test/textism.yml
Expand Up @@ -144,10 +144,11 @@ latex: "\\underline{a phrase}\n\n"
---
in: ^a phrase^
html: <p><sup>a phrase</sup></p>
latex: "\\ensuremath{^\\textrm{a phrase}}\n\n"
latex: "\\textsuperscript{a phrase}\n\n"
---
in: ~a phrase~
html: <p><sub>a phrase</sub></p>
latex: "\\textsubscript{a phrase}\n\n"
---
in: %(myclass)SPAN%
html: <p><span class="myclass"><span class="caps">SPAN</span></span></p>
Expand Down

0 comments on commit f9a00ed

Please sign in to comment.