本文介绍了倍频程:LaTeX抽动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GNU Octave中,我想将绘图的tic设置为分数.因此,我想写的是"\ frac 1 128",而不是0.0078125(等于1/128).

In GNU Octave I would like to set the tics of a plot as fractions. So instead of 0.0078125 (which is equal to 1/128) I would like to write "\frac 1 128".

我已经尝试过

set(gca,'xTickLabel',{'\frac 1 128'});

但是它不起作用.文本'\ frac 1128'不解释为LaTeX代码.

but it does not work. The text '\frac 1 128' is not interpreted as LaTeX code.

推荐答案

latex尚未在GNU Octave中实现.您可以将TeX的子集用于希腊符号等等.

latex isn't implemented yet in GNU Octave. You can use a subset of TeX for Greek symbols and so on.

如果只想在生成的打印物中使用LaTex(用于发布),则可以使用设备epslatexstandalone,然后使用latex进行渲染:

If you just want to have LaTex in the generated print (for publication), you can use for example the device epslatexstandalone and render it afterwards with latex:

close all
graphics_toolkit fltk

title ("for thyme:")

t = linspace (0, 2 * pi, 100);

plot (t, sin (t))
set (gca, "xtick", [0 0.5 1 1.5 2] * pi)
set (gca, "xticklabel", {'$0$', '$\frac{\pi}{2}$', '$\pi$', '$\frac{3\pi}{2}$', '$2\pi$'})
grid on
set(gca, "fontsize", 20);

print -depslatexstandalone thyme

## process generated files with pdflatex
system ("latex thyme.tex");

## dvi to ps
system ("dvips thyme.dvi");

## convert to png for stackoverflow
system ("gs -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r100x100 -dEPSCrop -sOutputFile=thyme.png thyme.ps")

这篇关于倍频程:LaTeX抽动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 10:05