latex

仅逗oier们一笑(不定期更新中)(update.2019年12月8日)

守給你的承諾、 提交于 2021-02-20 13:00:21
CCF的正确解释: //部分来自: 朝阳的二愣子的CSDN博客 、 ydclyq 的博客 、 拱垲的博客 、 Randolph's Blog 、 编译下列程序,会有意想不到的惊喜哦(注意打开声音): #include<bits/stdc++.h> #include <windows.h> #define qdo 262 #define qre 294 #define qmi 330 #define qfa 349 #define qso 392 #define qla 440 #define qsi 494 #define doo 523 #define re 578 #define mi 659 #define fa 698 #define so 784 #define la 880 #define si 988 #define do1 1046 #define re1 1175 #define mi1 1318 #define fa1 1480 #define so1 1568 #define la1 1760 #define si1 1976 #define sqdo 277 #define sqre 311 #define sqfa 370 #define sqso 415 #define sqla 466 #define sdo 554 #define sre 622

Rendering coefficients as fractions in sympy latex

≯℡__Kan透↙ 提交于 2021-02-19 09:01:31
问题 I would like to render a fraction multiplied by an integral. I tried: from sympy import * x, h = symbols("x h") (2/h) * Integral(x**2, (x, 0, 1)) The generated latex is: '\\frac{2 \\int\\limits_{0}^{h} x^{2}\\, dx}{h}' which looks wretched: Is it possible to keep the fraction as a coefficient, like so? This can be reproduced easily using sympy live. Thanks for any help. 回答1: You can, as @Stelios pointed out, use an unevaluated Mul to make the expression appear as you want it. To avoid

Converting LaTeX tables into R dataframes/matrices

坚强是说给别人听的谎言 提交于 2021-02-19 06:27:05
问题 The process of converting R outputs into LaTeX is well documented. However, the opposite not so much. The problem: I have a long LaTeX file and would like to import the tables it into R (say, convert them as data frames). Question: is there an elegant/efficient way of doing this task without having to do it manually? Note that there are percent signs (%) commenting the rows in the tables. For example, \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{natbib} \title{Processing

Video embedding inside beamer without Adobe Flash Player

白昼怎懂夜的黑 提交于 2021-02-19 01:32:05
问题 Good morning. I need to embed a video inside a beamer presentation that is visible in Adobe Reader without using Adobe Flash Player. As a minimal example, I used this snippet of code and it doesn't work. it only shows a black box: \documentclass{beamer} \mode<presentation> {\usetheme{Madrid}} \usepackage{graphicx} \usepackage{movie15} \usepackage{hyperref} \begin{document} \begin{frame} \begin{figure}[ht] \includemovie[poster,text={\includegraphics[width=8cm, height=6cm] {candp.png}},autoplay

Does rmarkdown allow captions and references for code chunks?

…衆ロ難τιáo~ 提交于 2021-02-18 11:09:40
问题 Is there a trick for captioning and referencing a chuck of code in rmarkdown (not the result of running the code)? For example, how do I reference this block of code: ```{r blah} blah <- "blah" ``` I know that I can use \@ref(fig:theFig) or \@ref(tab:theTable) to get at fig.cap or caption (with kable) but I don't see a way to caption and reference the code itself. 回答1: This would be a great feature. And I think it is not integrated yet. Here is an approach that works for PDF documents and

Latex macros in Jupyter (iPython) notebook not rendered by github

前提是你 提交于 2021-02-18 03:17:49
问题 I have a markdown cell in a Jupyter notebook (.ipynb) with the following content. $\newcommand{\paren}[1]{\left(#1\right)}$ $\paren{\beta^2}$ The file is in a Github repository. The LaTex macro application is not rendered by Github. Here is how it looks: The markdown cell, however, is rendered properly when I open is locally as a Jupyter notebook. Is there a way to make this work? Note that the file is in a private Github repo, so I can not use nbviewer. 来源: https://stackoverflow.com

Replace all accented characters by their LaTeX equivalent

隐身守侯 提交于 2021-02-17 15:24:17
问题 Given a Unicode string, I want to replace non-ASCII characters by LaTeX code producing them (for example, having é become \'e , and œ become \oe ). I'm incorporating this into a Python code. This should rely on a translation table, and I have come up with the following code, which is simple and seems to work nicely: accents = [ [ u"à", "\\`a"], [ u"é", "\\'e"] ] translation_table = dict([(ord(k), unicode(v)) for k, v in accents]) print u"été à l'eau".translate(translation_table) But, writing

How do I write a Latex formula in the legend of a plot using Matplotlib inside a .py file?

匆匆过客 提交于 2021-02-17 08:34:08
问题 I am writing a script in Python (.py file) and I am using Matplotlib to plot an array. I want to add a legend with a formula to the plot, but I haven't been able to do it. I have done this before in IPython or the terminal. In this case, writing something like this: legend(ur'$The_formula$') worked perfectly. However, this doesn't work when I call my .py script from the terminal/IPython. 回答1: The easiest way is to assign the label when you plot the data, e.g.: import matplotlib.pyplot as plt

Sweave in Rstudio — no plots showing in pdf

大兔子大兔子 提交于 2021-02-17 06:47:08
问题 Sweave/Latex newbie here. I have no problems generating regular functions outputs, but the plots don't show up. Here's a basic example: \documentclass{article} \begin{document} \SweaveOpts{concordance=TRUE} <<chunk1>>= print("Hello World") boxplot(rnorm(100)) @ \end{document} And the corresponding .tex output: \documentclass{article} \usepackage{Sweave} \begin{document} \input{test2-concordance} \begin{Schunk} \begin{Sinput} > print("Hello World") \end{Sinput} \begin{Soutput} [1] "Hello World

R Markdown Inline LaTeX Equations: `$` … `$` vs `\(` … `\)`

大城市里の小女人 提交于 2021-02-17 04:51:58
问题 --- title: "esc" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` A. An amount between $5 and $10. B. An amount between \$5 and \$10. C. An amount between \\$5 and \\$10. X. An equation $1 and 1 = 2$. Y. An equation \$1 and 1 = 2\$. Z. An equation \\$1 and 1 = 2\\$. I've got a similar, but different question here. Please comment if I need to add clarification to differences. I'm asking two different questions and hope that's obvious. Anyways, the