小编Wer*_*ner的帖子

从LaTeX中的图标删除前缀

我想\caption{}在LaTeX的数字里面制作自己的标题.如何从出现的标题中关闭"图"前缀?

latex tex captions

42
推荐指数
4
解决办法
6万
查看次数

如何更改列表中的标题?

我有一个关于--listings--包的问题.你知道怎么改变它来得到这样的"算法"而不是标题行中随意的"列表"吗?

谢谢你的答复

latex listings

34
推荐指数
1
解决办法
2万
查看次数

如何在matplotlib输出中获得与latex输出相同的字体(-style,-size等)?

我有一个.tex文档,其中一个图由python模块生成matplotlib.我想要的是,图表尽可能好地融入文档.所以我希望图中使用的字符看起来与文档其余部分中的其他字符完全相同.

我的第一次尝试看起来像这样(matplotlibrc-file):

text.usetex   : True
text.latex.preamble: \usepackage{lmodern} #Used in .tex-document
font.size    : 11.0 #Same as in .tex-document
backend: PDF
Run Code Online (Sandbox Code Playgroud)

用于编译包含.texPDF输出的matplotlib内容pdflatex.

现在,输出看起来不错,但看起来有些不同,图中的字符在笔画宽度上看起来较弱.

对此最好的方法是什么?

编辑:最小例子:LaTeX输入:

\documentclass[11pt]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics{./graph}
\caption{Excitation-Energy}
\label{fig:graph}
\end{figure}

\end{document}
Run Code Online (Sandbox Code Playgroud)

Python的脚本:

import matplotlib.pyplot as plt
import numpy as np

plt.plot([1,2,3,4])
plt.xlabel("Excitation-Energy")
plt.ylabel("Intensität")
plt.savefig("graph.pdf")
Run Code Online (Sandbox Code Playgroud)

PDF输出:

在此输入图像描述

python matplotlib tex

32
推荐指数
3
解决办法
1万
查看次数

如何在乳胶中绘制对角线表格边框,就像在Excel中一样?

是否可以在LaTeX中绘制对角线(平行四边形)单元格:单元格内容是对角线的,单元格最初的垂直边框也是对角线的.

以下是我使用旋转包设法做的事情:

\begin{tabular}{|r|c|c|}
\hline
\\ \\ \\ \\ \\ \\ \\ \\ \\ \\
 & \begin{rotate}{45}Trying to save some horizontal space\end{rotate} & \begin{rotate}{45}While keeping headers readable\end{rotate} \\
\hline
this & is & a \\
\hline
sample & latex & table \\
\hline
\end{tabular}
Run Code Online (Sandbox Code Playgroud)

以下是输出与使用Excel可能实现的截图:

在此输入图像描述

excel latex

12
推荐指数
1
解决办法
4828
查看次数

自Xetex弃用以来使用Pandoc降价至PDF

在我的MacBook(OSX Mountain Lion)上,我曾经使用此Pandoc命令将Markdown转换为PDF:

$ markdown2pdf -N -o pandoc_output.pdf  --xetex --toc --template=mytemplate.tex myfile.md
Run Code Online (Sandbox Code Playgroud)

markdown2pdf不再有效,并且不推荐使用--xetex选项markdown2pdf -N -o ../../Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate-headers-garamond_date.tex.

如果我这样做:

$ pandoc -N -o Desktop/pandoc_output.pdf  --xetex --toc --template=mytemplate.tex myfile.md
Run Code Online (Sandbox Code Playgroud)

我明白了:

pandoc: unrecognized option `--xetex'
Run Code Online (Sandbox Code Playgroud)

但如果我拿出--xetex来做这件事:

$ pandoc -N -o Desktop/pandoc_output.pdf  --toc --template=mytemplate.tex myfile.md
Run Code Online (Sandbox Code Playgroud)

然后我明白了:

pandoc: Error producing PDF from TeX source.
! Package hyperref Error: Wrong driver option `xetex',
(hyperref)                because XeTeX is not detected.

See the hyperref package documentation for explanation. …
Run Code Online (Sandbox Code Playgroud)

markdown latex xetex pandoc

8
推荐指数
2
解决办法
7283
查看次数

同步slideInput和textInput

考虑以下闪亮的应用程序:

library('shiny')

# User Interface/UI

ui <- fluidPage(

  titlePanel(
    'Slider and Text input update'
  ), # titlePanel

  mainPanel(

    # Slider input
    sliderInput(
      inputId = 'sliderValue',
      label = 'Slider value',
      min = 0,
      max = 1000,
      value = 500
    ), # sliderInput

    # Text input
    textInput(
      inputId = 'textValue',
      label = NULL
    ) # textInput

  ) # mainPanel

) # fluidPage


# Server logic

server <- function(input, output, session) {

  observe({
    # Update vertical depth text box with value of slider …
Run Code Online (Sandbox Code Playgroud)

textbox r dynamic slider shiny

8
推荐指数
1
解决办法
460
查看次数

使用dplyr对随机事务列表进行排序

假设以下一组原始交易:

library(tidyverse)

original_transactions <- data.frame(
  row = 1:6,
  start = 0,
  change = runif(6, min = -10, max = 10) %>% round(2),
  end = 0
) %>% mutate(
  temp = cumsum(change),
  end = 100 + temp, # End balance
  start = end - change # Start balance
) %>% select(
  -temp
)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

它显示了一个(按时间顺序)交易顺序,起始余额为100.00美元,期末余额为95.65美元,有六笔交易/变更.

现在假设您收到了这个混乱的版本

transactions <- original_transactions %>% sample_n(
  6
) %>% mutate(
  row = row_number() # Original sequence is unknown
)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何对R中的序列进行逆向工程?也就是说,要获得transactions匹配的排序顺序original_transactions?理想情况下,我想使用dplyr一系列管道%>% …

sorting r dplyr

8
推荐指数
1
解决办法
182
查看次数

Latex biblatex:参考书目标题没有做断线,而是溢出[ ]

我最近在参考书目中发现了一个问题,但不知何故无法解决。当标题太长时它就会出现,但只要标题足够短,它就会正常使用 URL,正如您在第二个示例中看到的那样。

似乎像“[]”这样的符号是由某些东西生成的,并且日志在段落中给了我 2x Overfull \hbox (X pt 太宽)。

生成的乳胶文档

设置:document.texbib/literature.bib

设置:pdfLatex(使用 biber 和 texindy)

最小的例子:

\documentclass[
    11pt,
    a4paper
]{scrreprt}

% add bibliography
\usepackage[style=alphabetic, sorting=anyt]{biblatex}
\addbibresource{bib/literature.bib}

\usepackage[colorlinks, urlcolor=blue]{hyperref}

\begin{document}
    \cite{Gaedke}
    \cite{IOT}

    \printbibliography
\end{document}
Run Code Online (Sandbox Code Playgroud)

文学参考书目

@online{Gaedke,
    author = {Gaedke, Martin and Heil, Andreas},
    title = {{GET /dgs HTTP/1.1 Host: www.WebComposition.net.}},
    url = {http://www.mendeley.com/research/dgs-http11-host-wwwwebcompositionnet/},
    urldate={2018-08-19}
}
@online{IOT,
    author = {Litzel, Nico },
    title = {Was ist das Internet of Things?},
    url = {https://www.bigdata-insider.de/was-ist-das-internet-of-things-a-590806/},
    urldate={2018-08-19}
}
Run Code Online (Sandbox Code Playgroud)

latex pdflatex biblatex

7
推荐指数
1
解决办法
2万
查看次数

使用 org-latex-preview 居中显示方程?

由于某种原因,当我运行 org-latex-preview (Cc Cx Cl) 时,org-mode 会左对齐我的显示方程。但是每个方程与其方程编号之间的边距是计算出来的,就好像方程居中一样,这破坏了方程编号之间的对齐。

是否可以打开显示方程的居中功能,以便方程编号对齐(就像 AUCTeX 一样)?

以下是带有显示方程的 .org 文档示例:

A numbered display equation:

\begin{equation}
\frac{\partial u}{\partial t}-\alpha\nabla^2u=0\tag{1}
\end{equation}

A second numbered equation:

\begin{equation}
E=MC^2\tag{2}
\end{equation}
Run Code Online (Sandbox Code Playgroud)

这是运行 org-latex-preview 后 org-mode 的屏幕截图:

在此输入图像描述

emacs latex auctex org-mode

6
推荐指数
1
解决办法
3270
查看次数

需要减少这个空白,但似乎在我能做的范围内(GNUPLOT)

我在 gnuplot 上生成等高线图并输出 eps 文件,然后我在乳胶中运行这些文件。这是四个等高线图,我需要它们都在我的页面的同一级别上。我很接近但是;

在此处输入图片说明

你可以看到剩下的三个图的空白占据了一些空间,如果它们被移除,它肯定会全部放在一条线上(所有图片都在同一水平上)。这是我的 gnuplot 代码的示例(对于那些没有 y 轴的代码);

 reset
 set size 0.38, 1

set terminal epslatex
set out 'finalpolar2.tex'
set termoption dash


#set title istitle;
set font "20"
unset xlabel
unset ylabel
set format y ""
set ylabel offset 1.5;
set palette model HSV rgbformulae 7,5,15
set contour;
set view map;
unset surface;
set cntrparam levels 8;
set isosamples 50;
unset key;
set size ratio 2
set xtics 0,0.5,40
set cbtics 0,0.02,40
set cbtics offset -1;
splot 'loop_final.txt' …
Run Code Online (Sandbox Code Playgroud)

latex gnuplot

5
推荐指数
1
解决办法
4452
查看次数