Questions tagged [subscript]

111

votes
13

answer
90.1k

Views

HTML <sup /> tag affecting line height, how to make it consistent?

If I have a tag in a multi-line tag, the line with the superscript on it has a larger line spacing above it than the other lines, irregardless of what line-height I put on the . Edit for clarification: I don't mean i have lots of s, each which is on a single line. I have a single with enough cont...
Andrew Bullock
88

votes
13

answer
64.2k

Views

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
83

votes
6

answer
127k

Views

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
47

votes
13

answer
99.1k

Views

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] >>> print first_item '1' >>> print last_item 'F' Some th...
chown
36

votes
8

answer
20.8k

Views

Set superscript and subscript in formatted text in wpf

How can i set some text as subscript/superscript in FormattedText in wpf
Firoz
34

votes
3

answer
35k

Views

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
26

votes
5

answer
31.6k

Views

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 = ( pictures[zoomedPhotoIndex] as! NSDictionary ) let pictu...
jonasdickel
25

votes
3

answer
35.9k

Views

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?
24

votes
3

answer
25.5k

Views

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') { myQuestionsArray = NSArray(contentsOfFile: path) } v...
kriskendall99
20

votes
9

answer
6.7k

Views

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? alt text http://i38.tinypic.com/qy8n7m.png P/S: Superscripts work fine Note: padding doesn't work. I tried even adding a pa...
Tawani
13

votes
6

answer
2.9k

Views

How to create vertically aligned superscript and subscript in TextView

In the example of image below: How can I make both the superscript and subscript numbers to be aligned to produce a common scientific notation like below in TextView? If there is a way using Spannable or ReplacementSpan I would like to see a working example. Thank you.
Neoh
12

votes
4

answer
4k

Views

Generic in subscript for swift

I understand that with Swift you can specify a function-specific generic with this form: func someFunction(type: T.Type) {...} However, is it possible to do something similar with subscripts? Where you can specify a type within the brackets like so: subscript(type: T.Type) -> T {...} EDIT: Updated s...
Alex Zielenski
12

votes
1

answer
11.1k

Views

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 dataVal: NSData = NSURLConnection.sendSynchronousRequest(request, return...
BorjaCin
8

votes
3

answer
525

Views

is int[pointer-to-array] in the C++ - standard? [duplicate]

This question already has an answer here: With arrays, why is it the case that a[5] == 5[a]? 17 answers Why does x[y] == y[x] in c++? [duplicate] 3 answers As I have learned, one can write the following code: char *a = new char[50]; for (int i = 0; i < 50; ++i) { i[a] = '5'; } It compiles. It work...
styrofoam fly
8

votes
2

answer
721

Views

Python negative subscripting

I'm currently reading Robert Sebesta's Concepts of Programming Languages, 10th edition (2012). In the chapter about data types, it reads 'Ruby and Lua support negative subscripts, but Python does not'. I thought negatives subscripts could be done in Python using list_name[-i]. What are negative subs...
Felipe Cortez
8

votes
4

answer
17.2k

Views

UTF8 symbols for subscript letters

I have been looking online for the UTF8 character table. And all I could find for subscripts were numbers 1 to 9 and some of latin letters. I need to find S and B as subscripts for UTF8 Thanks for the help. here is the link for a UTF8 character table: http://tlt.its.psu.edu/suggestions/internationa...
Don Code
7

votes
4

answer
25.3k

Views

Type Has No Subscript Members?

I get the error 'Type 'Ship' has no subscript members when I try to do: var coor = ship[index] I tried to do var coor = ship?[index] as? Coordinate But I get this error: 'Cannot use optional chaining on non-optional value of type 'Ship'' Here's my Ship class: import Foundation class Ship: NSObject,...
Mr_CryptoPrime
7

votes
2

answer
3.1k

Views

How to convert super- or subscript to normal text in C#

I'm writing a slug generator for making nice urls. I'd like to convert m² to m2, but in a generic way that does this for all superscript (or subscript), not just a simple replace statement. Any ideas?
Jorrit Salverda
7

votes
2

answer
11.7k

Views

How to include subscript in text for plot point labels

Hi I'm new to R so I apologise if this is a very basic question. I'm trying to add text to a plot at point 11 on the x axis and point 900 on the y axis that will read t0= -4.0280 with the 0 as subscript. Where t0
JJS
7

votes
4

answer
8k

Views

How to convert Int to String.CharacterView.Index

This is driving me nuts. In Swift 2.2, it makes it impossible to subscript String with Int. For example: let myString = 'Test string' let index = 0 let firstCharacter = myString[index] This will result with a compile error, saying 'subscript' is unavailable: cannot subscript String with an Int, see...
nekonari
6

votes
1

answer
100

Views

Why is the Swift compiler marking this as an error?

I have two ways of writing the same code, one of which seems to be disliked by the Swift compiler. Can you please explain why? Context: let guaranteedValue: String let cursorPositionFromEnd: Int Working code: let stringFromEndUntilCursorPosition = String(guaranteedValue.reversed()[0..
Fawkes
6

votes
1

answer
815

Views

Error while adding main title with subscript in gridExtra

I am trying to arrange a few plots generated by ggplot2using the gridExtra package. library(ggplot2) library(gridExtra) p1
Crops
6

votes
1

answer
2k

Views

About the array subscripting operator

Quoting from the C11 standard : Array subsripting (§ 6.5.2.1) The definition of the subscript operator [] is that E1[E2] is identical to (*((E1)+(E2))). I would like to know why are the brackets around E1 necessary (they were missing in the C89 standard), ie in which expression can (*(E1+(E2))) be...
md5
6

votes
3

answer
4.9k

Views

How to add subscript characters in paragraphs using Word Automation?

I’m working on a program in C# that uses Microsoft Word 14.0 Object Library to create a .doc file, add paragraphs to it and saves it. There is a small form with a button that does described actions (see the code below). This part has no problems. Problem: Current text in created word file will be...
user1762820
6

votes
3

answer
770

Views

Stack overflow when defining subscript on CKRecord in Swift

This question asks whether one can use subscripting with CKRecord in Swift. While I already knew how to do what the questioner wanted, every permutation of it gives me a stack overflow: subscript(key: String) -> CKRecordValue? { get { return objectForKey(key) as CKRecordValue? } set { setObject(newV...
Gregory Higley
6

votes
1

answer
699

Views

Using boost::shared_ptr with classes that overload the subscript operator ([])

I have a class that overloads the subscript operator: class SomeClass { public: int& operator[] (const int idx) { return someArray[idx]; } private: int someArray[10]; }; This of course allows me to access the array elements of the someArray member like so: SomeClass c; int x = c[0]; However, some...
6

votes
2

answer
24.7k

Views

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
6

votes
7

answer
8.7k

Views

Overloading the subscript operator “[ ]” in the l-value and r-value cases

I have overloaded [] operator in my class Interval to return minutes or seconds. But I am not sure how to assign values to minutes or second using [] operator. For example : I can use this statement cout
Searock
6

votes
3

answer
1.9k

Views

Overloading operator [] for a sparse vector

I'm trying to create a 'sparse' vector class in C++, like so: template class SparseVector { ... } Internally, it will be represented by an std::map (where V is the type of value stored). If an element is not present in the map, we will pretend that it is equal to the value Default from the template...
Thomas
6

votes
3

answer
1.7k

Views

Char array subscript warning

when I use char array subscript as in this example: int main(){ char pos=0; int array[100]={}; for(pos=0;pos
Mihalko
6

votes
1

answer
5.5k

Views

Matplotlib subscript

I know that we can produce a single subscript in matplotlib like $r_i will give me an r with 'i' as the subscript. But I want to generate a subscript with say 3 or 4 letters, like r_ijk should give me an r with 'ijk' as the subscript. When I do the above, I only get the first ('i') to be the subs...
ThePredator
5

votes
2

answer
2.2k

Views

Use a vector to index a matrix without linear index

G'day, I'm trying to find a way to use a vector of [x,y] points to index from a large matrix in MATLAB. Usually, I would convert the subscript points to the linear index of the matrix.(for eg. Use a vector as an index to a matrix) However, the matrix is 4-dimensional, and I want to take all of the e...
David_G
5

votes
1

answer
10.4k

Views

Run-time error '9': Subscript out of range - only when Excel VBE is closed

All, I am facing an error with a some VBA code in an Excel macro. Here’s the workflow I am attempting: I have a module that runs code to create a new worksheet, format it and add in a bunch of values within this same module, I determine a range of cells based on the last row populated (which will...
gg7aph
5

votes
2

answer
6k

Views

How to print subscripts/superscripts on a CLI?

I'm writing a piece of code which deals with math variables and indices, and I'd need to print subscripts and superscripts on a CLI, is there a (possibly cross-platform) way to do that? I'm working in vanilla C++. Note: I'd like this to be cross-platform, but since from the first answers this doesn'...
tunnuz
5

votes
6

answer
478

Views

Inquiry about class variable declarations in C++

I have a class to represent a 3D vector of floats: class Vector3D { public: float x, y, z; float * const data; Vector3D() : x(0.0), y(0.0), z(0.0), data(&x) {} } My question is: are x, y, and z going to be allocated sequentially in memory such that I can assign the address of x to data and later use...
milesleft
5

votes
1

answer
2k

Views

contentEditable superscript & subscript in Chrome

The following DHTML formatting commands each work fine on a div with contentEditable=true in IE, Firefox and Chrome: document.execCommand('superscript', false, null); document.execCommand('subscript', false, null); However, calling the command again to remove the formatting has no effect in Chrome....
Petrus Theron
5

votes
1

answer
15.8k

Views

Error in *tmp*[[j]] : subscript out of bounds

Apologies for long post! I'm new to R and have been working hard to improve my command of the language. I stumbled across this interesting project on modelling football results: http://www1.maths.leeds.ac.uk/~voss/projects/2010-sports/JamesGardner.pdf I keep running into problems when I run the cod...
Clatty Cake
5

votes
2

answer
1.3k

Views

Google sign in ambiguous reference to member 'subscript'

application:openURL:options: method of app delegate. The method should call the handleURL method of the GIDSignIn instance, which will properly handle the URL that your application receives at the end of the authentication process. Directly copied from firebase guide docs but still has errors. f...
Manish Ojha
5

votes
1

answer
999

Views

Setting subscript and superscript for specific character in the TextView?

Is there a way to set subscript and superscript for specific character in the TextView? I want to display a text that looks like this: So,I tried this code: TextView tv1 = ... ; String latex = '\u222E'; tv1.setText(Html.fromHtml(latex + '2002 f(x)dx')); But the result is this: You can see the supers...
hasanghaforian
5

votes
2

answer
17.1k

Views

Error in `*tmp*`[[k]] : subscript out of bounds in R

I wanted to ask why I get this error while initializing a list of for example vectors or some other type and how can I fix it? > l l[[1]][1]
hora