我希望在对齐环境中框选部分方程,但不是全部。例如,我想框选“max”和“st”部分中的方程,但不框选下面示例中的“where”部分中的方程。
\documentclass[12pt]{article}
\usepackage{amsmath, amssymb}
\begin{document}
\begin{subequations}
\begin{align}
\max_{w,b,\xi} \quad & a^2 + b^2 + c^2 \nonumber\\
\textrm{s.t.} \quad & a, b, c \in \mathbb{R}\\
& 0 \leq a \leq b \leq c \leq n \\
& a + 2b - c \geq 0 \\
\textrm{where} \quad & n = 25\\
\end{align}
\end{subequations}
\end{document}
答案1
带有链接对多对齐方程的分量进行装箱 我发现了 hf-tikz 包和 Sebastiano 的代码
评论后已修改
\documentclass[12pt]{article}
\usepackage{amsmath, amssymb}
\usepackage[customcolors]{hf-tikz}
% code de Sebastiano
%https://tex.stackexchange.com/questions/432596/boxing-a-component-of-multi-aligned-equation
\tikzset{offset def/.style={
above left offset={-1,0.5},%<-- réglages the boxe
below right offset={2,-0.25},%<-- réglages the boxe
},
color def/.style={
offset def,
set fill color=white,
set border color=black,%<-- réglage border color
},
}
\begin{document}
\begin{subequations}
\begin{align}
\tikzmarkin[color def]{mark 1}\max_{w,b,\xi} \quad & a^2 + b^2 + c^2 \nonumber\\
\textrm{s.t.} \quad & a, b, c \in \mathbb{R}\\
& 0 \leq a \leq b \leq c \leq n \\
& a + 2b - c \geq 0 \tikzmarkend{mark 1}\\
\textrm{where} \quad & n = 25\\
\end{align}
\end{subequations}
In the hf-tikz package documentation p. 3
\[\tikzmarkin{a-1}x+\dfrac{z}{y}=400\tikzmarkend{a-1}\]
\begin{equation}
\tikzmarkin[below right offset={0.1,-0.4},above left offset={-0.1,0.5}]
{right delim frac 2}
x+\dfrac{z}{y}=400
\tikzmarkend{right delim frac 2}
\end{equation}
\end{document}
修改了 2 和 alignedat
\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage[customcolors]{hf-tikz}
\begin{document}
\tikzset{
%offset def/.style={
% above left offset={0,0},%<-- réglages the boxe
% below right offset={0,0},%<-- réglages the boxe
% },
color def/.style={
%offset def,
set fill color=white,
set border color=black,%<-- réglage border color
},
}
\begin{equation}
\begin{alignedat}{2}
\tikzmarkin[color def]{mark 99}\max_{w,b,\xi} \quad& a^2 + b^2 + c^2 \\
\textrm{s.t.} \quad &a, b, c \in \mathbb{R}\\
& 0 \leq a \leq b \leq c \leq n\\
&a + 2b - c \geq 0&\tikzmarkend{mark 99}\\%<-- a colon additional
\textrm{where} \quad & n = 25
\end{alignedat}
\end{equation}
\end{document}