如何在 LaTeX 中设置“公式三角形”?

如何在 LaTeX 中设置“公式三角形”?

我想为公式排版一个公式三角形(“Formeldreieck”)U=E*d- 在 LaTeX 中有没有简单的方法可以做到这一点(我实际上在 Mac OS X 上使用 LaTeXit,但我知道如何在必要时添加软件包)?

答案1

我认为你可以使用 TikZ 来实现这一点:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\tikzset{
    Formeldreieck/.style={
        draw=blue,thick,
        regular polygon,
        regular polygon sides=3,
        node distance=2cm,
    }
}
\begin{document}
\tikz\node[Formeldreieck]{$\dfrac{U}{R\cdot I}$};
\end{document}

答案2

是的,这篇文章很古老,但它是谷歌上的第一个结果。无意冒犯,但我发现里面有小方程式的巨大三角形不太令人满意,所以我做了自己的,并与谷歌推荐到这里的人分享。(我知道这可能也不是最优雅的解决方案,我很感激任何建议/改进!)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\formulatriang}[7][.33]{
    % optional first argument PW: variables will be placed on the angle
    % bisectors, PW of the way between vertex and opposite side.
    \begin{tikzpicture}[x=3.5em,y=3.5em]
    \def\pw{#1}
    \coordinate (B) at (0,0);
    \coordinate (A) at (60:1);
    \coordinate (C) at (1,0);
    \coordinate (AB) at ($ (A)!.5!(B)$);
    \coordinate (AC) at ($ (A)!.5!(C)$);
    \coordinate (a) at ($ (60:1)!\pw!(.5,0)$);
    \coordinate (b) at ($ (0,0)!\pw!(30:0.866)$);
    \coordinate (c) at ($ (1,0)!\pw!(60:0.5) $);
    \draw[style=thick,rounded corners=.5ex]
    (A) node[anchor=south,rotate=-60] {#3}
    -- 
    (B) node[anchor=south,rotate=60] {#5}
    --
    (C) node[anchor=north,rotate=0] {#7}
    -- cycle;       
    \draw  (AB) -- ($ (AB)!.2!(C)$);
    \draw  (AC) -- ($ (AC)!.2!(B)$);
    \node at ($(b)!.5!(c)$) {$\cdot$};
    \path 
    (a) node[shape=circle,anchor=center] {#2}
    --
    (b) node[shape=circle,anchor=center] {#4}
    --
    (c)
    node[shape=circle,anchor=center] {#6}
    ;
    \end{tikzpicture}
}


\begin{document}
    A smaller one \formulatriang{$m$}{mass}{$\rho$}{density}{$V$}{volume}.
    
    But since I used em units, it should look fine with a larger font, too:\\
    \Huge
    \formulatriang[.4]{$F$}{force}{$\sigma$}{stress}{$A$}{area}
\end{document}

在此处输入图片描述

相关内容