在 mathjax 中正确显示摄氏度、开尔文或华氏度

问题描述 投票:0回答:1

我试图在使用

mathjaxr
时正确显示度数符号。也就是说,我希望它与表示度数(温度)的 F、C 或 K 相邻。根据 mathjax 支持的命令,
\\degree
命令应该生成正确的符号。
\\circ
命令不会执行我想要的操作,除非有办法强制它与温标(F、C 或 K)相邻。有没有办法让它工作,使度数符号与温标相邻?

library(shiny)
library(mathjaxr)

ui <- fluidPage(
        title = 'MathJax Examples',
        uiOutput('ex3'))

server <- function(input, output, session){
                   output$ex3 <- renderUI({
                   withMathJax(
                               helpText(        
                                        "$$3^{\\circ}F$$"      
    
                                        # "$$3\\degree F$$"
  ))    
})}

shinyApp(ui = ui, server = server)
r shiny latex mathjax
1个回答
0
投票

查看 TeX Stack Exchange 的一些帖子(此处此处)建议使用一个或多个负空格

我用

helpText(txt)
替换了代码中的文字字符串,以便我可以更轻松地进行实验

txt <- "$$3 {}^\\circ \\! F$$"
shinyApp(ui = ui, server = server)

给予

使用双负空格 (

\\!\\!
) 给出

看起来有点拥挤。

在数字后面和度数符号 (txt <- "$$3 \\, {}^\\circ \\!F$$") 之前添加

positive
薄空格也不是完美的:

变得非常着迷,

txt <- "$$3  {}^\\circ \\kern{-5mu} F$$"
对我来说看起来很不错:

© www.soinside.com 2019 - 2024. All rights reserved.