如何設定分配給環境的空間尺寸?例如,如果我想要一個方程式 $x^2 + y^2 = R^2$ 位於正好 5 公分高、10 公分長的區域的中心,我該怎麼做?
我正在使用 LaTexIt 創建 .jpg 以供線上使用,並且需要能夠設定結果圖像的整體比例,但輸出似乎預設為內容的確切大小。我希望我可以在它周圍的某個空間中進行編碼,以便能夠指定最終輸出的尺寸。
我已經搜索了一個多小時並嘗試了各種盒子但沒有成功。
答案1
你可以用standalone
;運行與pdflatex -shell-escape
\documentclass[convert]{standalone}
\newcommand{\sizedmath}[3]{%
\parbox[t][#2][s]{#1}{%
\centering
\vspace*{\fill}
$\displaystyle#3$\par
\vspace*{\fill}
}%
}
\begin{document}
% \sizedmath{<width>}{<height>}{<formula>}
\sizedmath{4cm}{2cm}{x^2+y^2=R^2}
\end{document}
這是生成的 PNG 文件,您可以下載該文件以查看其屬性。
PDF 檔案(從中產生 PNG)資訊視窗顯示