PSTricks,条件帧大小

PSTricks,条件帧大小

考虑以下代码:

\documentclass{article}

\usepackage{pst-eucl}
\usepackage{siunitx}

% LaTeX 3 syntax
\ExplSyntaxOn
  \cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff

% constants
\def\northB{\calc{90-\north} }
\def\lengthC{\calc{\length*sin(\northB*pi/180)} }
\def\lengthB{\calc{\length*sin(\north* pi/180)} }
\def\coorx{\calc{\lengthC*sin(\northB*pi/180)} }
\def\coory{\calc{\lengthB*cos(\north* pi/180)} }
\def\maxx{\calc{\length+0.45} }
\def\maxyA{\calc{1/2*\lengthB*(sin(\north*pi/180)+cos(\north*pi/180))} }
\def\maxyB{\calc{\coory+0.6} }

\begin{document}

% settings
\psset{unit = 0.67}
\sisetup{round-mode = places, round-precision = 1}
% constants
\def\length{16 }
\def\north{55 }
% picture
\begin{pspicture}(-0.6,-0.15)(\maxx,\maxyB)
  \pnodes{P}(0,0)(\coorx,\coory)(\length,0)
  \pspolygon(P0)(P1)(P2)
  \pstMarkAngle{P2}{P0}{P1}{\SI{\north}{\degree}}
  \pstRightAngle{P0}{P1}{P2}
  \pstMarkAngle{P1}{P2}{P0}{\SI{\northB}{\degree}}
  \uput[180](P0){$A$}
  \uput[90](P1){$C$}
  \uput[0](P2){$B$}
  \pstMediatorAB[
    PointSymbol = none,
    PointNameA = none,
    PointNameB = none,
    CodeFig = true,
    CodeFigColor = black
  ]{P1}{P2}{M}{MN}
  \psset{offset = -9pt, linestyle = none, nrot = :U}
  \pcline(P0)(P1)
  \ncput*{\SI{\lengthC}{\cm}}
  \pcline(P1)(P2)
  \ncput*{\SI{\lengthB}{\cm}}
  \pcline[offset = 9pt](P0)(P2)
  \ncput*{\SI{\length}{\cm}}
\end{pspicture}

\end{document}

输出

我如何让 PSTricks 选择\maxyA这个值是否大于\maxyB并选择\maxyB这个值是否大于\maxyA,即选择两个值中最大的一个?(我说的是 PSTricks 框架的高度。)

更新

以下是我最终得到的结果:

\documentclass{article}

\usepackage{pst-eucl}
\usepackage{siunitx}

% LaTeX 3 syntax
\ExplSyntaxOn
  \cs_new_eq:NN \calc \fp_eval:n
\ExplSyntaxOff

% constants
\def\northB{\calc{90-\north}}
\def\lengthB{\calc{\length*sin(\northB*pi/180)}}
\def\lengthC{\calc{\length*sin(\north* pi/180)}}
\def\coorx{\calc{\lengthB*sin(\northB*pi/180)}}
\def\coory{\calc{\lengthC*cos(\north* pi/180)}}
\def\maxxA{\calc{\length+0.45}}
\def\maxxB{\calc{1/4*\length*(sin(2*\north*pi/180)+cos(2*\north*pi/180)+3)}}
\def\maxx{\calc{max(\maxxA,\maxxB)}}
\def\maxyA{\calc{1/2*\lengthC*(sin(\north*pi/180)+cos(\north*pi/180))}}
\def\maxyB{\calc{\coory+0.6}}
\def\maxy{\calc{max(\maxyA,\maxyB)}}

\begin{document}

% settings
\psset{unit = 0.67}
\sisetup{round-mode = places, round-precision = 1}
% constants
\def\length{16 }
\def\north{55 }
% picture
\begin{pspicture}(-0.6,-0.15)(\maxx,\maxy)
  \pnodes{P}(0,0)(\coorx,\coory)(\length,0)
  \pspolygon(P0)(P1)(P2)
  \pstMarkAngle{P2}{P0}{P1}{\SI{\north}{\degree}}
  \pstRightAngle{P0}{P1}{P2}
  \pstMarkAngle{P1}{P2}{P0}{\SI{\northB}{\degree}}
  \uput[180](P0){$A$}
  \uput[90](P1){$C$}
  \uput[0](P2){$B$}
  \pstMediatorAB[
    PointSymbol = none,
    PointNameA = none,
    PointNameB = none,
    CodeFig = true,
    CodeFigColor = black
  ]{P1}{P2}{M}{MN}
  \psset{offset = -9pt, linestyle = none, nrot = :U}
  \pcline(P0)(P1)
  \ncput*{\SI{\lengthB}{\cm}}
  \pcline(P1)(P2)
  \ncput*{\SI{\lengthC}{\cm}}
  \pcline[offset = 9pt](P0)(P2)
  \ncput*{\SI{\length}{\cm}}
\end{pspicture}

\end{document}

答案1

使用定义

\def\maxy{\calc{max(\maxyA, \maxyB)} }

以获得最大值。

\begin{pspicture}[showgrid](-0.6,-0.15)(\maxx,\maxy)
...

相关内容