|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
New line not working for latex math mode?Hi,
Maybe I'm doing something wrong, but I cannot make the latex newline to work. *Only* the *first* label of all these: set term epslatex standalone color size 9cm,9cm set output "test.tex" set label "a \n b" at 0,90 set label 'a \\ b' at 0,70 set label "a \\\\ b" at 0,60 set label '$a \\ b$' at 0,50 set label "$a \\\\ b$" at 0,40 set label '$\displaystyle a \\ b$' at 0,30 set label "$\\displaystyle a \\\\ b$" at 0,20 f(x) = x**2 plot f(x) unset output will produce two lines of text, and whenever I'll try to use \n in math mode like set label "$a \n b$" pdflatex will give me an error Is all these normal? How can I introduce a new line in math mode? I'm using gnuplot 4.2.5 Miguel ------------------------------------------------------------------------------ _______________________________________________ gnuplot-beta mailing list gnuplot-beta@... https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
|
Re: New line not working for latex math mode?On Sun, Jun 28, 2009 at 00:12, Miguel Rubio Roy wrote:
> Hi, > > Maybe I'm doing something wrong, but I cannot make the latex newline to > work. > > *Only* the *first* label of all these: > > set term epslatex standalone color size 9cm,9cm > set output "test.tex" > set label "a \n b" at 0,90 > set label 'a \\ b' at 0,70 > set label "a \\\\ b" at 0,60 > set label '$a \\ b$' at 0,50 > set label "$a \\\\ b$" at 0,40 > set label '$\displaystyle a \\ b$' at 0,30 > set label "$\\displaystyle a \\\\ b$" at 0,20 > f(x) = x**2 > plot f(x) > unset output > > will produce two lines of text, and whenever I'll try to use \n in math mode > like > set label "$a \n b$" > > pdflatex will give me an error You may not have (two or more subsequent) line breaks inside equations in TeX. > Is all these normal? I would say yes (though I didn't try anything out). > How can I introduce a new line in math mode? If it was plain TeX it would be something like '$\displaystyle{\matrix{a \cr b}}$' but I think that LaTeX has \matrix redefined, so you need to check (I have not been using LaTeX for ages), the syntax might be slightly different. Another option would be to use '$a$ \\ $b$' Again - I didn't check it, but just to get you the idea: you need to split the math expressions into two and make a break *outside* of equations. TeX cannot make a line break with "\\" inside equation. But this is hardly related to gnuplot. Gnuplot will just output the label text unaltered to LaTeX document. You need to use the strengths and limitations of TeX/LaTeX when typesetting. It's best if you try to figure out how to achieve the desired effect in usual LaTeX document first and then just add the needed escape characters to generate the label inside gnuplot. Mojca ------------------------------------------------------------------------------ _______________________________________________ gnuplot-beta mailing list gnuplot-beta@... https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
|
Re: New line not working for latex math mode?> You may not have (two or more subsequent) line breaks inside equations in TeX.
I've only tried one line break, not two and not subsequent: >> set label "a \n b" at 0,90 >> set label 'a \\ b' at 0,70 >> set label "a \\\\ b" at 0,60 and anyway, I'd say these commands do not generate equations. >> How can I introduce a new line in math mode? > > If it was plain TeX it would be something like > '$\displaystyle{\matrix{a \cr b}}$' > but I think that LaTeX has \matrix redefined, so you need to check (I > have not been using LaTeX for ages), the syntax might be slightly > different. I haven't tried something like that but, I guess I would have to replace \cr with something like \\ which is not working, anyway. > Another option would be to use > '$a$ \\ $b$' > Again - I didn't check it, but just to get you the idea: you need to > split the math expressions into two and make a break *outside* of > equations. TeX cannot make a line break with "\\" inside equation. Some of my attempts weren't equations, and they weren't working, anyway: >> set label "a \n b" at 0,90 >> set label 'a \\ b' at 0,70 >> set label "a \\\\ b" at 0,60 > But this is hardly related to gnuplot. Gnuplot will just output the > label text unaltered to LaTeX document. You need to use the strengths > and limitations of TeX/LaTeX when typesetting. It's best if you try to > figure out how to achieve the desired effect in usual LaTeX document > first and then just add the needed escape characters to generate the > label inside gnuplot. I agree. Compiling the following with pdflatex works fine (places "a" and "b" in different lines): \documentclass[english]{article} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{babel} \begin{document} a \\ b \end{document} Thanks Miguel ------------------------------------------------------------------------------ _______________________________________________ gnuplot-beta mailing list gnuplot-beta@... https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
|
Re: New line not working for latex math mode?I'm sorry,
I messed up a bit ... (too late hour). You need to try what works inside \hbox{...}, not only equation is a box. Gnuplot puts everything inside something equivalent to \hbox. To start with, the following should work '\vbox{\hbox{a}\hbox{b}}' but I'm sure that there must be some more LaTeX-ish way to do the same. Still you probably cannot avoid the need to create either \vbox or multiline equation. Any automatic conversions would do more harm than good. The only solution to this would be not putting the contents to \hbox in the first place, though that might bring other problems. Mojca On Sun, Jun 28, 2009 at 01:03, Miguel Rubio Roy wrote: >> You may not have (two or more subsequent) line breaks inside equations in TeX. > > I've only tried one line break, not two and not subsequent: >>> set label "a \n b" at 0,90 >>> set label 'a \\ b' at 0,70 >>> set label "a \\\\ b" at 0,60 > > and anyway, I'd say these commands do not generate equations. > >>> How can I introduce a new line in math mode? >> >> If it was plain TeX it would be something like >> '$\displaystyle{\matrix{a \cr b}}$' >> but I think that LaTeX has \matrix redefined, so you need to check (I >> have not been using LaTeX for ages), the syntax might be slightly >> different. > > I haven't tried something like that but, I guess I would have to > replace \cr with something like \\ which is not working, anyway. > >> Another option would be to use >> '$a$ \\ $b$' >> Again - I didn't check it, but just to get you the idea: you need to >> split the math expressions into two and make a break *outside* of >> equations. TeX cannot make a line break with "\\" inside equation. > > Some of my attempts weren't equations, and they weren't working, anyway: >>> set label "a \n b" at 0,90 >>> set label 'a \\ b' at 0,70 >>> set label "a \\\\ b" at 0,60 > >> But this is hardly related to gnuplot. Gnuplot will just output the >> label text unaltered to LaTeX document. You need to use the strengths >> and limitations of TeX/LaTeX when typesetting. It's best if you try to >> figure out how to achieve the desired effect in usual LaTeX document >> first and then just add the needed escape characters to generate the >> label inside gnuplot. > > I agree. Compiling the following with pdflatex works fine (places "a" > and "b" in different lines): > > \documentclass[english]{article} > \usepackage[T1]{fontenc} > \usepackage[latin9]{inputenc} > \usepackage{babel} > \begin{document} > a \\ b > \end{document} > > > Thanks > > Miguel > ------------------------------------------------------------------------------ _______________________________________________ gnuplot-beta mailing list gnuplot-beta@... https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
|
|
Re: New line not working for latex math mode?OK. Solved.
I didn't read the documentation properly: The epslatex driver offers a special way of controlling text positioning: (a) If any text string begins with ’{’, you also need to include a ’}’ at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. (b) If the text string begins with ’[’, you need to continue it with: a position specification (up to two out of t,b,l,r,c), ’]{’, the text itself, and finally, ’}’. The text itself may be anything LaTeX can typeset as an LR-box. \rule{}{}’s may help for best positioning. See also the documentation for the pslatex (p. 181) terminal driver. To create multiline labels, use \shortstack, for example set ylabel ’[r]{\shortstack{first line \\ second line}}’ So, this does work: set label '\shortstack{a \\ b}' I still don't know if there's any way of putting an eqnarray environment (I guess this is the only way of writing multiline equations) into a \makebox (where the epslatex terminal outputs labels). Sorry for the confusion! Miguel 2009/6/27 Mojca Miklavec <mojca.miklavec.lists@...>: > I'm sorry, > > I messed up a bit ... (too late hour). > > You need to try what works inside \hbox{...}, not only equation is a > box. Gnuplot puts everything inside something equivalent to \hbox. > > To start with, the following should work > '\vbox{\hbox{a}\hbox{b}}' > but I'm sure that there must be some more LaTeX-ish way to do the > same. Still you probably cannot avoid the need to create either \vbox > or multiline equation. > > Any automatic conversions would do more harm than good. The only > solution to this would be not putting the contents to \hbox in the > first place, though that might bring other problems. > > Mojca > > On Sun, Jun 28, 2009 at 01:03, Miguel Rubio Roy wrote: >>> You may not have (two or more subsequent) line breaks inside equations in TeX. >> >> I've only tried one line break, not two and not subsequent: >>>> set label "a \n b" at 0,90 >>>> set label 'a \\ b' at 0,70 >>>> set label "a \\\\ b" at 0,60 >> >> and anyway, I'd say these commands do not generate equations. >> >>>> How can I introduce a new line in math mode? >>> >>> If it was plain TeX it would be something like >>> '$\displaystyle{\matrix{a \cr b}}$' >>> but I think that LaTeX has \matrix redefined, so you need to check (I >>> have not been using LaTeX for ages), the syntax might be slightly >>> different. >> >> I haven't tried something like that but, I guess I would have to >> replace \cr with something like \\ which is not working, anyway. >> >>> Another option would be to use >>> '$a$ \\ $b$' >>> Again - I didn't check it, but just to get you the idea: you need to >>> split the math expressions into two and make a break *outside* of >>> equations. TeX cannot make a line break with "\\" inside equation. >> >> Some of my attempts weren't equations, and they weren't working, anyway: >>>> set label "a \n b" at 0,90 >>>> set label 'a \\ b' at 0,70 >>>> set label "a \\\\ b" at 0,60 >> >>> But this is hardly related to gnuplot. Gnuplot will just output the >>> label text unaltered to LaTeX document. You need to use the strengths >>> and limitations of TeX/LaTeX when typesetting. It's best if you try to >>> figure out how to achieve the desired effect in usual LaTeX document >>> first and then just add the needed escape characters to generate the >>> label inside gnuplot. >> >> I agree. Compiling the following with pdflatex works fine (places "a" >> and "b" in different lines): >> >> \documentclass[english]{article} >> \usepackage[T1]{fontenc} >> \usepackage[latin9]{inputenc} >> \usepackage{babel} >> \begin{document} >> a \\ b >> \end{document} >> >> >> Thanks >> >> Miguel >> > ------------------------------------------------------------------------------ _______________________________________________ gnuplot-beta mailing list gnuplot-beta@... https://lists.sourceforge.net/lists/listinfo/gnuplot-beta |
| Free embeddable forum powered by Nabble | Forum Help |