tex

Tex markup, how to render it in Html with Python?

你。 提交于 2019-12-21 18:34:48
问题 The Tex markup support has been recently added to the following Stack Exchange sites: Mathematics Statistical Analysis Theoretical Computer Science These sites are using the client side Mathjax library to correctly format the submitted formulas to the user. Since this new feature was added, the StackExchange API returns the JSON question/answers text with formulas delimited by the $ char Tex Markup (here an example). StackPrinter, built on this API, merely prints the returned text full of $

R: creating vectors of latin/greek expression for plot titles, axis labels, or legends

偶尔善良 提交于 2019-12-20 21:58:35
问题 I would like to merge vectors of Latin and Greek text to generate plot titles, axis labels, legend entries, etc. I have provided a trivial example below. I cannot figure out how to render the Greek letters in their native form. I have tried various combinations of expression , parse , and apply to the paste command but I have not been able to vectorize the code that readily generates mixed Latin/Greek text for the case of a single expression (e.g., expression("A ("*alpha*")") is suitable in

Inconsistent tick labels font with matplotlib subplots

我的梦境 提交于 2019-12-20 04:09:45
问题 I'm making a grid of plots using matplotlib.pyplot.subplots , and I want the tick labels to be in LaTeX's sans-serif font, but when I do use subplots I always get at least one tick label rendered in matplotlib's default font. Here's a MWE: import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=1, ncols=1) x = [1,2,3,4,5] plt.plot(x) plt.rc('text', usetex=True) plt.rc('font', family='sans-serif') plt.show() If you comment out the fig, axes = plt.subplots line, the tick labels display

TeX in matplotlib on Mac OS X and TeX Live

别说谁变了你拦得住时间么 提交于 2019-12-19 05:19:16
问题 I have the following Hello World code to try out TeX rendering with matplotlib on my Mac. import matplotlib.pyplot as plt from matplotlib import rc rc('text', usetex=True) rc('font', family='serif') plt.text(2,2,r"Hello World!") plt.show() With that code, I'd get the following error: sh: latex: command not found Exception in Tkinter callback <... a long Traceback here ...> RuntimeError: LaTeX was not able to process the following string: 'lp' Here is the full report generated by LaTeX: I don

Greek letters in axes labels are not working

橙三吉。 提交于 2019-12-18 04:26:14
问题 I'm trying to use Greek letters in my xlabel of a plot. Every solution on the internet says that Matlab will accept tex. But instead of the delta-symbol my x-axis is simply labeled 'D' a = plot(0:40, y); hold on plot(delta_T,brechkraft, 'x') errorbar(delta_T, brechkraft,delta_b,'x'); title('2mm Oelschicht'); xlabel('\Delta'); ylabel('Brechkraft D in 1/cm'); annotation('textbox', [.2 .8 .1 .1],... 'String', {'Fit: f(x) = m*x + b', ['m = ', num2str(p(1)) ], ['b = ', num2str(p(2)) ]}); shg hold

R Markdown Math Equation Alignment

痴心易碎 提交于 2019-12-18 03:52:37
问题 I am writing a bunch of math equations in R Markdown inside Rstudio. And I want to align the content either to the left or center. However, seems like the align will align them to the right as default. I did some google and some of them told me to use a package called ragged2e , but it did not work when I added it in. I am wondering if this should be a latex question or rmarkdown question. 回答1: I'm not quite sure what you're going for here, but line breaks, \\ go at the end of tthe line, not

How can I use matplotlib's mathtext rendering outside of matplotlib in another tk widget?

自古美人都是妖i 提交于 2019-12-14 01:28:49
问题 I know that matplotlib can render math expressions readily with, for instance, txt=Text(x,y,r'$\frac{1}{2}') which would make the fraction 1 over 2 at x,y. However, instead of placing the text at x,y I would like to use the rendered string in a separate tk application (like an Entry or Combobox). How can I obtain the rendered string from matplotlib's mathtext and put it into my tk widget? Of course I would welcome other options that would render the latex strings into my tk widget without

knitr, lyx, mac, Korean

感情迁移 提交于 2019-12-13 02:06:58
问题 Dear Friends in the knitr community with lyx and Apple Mac Hello! I am using Apple Mac for Reproducible research of R. Currently, I enjoy knitr in lyx for writing some R scripts. The problem I have is related non-English characters, specially Korean in the knitr chunk. When I type any Korean Character in a Chunk for typing file name or some extra explanations in #, the pdf output of the file does not print Korean properly. No matter of choosing or not choosing the option "eval=FALSE", R in

Using placeholders (%d,%s) in plt.text (matplotlib.pyplot.text)

删除回忆录丶 提交于 2019-12-12 07:28:18
问题 I am facing an issue in assigning a numerical value to the annotated text (mean and standard deviation in this case) using plt.text command. Since I have six subplots, I want to automate this process instead of writing it one by one. The code snippet containing the problem is attached below: # var=dictionary containing output variables b=1 > for i in var: > > # Created Subplots for different vectors (includes labelling of axes) here # Mean[] is an array containing mean values for all the

Building Latex/Tex arguments in lua

安稳与你 提交于 2019-12-11 13:16:20
问题 I use lua to make some complex job to prepare arguments for macros in Tex/LaTex. Part I Here is a stupid minimal example : \newcommand{\test}{\luaexec{tex.print("11,12")}}% aim to create 11,12 \def\compare#1,#2.{\ifthenelse{#1<#2}{less}{more}} \string\compare11,12. : \compare11,12.\\ %answer is less \string\test : \test\\ % answer is 11,12 \string\compare : \compare\test. % generate an error The last line creates an error. Obviously, Tex did not detect the "," included in \test. How can I do