I would like to change the braces in the align-environment from the normal braces ( ) to rectangular braces [ ],
[Tex/LaTex] How to change the style of the braces around equation numbers in the align-environment
alignbracesformatting
Related Solutions
Each cell within the align
environment forms a group, localizing the extent of the colour change. If you wrap the colour change around the outside of align
, it spans across the internal cells:
\documentclass{article}
\usepackage{xcolor,amsmath}% http://ctan.org/pkg/{xcolor,amsmath}
\begin{document}
{\color{red}\begin{align}
x &= 1\\
y &= 2
\end{align}}
\end{document}
You'll notice that this sets even the equation numbers in \color{red}
. This is easily fixed by adding the following to your preamble:
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\math@cr@@@align}% <cmd>
{\place@tag}% <search>
{\bgroup\color{black}\place@tag\egroup}% <replace>
{}{}% <success><failure>
\makeatother
The above etoolbox
-patch inserts a black
colour-change around the number-printing mechanism \place@tag
:
For individual colour modifications to each cell/component of the line, insert \color{<colour>}
in the respective cells you want to use colour <colour>
.
Just omit the line-break directive at the end of the final equation in a given align
group. E.g.,
\begin{align}
P(t) &= \tfrac{3}{2}[v_d(t)i_d(t)] \\
Q(t) &= \tfrac{3}{2}[-v_d(t)i_q(t)] % <- no "\\" directive
\end{align}
As the code shows, I would also (a) remove the \left
and \right
qualifiers as they actually don't do anything for the cases at hand and (b) replace \frac
with \tfrac
.
If you have a multi-line equation that should be assigned just one equation number, don't use an align
environment. Instead, use a split
environment inside an equation
environment.
By the way, the arrows produced by \overrightarrow
look disproportionately large; consider using \vec
instead. For arrows (and other diacritics) set above the characters i
and j
, it's traditional to omit the "dot", i.e., to use a "dotless" i
and j
; this may be achieved in math mode by writing \imath
and \jmath
. Separately, I again would not use \left
and \right
to autosize the round parentheses and curly braces; consider using \bigl
and \bigr
instead. (By the way, the outermost round parentheses may be omitted in all three rows, right?)
\documentclass{article}
\usepackage{amsmath}
\numberwithin{equation}{section}
\begin{document}
\setcounter{section}{1} % just for this example
\setcounter{equation}{31}
\begin{align}
P(t) &= \tfrac{3}{2}[v_d(t)i_d(t)] \\
Q(t) &= \tfrac{3}{2}[-v_d(t)i_q(t)]
\end{align}
\setcounter{equation}{20} % just for this example
\begin{equation}\begin{split}
P(t)
&= \frac{
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)\bigr\} +
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)^*\bigr\}}{2} \\
&\quad+ \frac{
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)e^{-j\frac{4\pi}{3}}\bigr\} +
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)^*\bigr\}}{2} \\
&\quad+ \frac{
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)e^{-j\frac{8\pi}{3}}\bigr\} +
\Re\bigl\{\vec{v}(t)\vec{\imath}(t)^*\bigr\}}{2}
\end{split}\end{equation}
\end{document}
Best Answer
You can do this on a one-off basis as follows.
Alternatively, try this if you want labels in square brackets for all equations throughout the document.