1

I have a mathematical equation

$$
K = \sum_{i \in \mathcal{V}} \left\lvert i^p - \mathbbm{1}_{\{i \in \mathcal{J}\}} \cdot k^p \right\rvert
$$

that when compiled, looks like:

enter image description here

Is there a way I could lengthen the absolute value verticals and to somehow not make the p power exponentials crunch the i and the k, as well as a better indicator function. Any suggestions what I could do will be greatly appreciated. Thanks!

2
  • please always provide MWE, not just code fragment
  • use $$ for switch to math mode is not LaTeX command, instead it use \[ ... \] or \begin{equation*} ... \end{equation*}
  • for absolute value is sensible to define new delimiters as enable mathtools package (see MWE below)
  • your equation doesn't look so bad ...
\documentclass[border=3.141592, varwidth]{standalone}
\usepackage{bbm, mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\begin{document}
\[
K = \sum_{i \in \mathcal{V}} \abs*{i^p - \mathbbm{1}_{i \in \mathcal{J}}^{}{\cdot}k^p}
\]
\end{document}

enter image description here

6
  • \lvert and \rvert are versions of | that receive opening and closing delimiter spacing. Mathtools isn’t necessary for this.
    – Don Hosek
    Jul 31 '21 at 22:39
  • @DonHosek, are you sure? Well, it is needed for \DeclarePairedDelimiter macro.
    – Zarko
    Jul 31 '21 at 23:03
  • It’s from amsmath. Amsldoc.PDF provides a suggested definition for \abs using it. Although with \left And \right even | will give the correct spacing.
    – Don Hosek
    Jul 31 '21 at 23:14
  • @DonHosek -- I haven't actually tested it, but I think that just | may not give optimal spacing. (It wouldn't if anything followed the right-hand vert.) Using \lvert ... \rvert is much better semantically. And although it's not really needed here, \DeclarePairedDelimiter does make things easier when sizing is required. Aug 1 '21 at 0:22
  • I'll have to try, but I believe that \left|\right| works on a similar mechanism to \left<\right>. I'll have to check later.
    – Don Hosek
    Aug 1 '21 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.