subscript

Producing subscripts in R markdown

a 夏天 提交于 2019-11-29 22:51:24
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. A5C1D2H2I1M1N2O1R2T1 Since you mention Pandoc in your comments, maybe it's not cheating to depend on Pandoc's extensions for subscript and superscript . From here , we can create a minimal example Rmd file: Testing Subscript and Superscript ======================================================== This is an R Markdown document. Pandoc includes numerous

Matplotlib 2.0 subscript outside of baseline when super and subscript are both used

萝らか妹 提交于 2019-11-29 18:10:48
With matplotlib 2.0 I have been having strange behavior when I use both subscript and superscript on the same character. When they are combined, the subscript goes down entirely below the baseline. This didn't happen with MPL 1.5. Here is a complete example: import matplotlib as mpl import matplotlib.pyplot as plt mpl.rc("font", family="Times New Roman",weight='normal') plt.rcParams.update({'mathtext.default': 'regular' }) plt.plot(1,1, label='$A_x^{b}$') plt.plot(2,2,label='$A_x$') plt.plot(3,3,label='$A^b$') plt.plot(4,4,label='$A_x^{*}$') plt.plot(5,5,label='$A^*$') plt.legend(fontsize='xx

Android TextView's subscript being clipped off

夙愿已清 提交于 2019-11-29 00:42:49
问题 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 adding a padding of 50dip but it did not help. I can use an absolute height such as 50dip but that messes everything up when I need text to wrap around. Sample Code: mtTextView.setText(Html.fromHtml("HC0<sub>3</sub>")); 回答1: This solution worked for me

Python: subscript a module

旧巷老猫 提交于 2019-11-28 14:15:16
I was trying to do something like this: module.py def __getitem__(item): return str(item) + 'Python' test.py import module print module['Monty'] I expected "MontyPython" to be printed. However, this doesn't work: TypeError: 'module' object is not subscriptable Is it possible to create a subscriptable module in pure Python (i.e. without modifying its source code, monkey-patching, etc.)? >>> class ModModule(object): def __init__(self, globals): self.__dict__ = globals import sys sys.modules[self.__name__] = self def __getitem__(self, name): return self.__dict__[name] >>> m = ModModule({'__name__

Ambiguous Use of Subscript in Swift

[亡魂溺海] 提交于 2019-11-28 10:43:20
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) } var count:Int = 1 let currentQuestionDict = myQuestionsArray!.objectAtIndex(count) if let button1Title = currentQuestionDict["choice1"] as? String { button1.setTitle("\(button1Title)", forState: UIControlState.Normal) } if let button2Title = currentQuestionDict["choice2"] as? String { button2

Subscript indices must either be real positive integers or logicals using min

陌路散爱 提交于 2019-11-28 10:22:02
问题 for control=1:7 name=strcat('tau: ', num2str(TD(control)),' PLD: ', num2str(PLD(control))); fprintf('Control: %i/7\n', control) Maps(control) = struct('GradOFF', [], 'GradON', []); for lin=1:size(data(subject).perf_w_off,1) fprintf('Lin: %i/64\n', lin); for col=1:size(data(subject).perf_w_off,2) [x1, fval, exitflag, output] = fminunc(...) Maps(control).GradOFF(lin,col) = abs(x1(2)); [x2, fval, exitflag, output] = fminunc(...) Maps(control).GradON(lin,col) = abs(x2(2)); end end min1 = min(min

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

喜你入骨 提交于 2019-11-28 07:46:32
问题 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 <- list() > l[[1]][1] <- 1 Error in `*tmp*`[[1]] : subscript out of bounds This is the whole code I need, in fact I want a list of vectors like this: mcorrelation <- list() for(k in 1:7){ for (ind in 1:7){ mcorrelation[[k]][ind] <- co$estimate } } Should I initialize the whole list in advance or is there any other way for not getting this error? 回答1: Since l does

How to create vertically aligned superscript and subscript in TextView

橙三吉。 提交于 2019-11-28 06:57:32
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. You might want to try something like this. It's basicall a ReplacementSpan that takes the text it's applied on, separates it into two parts, and draws them on the canvas. The size factor and y translation are somewhat hand-picked. I hope it's useful (or at least that you or someone else can build on it). public class

Python slice first and last element in list

醉酒当歌 提交于 2019-11-28 05:11:43
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 things I have tried: In [3]: some_list[::-1] Out[3]: ['F', '5', 'D', '3', 'B', '1'] In [4]: some_list[-1:1:-1] Out[4]: ['F', '5', 'D', '3'] In [5]: some_list[0:-1:-1] Out[5]: [] ... One way: some_list[::len(some_list)-1] A better way (Doesn't use slicing, but is easier to read): [some_list[0], some

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

匆匆过客 提交于 2019-11-28 02:51:18
If I have a <sup> tag in a multi-line <p> 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 <p> . Edit for clarification : I don't mean i have lots of <p> s, each which is on a single line. I have a single <p> with enough content in it to cause wrapping onto multiple lines. Somewhere (anywhere) in the text there may be a <sup> or <sub> . This affects the line height for that line by adding extra spacing above/below. If I set a larger line-height on the <p> this makes no difference to the problem. The