我做了一个图表Desmos.com。
我想将其插入到我的LaTeX
代码中,在这些等式的右边:
\documentclass[12pt,a4paper]{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{marginnote}
\begin{document}
\underline {Chandrashekhar EOS (1935)} : \\
\begin{align*}
\overline \rho &= K ~\Big( \sinh ~t ~- ~t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh~t -~ 8~ \sinh \frac {1}{2} t +~ 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end {document}
我如何将图表上的曲线标记为P
和T
并将其插入到我的代码中?
答案1
抱歉,之前没有得到答复。但无论如何,这是一个使用pgfplots
环境的示例minipage
。
\documentclass[12pt,a4paper]{article}
\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{mathtools}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{marginnote}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\underline {Chandrashekhar EOS (1935)}:
\noindent\begin{minipage}{0.45\textwidth}
\begin{align*}
\overline \rho &= K \Big( \sinh t - t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh t - 8 \sinh \frac {1}{2} t + 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end{minipage}\hfill
\begin{tikzpicture}[baseline=(theAxis.west)]
\begin{axis}[
name=theAxis,
ymin=-15,ymax=15,
domain=-8:8,
samples=50,
no markers,
cycle list name=exotic,
thick,
width=0.48\textwidth,
grid,
xlabel=$t$,
ylabel={Something}
%% if you want a legend, uncomment these
% legend entries={$\overline{\rho}$, $\overline{P}$},
% legend pos=north west
]
\addplot {(sinh(x) - x)/(4*pi)} node[left,pos=0.53]{$\overline{\rho}$};
\addplot {(sinh(x) - 8*sinh(x/2) + 3*x)/(3*4*pi)} node[right,pos=0.6]{$\overline{P}$};
\end{axis}
\end{tikzpicture}
\end {document}
如果您将图表从 Desmos 导出为 PNG 图像,则可以执行类似这样的操作,其中调用图像graph.png
并将其与文件放在同一文件夹中.tex
。这种方法的缺点是图像可能需要缩放,这也会缩放字体。
\underline {Chandrashekhar EOS (1935)}:
\noindent\begin{minipage}[b]{0.45\textwidth}
\begin{align*}
\overline \rho &= K \Big( \sinh t - t\Big)\\
\overline P &= \frac {1}{3} K ~ \Big(\sinh t - 8 \sinh \frac {1}{2} t + 3t\Big)\\
K &= \frac {1}{4\pi}\\
\end {align*}
\end{minipage}\hfill
\includegraphics[width=0.45\textwidth]{graph}