Questions tagged [subscript]

A subscript is a number, figure, symbol, or indicator that is smaller than the normal line of type and is set slightly below the baseline.

Subscripts are common in mathematical notation (generally indicating position, such as the index of a variable in a vector) and chemistry formulas (e.g. H2O).

Subscript and superscript (Wikipedia)

625 questions
511
votes
48 answers

Get nth character of a string in Swift

How can I get the nth character of a string? I tried bracket([]) accessor with no luck. var string = "Hello, world!" var firstChar = string[0] // Throws error ERROR: 'subscript' is unavailable: cannot subscript String with an Int, see the…
Mohsen
  • 64,437
  • 34
  • 159
  • 186
159
votes
16 answers

How can I keep consistent line height with superscript elements?

If I have a element in a multi-line paragraph, the line with the superscript on it has a larger line spacing above it than the other lines, regardless of what line-height I put on the paragraph. It doesn't mean I have lots of paragraphs, each…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
118
votes
6 answers

Subscripts in plots in R

I can't find a way how to write subscripts in the title or the subtitle in R. How can I write v 1,2 with 1,2 as subscripts? Thanks for your help!
jeffrey
  • 2,026
  • 5
  • 28
  • 42
113
votes
15 answers

Subscript and Superscript a String in Android

How can you print a string with a subscript or superscript? Can you do this without an external library? I want this to display in a TextView in Android.
Mohit Deshpande
  • 53,877
  • 76
  • 193
  • 251
96
votes
13 answers

Python slice first and last element in list

Is there a way to slice only the first and last item in a list? For example; If this is my list: >>> some_list ['1', 'B', '3', 'D', '5', 'F'] I want to do this (obviously [0,-1] is not valid syntax): >>> first_item, last_item = some_list[0,-1] >>>…
chown
  • 51,908
  • 16
  • 134
  • 170
78
votes
9 answers

'subscript' is unavailable: cannot subscript String with a CountableClosedRange, see the documentation comment for discussion

In Swift 4, I'm getting this error when I try to take a Substring of a String using subscript syntax. 'subscript' is unavailable: cannot subscript String with a CountableClosedRange, see the documentation comment for discussion For example: let…
Barry Jones
  • 1,329
  • 1
  • 9
  • 16
68
votes
3 answers

How to find the unicode of the subscript alphabet?

I've found some letters but i need to find others such as "c", "m", "p", is this even possible?
Mahmoud Elgohary
  • 789
  • 1
  • 8
  • 12
59
votes
4 answers

Producing subscripts in R markdown

I'm aware that R markdown can produce superscripts: text^superscript But is it possible to produce proper subscripts? Or is the only way to do so to cheat and use LaTeX math mode: $\sf{text_{subscript}}$ The intended final output is HTML.
sebastian-c
  • 15,057
  • 3
  • 47
  • 93
45
votes
8 answers

Set superscript and subscript in formatted text in wpf

How can I set some text as subscript/superscript in FormattedText in WPF?
Firoz
  • 7,224
  • 10
  • 41
  • 56
32
votes
5 answers

Swift Error: Ambiguous reference to member 'subscript'

I'm new to coding and picked up some open source project to get the idea. I'm getting the error: Ambiguous reference to member 'subscript' in the code below: let pictures = ( selectedRestaurant["Pictures"] as! NSArray ) // Error let picture = (…
jonasdickel
  • 321
  • 1
  • 3
  • 4
29
votes
3 answers

Ambiguous Use of Subscript in Swift

I keep getting an error of "ambiguous use of subscript," in my Swift code. I don't know what's causing this error. It just randomly popped up. Here's my code: if let path = NSBundle.mainBundle().pathForResource("MusicQuestions", ofType: "plist") { …
kriskendall99
  • 547
  • 1
  • 4
  • 14
27
votes
5 answers

Printing subscript in python

In Python 3.3, is there any way to make a part of text in a string subscript when printed? e.g. H₂ (H and then a subscript 2)
samrobbins
  • 451
  • 2
  • 6
  • 11
26
votes
9 answers

Android TextView's subscript being clipped off

The Android TextView clips off my text subscripts (see image below) even when I use android:layout_height="wrap_content" for the TextView. Is there a fix/work-around for this? P/S: Superscripts work fine Note: padding doesn't work. I tried even…
Tawani
  • 11,067
  • 20
  • 82
  • 106
17
votes
1 answer

R: invalid subscript type 'list'

I'm trying to use the indices of a sorted column of a dataset. I want to reorder the entire dataset by one sorted column. area.sort<-sort(xsample$area1, index.return=TRUE)[2] The output is a list, so I can't use it index through the whole…
Peter Becich
  • 989
  • 3
  • 14
  • 30
17
votes
1 answer

cannot subscript a value of type NSDictionary with an index of type string

var url: NSURL = NSURL(string: urlPath)! var request: NSMutableURLRequest = NSMutableURLRequest(URL: url) request.setValue("Basic \(base64EncodedCredential)", forHTTPHeaderField: "Authorization") request.HTTPMethod = "GET" var…
BorjaCin
  • 172
  • 1
  • 1
  • 7
1
2 3
41 42