Inline Math, Subscript, Superscript

Good) $\sum_{i=0}^{i=20}{x^i}$

good1.png

Good) $\displaystyle\sum_{i=0}^{i=20}{x^i}$

good2.png

Bad) $\sum\limits_{i=0}^{i=20}{x^i}$

bad.png

Advertisements

7 Responses to “Inline Math, Subscript, Superscript”


  1. 1 Manuel Cornejo December 30, 2009 at 10:09 am

    Hi

    I am begining to learn MATLAB. MATLAB has a LATEX engine, but I so not know nothing about it.
    I have a problem. I need to place an annotation in a MATLAB figure that use superscript, with more than one character, but not a fixed string, but instead a string variable, with a contents that changes over different runs. I have use {} curly braces, to enclose the variable name, but the only thin I’ve got is the variable label name as a superscript not its contents.
    Can you help me in any way?

    Sincerely

    • 2 Jie December 30, 2009 at 10:59 am

      I guess that is a MATLAB question rather than a LATEX question. In matlab, you first make the string, and then put the string to a place where you want to display. For example, if you want to display “run 123” as the title of the figure, where 123 is your current iteration count, then you can do

      title_str = [‘run ‘ num2str(iter)];
      title(title_str);

      Here, the content of the variable “iter” is 123, the function “num2str” converts a number to a string, and we concatenate two strings: “run ” and “123”. Then we use the “title” command to display the title on the figure.

      • 3 Manuel Cornejo December 30, 2009 at 1:06 pm

        Hi Jie

        Thank you very much for your prompt answer.What you say in your email I’ve already tried before your email and it works. The problem is not what you say, Change ‘run ‘ by ‘2^ ‘instead and try to elevate to 123 and then to 124…and so on, with a same line in the program. The problem is superscript. By the way, if you try the way you show in ypur email you will get 2 elevated to 1 and 23 will be droped from the superscript.

        Thank you very much.

      • 4 Jie January 8, 2010 at 12:52 pm

        Sorry that I did not have access to matlab in the past week. Now that I try something like:

        iter = 123;
        title_str = [‘2^{‘ num2str(iter) ‘}’];
        title(title_str);

        I am sure that title_str will become ‘2^{123}’, and the part ‘123’ will show exactly as a superscript. Perhaps you just missed the curly braces.

  2. 5 Manuel Cornejo January 12, 2010 at 10:39 pm

    Hi Jie

    Thank you very much for your help, but.. no way. I have tried in MATLAB many more possibilities according with your clue but nothing. I suppose it will be a built-in limitation on MATLAB Latex engine. I am sending you two attachments by personal email because it is not possible do this in the forum. Frist is a matlab editor screen capture, not recognizing even the function num2str, because o de apostrophes. Second file consists of two code lines that resembles your proposed solution.

    Thank you very much

  3. 6 Robert August 20, 2012 at 12:00 pm

    Hi man, I can`t get good look for this equation, $R^{2}$:

    $$\displaystyle
    z=\sqrt{R^{2}+\left(wL-\frac{1}{LC}\right)^{2}}$$

    • 7 Jie August 20, 2012 at 2:34 pm

      You don’t need to use \displaystyle in a displayed environment (that is, $$ … $$). The command only helps in an inline environment (that is, $ … $). Besides, I don’t see anything wrong with the look. Which part you do not like?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Categories

Blog Stats

  • 244,135 hits

%d bloggers like this: