latex

Interference between string formatting and LaTeX functions

南楼画角 提交于 2019-12-12 03:49:41
问题 Say I made a fit and obtained the parameter a (in reality there are more). Now I want to have a little piece of text inside a plot where the parameter and its unit is stated. The idea was to use the code: import matplotlib.pyplot as plt a=19389.2323 plt.figure() plt.text(0.5,0.5, r'${0:.1f}\frac{kJ}{mol}$'.format(a/1000)) However the last line causes a KeyError: 'kJ' because the curly brackets are being interpreted by the .format() instead of being interpreted as being part of the LaTeX

Backslashes are auto-removed while inserting LaTeX formulas to MySQL with PHP

て烟熏妆下的殇ゞ 提交于 2019-12-12 03:13:49
问题 I'm writing simple math question generating program in PHP. There are users who add questions, and users who can examine themselves. For the questions with math formulas I am using LaTeX. But after inserting formula to MySQL database backslashes are removed and formula becomes unusable. Here is example of LaTeX formula: \[ \mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\ \frac{

Output of fa2latex command from psych causing LaTeX error in pandoc

别说谁变了你拦得住时间么 提交于 2019-12-12 02:26:58
问题 I am writing a report using knitr in RStudio. Also using the psych package for factor analysis: ```{r, results='asis'} library(psych) data(Thurstone) fa.Thurstone<-fa(Thurstone) fa2latex(fa.Thurstone) ``` When I run this code chunk it causes an error: ! LaTeX Error: Unknown float option `d'. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.124 \begin{scriptsize} \begin{table}[htdp] pandoc: Error producing PDF from TeX source Error: pandoc

LaTeX to png conversion

拥有回忆 提交于 2019-12-12 02:05:39
问题 Following this previous question, I thought I could first convert the output of stargazer (latex code for summary statistics table) to png, using R commands (like dvi, dvips, ...) inside an R chunk or, in the worst case, invoking system commands (see this post), and then import the produced png into my Rmd file, using a command like ![alt text](summary_lm.png) Do you think this is possible? Could you show me how to do it, because I had no luck? 回答1: You can use the object tag to embed a PDF

removing environments with sed

点点圈 提交于 2019-12-12 01:59:56
问题 I would like to parse a text like Lorem ipsum dolor \tag{sit} amet, \git{consetetur} sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut \tag{labore \git{et} dolore magna aliquyam erat, sed} diam voluptua. At vero eos et accusam et justo duo dolores et ea \tag{rebum.} into Lorem ipsum dolor sit amet, \git{consetetur} sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore \git{et} dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et

Formatting the columns of a table in LaTeX [closed]

谁说我不能喝 提交于 2019-12-12 01:57:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I am trying to use LaTeX for documentation. I am unable to format the table. Please refer the following snippet of code. \begin{table}[!htbp] \begin{center} \begin{tabular}{| m{3cm} | m{3cm} | m{3cm}| m{3cm} | m{3cm} |} \hline Software Project & a_a & b_b & c_b & d_b \\ \hline Organic & 2.4 & 1.05 & 2.5 & 0.38\\

Cannot get the table that I need in latex

六月ゝ 毕业季﹏ 提交于 2019-12-12 01:46:59
问题 I am having some problems with a table in latex. Basically the label "Conclusion" does not even appear in the table and the text in it is not how I wanted it and it is not all displayed. Does someone know why? \begin{tabular}{rr} \toprule \multicolumn{1}{c}{\textbf{Literature}} & \multicolumn{1}{c}{\textbf{Conclusion}} \\ \midrule Blume (1974: 638) & \multicolumn{1}{l}{"the weighted unbiased estimator is probably the safer to use" } \\ Fama (1996: 419) & \multicolumn{1}{l}{"The estimate of Et

LaTeX equations do not render in google Colaboratory when using matplotlib

让人想犯罪 __ 提交于 2019-12-12 00:49:48
问题 If I take the official example containing latex from the matplotlib website: from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True) import numpy as np import matplotlib.pyplot as plt # Example data t = np.arange(0.0, 1.0 + 0.01, 0.01) s = np.cos(4 * np.pi * t) + 2 plt.rc('text', usetex=True) plt.rc('font', family='serif') plt.plot(t, s) plt.xlabel(r'\textbf{time} (s)') plt.ylabel(r'\textit{voltage} (mV)',fontsize=16) plt.title(r"\TeX\

How to remove latex tags using regex?

大兔子大兔子 提交于 2019-12-12 00:29:47
问题 I have to remove the bugging unnecessary tags in a document like: {\sffamily FOOBARFOOOBAR FOOBAR FOO \bf{FOOBAR} FOOBAR } into FOOBARFOOOBAR FOOBAR FOO \bf{FOOBAR} FOOBAR I used to be able to do this with html tags like {\sffamily \d } replacing with \1 but i cannot make it work with tex tags.. Anyone any advices? 回答1: I can give you a regex for your example - you weren't far off with your initial attempt - but I'm not sure it'll help with your overall problem. Find: \{\\sffamily ((?:.*\r*\n

How to reference a label within a newcommand in LATEX?

邮差的信 提交于 2019-12-11 18:10:31
问题 I have created a newcommand \figc to create figures quickly for my document. However, I had trouble referencing it. The document is being compiled successfully but is being shown as Figure (??). \newcommand{\figc}[3]{ \begin{figure}[H] \centering \includegraphics[width={#3}]{figures/{#1}.jpg} \caption{{#2}} \label{fig:{#1}} \end{figure} fig:{#1}} ----> However, this part is displayed correctly in the PDF as fig:samplefig Here is a sample text to reference (Figure \ref{fig:samplefig}). \figc