使用預覽包時設定方程式的顏色

使用預覽包時設定方程式的顏色

我使用預覽包導出僅包含我的方程式的 pdf,方法是將以下內容放在序言中

\usepackage[active,tightpage,displaymath,textmath]{preview}
\setlength\PreviewBorder{2pt}
\PreviewEnvironment{equation*}
\makeatletter\renewcommand\@eqnnum{}\makeatother

我想設定導出方程式的顏色。如何指定顏色以便預覽包能夠看到它?

答案1

目前尚不清楚您使用的特定文檔類,但我可以透過使用該color套件並在環境中設定顏色來獲得(例如)紅色方程式equation

\ifPreview可以如圖所示用於在不處於預覽模式時關閉著色。應透過刪除選項active來停用該包,\usepackage以便保持\ifPreview定義(而不是停用整個包,這會破壞東西)。

一個MWE:

\documentclass[12pt]{article}

\usepackage[active,tightpage,displaymath,textmath]{preview}
\setlength\PreviewBorder{2pt}
\PreviewEnvironment{equation*}
\makeatletter\renewcommand\@eqnnum{}\makeatother

\usepackage{color}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{equation}
\ifPreview\color{red}\fi
a^2 + b^2 = \frac{1}{\sqrt{\pi r^3}}
\end{equation}

\lipsum[2]

\end{document}

預覽如下:

預覽均衡器

但禁用後,顯示為:

常規情緒智商

相關內容