是否有Ansi上标和下标的转义序列? [英] Are there Ansi escape sequences for superscript and subscript?

查看:99
本文介绍了是否有Ansi上标和下标的转义序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩ANSI转义序列,例如

I'm playing around with ANSI escape sequences, e.g.

echo -e "\e[91mHello\e[m"

在Linux控制台上显示彩色文本。

on a Linux console to display colored text.

现在我尝试使用上标和下标像 a =b²这样的输出。

Now I try to use superscript and subscript output like a=b².

我读了此处此处关于:部分排队(下标)部分排队(上标),但我不确定确切的语法,甚至不确定哪个终端客户端可能支持此语法。

I read here and here about: Partial Line Down (subscript) and Partial Line Up (superscript) but I'm not sure about the exact syntax and even which terminal client might supports this.

对此有任何建议吗?

推荐答案

可能某些 commercial 产品支持该产品,但是您将遇到的任何终端仿真器都不支持该产品(除非有人修改了该产品)证明一个观点。)

Possibly some commercial product supports it, but it's not supported by any terminal emulator you'll encounter (unless someone modifies one just to prove a point).

标准描述了可能转义序列,但是有没有要求任何终端都支持任何给定序列。通常有支持(并假定)的序列,例如清除屏幕,但即使如此,并非所有终端都支持该功能。

The standard describes possible escape sequences, but there is no requirement that any given sequence is supported by any terminal. There are commonly supported (and assumed) sequences such as clearing the screen, but even for that, not all terminals have supported the feature.

原因是终端仿真器是通常与假定规则的行/列的应用程序(例如文本编辑器)一起使用,并且文本显示紧凑(不需要多余的空间,例如允许分行移动)。早在人们使用打字机的那一天,行距通常是1.5或2.0行,而页面上最多只能有33行,这在很久以前就改变了。

The reason is that terminal emulators are generally used with applications (such as text editors) which assume a regular set of rows/columns, and that the text is shown compactly (no extra space such as would be needed to allow for partial line movement. Back in the day when people used typewriters, it was common to have 1.5 or 2.0 line-spacing, and get no more than 33 lines on a page. That changed, long ago.

对下标/上标的需求并没有消失-Unicode提供了一组具有该表示形式的可用字符(请参见 上标和下标
范围:2070–209F

The need for subscripts/superscripts didn't go away — Unicode provides a usable set of characters with that representation (see Superscripts and Subscripts Range: 2070–209F)

进一步阅读:

  • Your New Royal Portable (1953).
  • Line Spacing - Butterick's Practical Typography
  • console_codes - Linux console escape and control sequences

这篇关于是否有Ansi上标和下标的转义序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆