latex

References with text in LaTeX

北城以北 提交于 2019-12-31 10:18:52
问题 In LaTeX you can easily reference a section by using \label{} next to a section and then \ref{} to create the reference. However, the reference only includes the number of the section, or the page with \pageref{} . I would like to insert a reference containing the text of the section. Example: \section{My Section} \label{section:my} This is a reference to Section~\ref{section:my}. The output is the following: 1. My Section This is a reference to Section 1. I would like to have: This is a

Mathjax: how to deal with this strange behavior?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 07:00:49
问题 I am using the markdown editor and I have loaded Mathjax in all pages of my website. I have realized that this line of latex works well: $(u_1)$ However, this one does not work (basically latex does not work): $(u_1,u_2)$ In order to make this work, I have to write something like this: $(u\_1,u\_2)$ I have a similar problem here. This does not work: $$M=\left(\begin{array}{cc} a & b \\ c & d \\ \end{array}\right)$$ But this works: $$M=\left(\begin{array}{cc} a & b \\\\ c & d \\\\ \end{array}

Python converting '\' to '\\'

自作多情 提交于 2019-12-31 05:23:12
问题 I am writing a program to sort a list fo input strings (song names). Those songnames contains latex chars like $\lambda$, which i want to get sorted like 'lambda' instead, så i'm using a the ability to apply a function to each element during sort. like this: # -*- coding: UTF8 -*- def conv( inp ): if inp == '$\lambda$': return 'lambda' else: return inp mlist = [] mlist.append('martin') mlist.append('jenny') mlist.append('åse') mlist.append('$\lambda$') mlist.append('lambda') mlist.append('

Hook to time knitr chunks

天涯浪子 提交于 2019-12-30 18:05:11
问题 I would like to time knitr chunks and record how long it took to render them using comments in LaTeX output. I've tried the following hook: now = Sys.time() knit_hooks$set(timeit = function(before) { if (before) { now <<- Sys.time() } else { paste("%", sprintf("Chunk rendering time: %s seconds.\n", round(Sys.time() - now, digits = 3))) } }) And it does produce the correct comment with timing but the problem is that it's wrapped in kframe which results in ugly gaps in the LaTeX output: \begin

Convert LaTeX to dynamic Javascript function

牧云@^-^@ 提交于 2019-12-30 06:36:10
问题 I have a user input for an equation - this input generates LaTeX code using a separate API which I did not code (namely, Mathquill, not that it matters). My problem is best illustrated by an example: suppose the LaTeX code generated from the user input was this: x^2+3x-10sin\left(2x\right) How would I convert this (on the fly of course) into a JavaScript function which, hard-coded, would look like this: function(x) { return Math.pow(x, 2) + 3 * x - 10 * Math.sin(2 * x); } Are there any APIs

LaTeX 中插入数学公式

别来无恙 提交于 2019-12-30 04:40:13
一、常用的数学符号 1、小写希腊字母 \alpha \nu \beta \xi \gamma o \delta \pi \epsilon \rho \zeta \sigma \eta \tau \theta \upsilon \iota \phi \kappa \chi \lambda \psi \mu \omega 2、大写希腊字母 大写希腊字母只需要将小写希腊字母的第一个英文字母大写即可。但是需要注意的是,有些小写希腊字母的大写可以直接通过键盘输入,也就是说和英文大写是相同的。 \Gamma \Lambda \Sigma \Psi \Delta \Upsilon \Omega \Theta \Xi \Pi \Phi 3、运算符 对于加减除,对应键盘上便可打出来,但是对于乘法,键盘上没有这个符号,所以我们应该输入 \times 来显示一个 号。 普通字符在数学公式中含义一样,除了 # $ % & ~ _ ^ \ { } 若要在数学环境中表示这些符号# $ % & _ { },需要分别表示为\# \$ \% \& \_ \{ \},即在个字符前加上\。 二、简单格式 1、上下标 上标:$ f(x) = x^2 $ 或者 $ f(x) = {x}^{2} $ 均可表示 。 下标:$ f(x) = x_2 $ 或者 $ f(x) = {x}_{2} $ 均可表示 。 上下标可以级联:$

Bibliography as section in LaTeX / BibTeX

谁都会走 提交于 2019-12-30 01:54:10
问题 I'm writing a short document using sections rather than chapters as the top-level (documentclass report). However, \bibliographystyle{amsplain} \bibliography{general} causes the bibliography to be inserted as a chapter rather than a section. Is there any way to change this? 回答1: By default, the report document class uses \chapter as the bibliography heading level. In contrast, the article document class uses \section as the bibliography heading level. If you're not using \chapter anywhere in

How to order citations by appearance using BibTeX?

六月ゝ 毕业季﹏ 提交于 2019-12-29 10:11:32
问题 By default (using the plain style) BibTeX orders citations alphabetically. How to order the citations by order of appearance in the document? 回答1: There are three good answers to this question. Use the unsrt bibliography style, if you're happy with its formatting otherwise Use the makebst (link) tool to design your own bibliography style And my personal recommendation: Use the biblatex package (link). It's the most complete and flexible bibliography tool in the LaTeX world. Using biblatex ,

Vim syntax and Latex math inside markdown

Deadly 提交于 2019-12-29 07:35:10
问题 I write documentation in markdown using ViM and I also put math using the latex $$ symbol (I compile using pandoc). The thing is that ViM syntax wouldn't ignore the underscores _ inside the dollar symbols and it is pretty annoying. For instance if I write this: $$ a_1 = 0 $$ Then Vim will highlight all the following text as italics due to to the underscore used. How can I change that? Also it would be nice if I could highlight what's inside $ with a different format. 回答1: I have put these

How do I encircle different data sets in scatter plot? [closed]

梦想的初衷 提交于 2019-12-29 07:16:58
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . How do I encircle different data sets in scatter plot? What I'm looking for is something like this: Also, how do I thereafter fill in the circle with a (shaded) colour? 回答1: You may get the path that incoporates all points via a convex hull scipy.spatial.ConvexHull . import matplotlib.pyplot as plt