4

I am getting this irregular behavior in horizontal alignment of some splitted equations over my document, this is only one example of it. The problem goes in the second split (which has practically the same structure than the first one). I have tried to correct it by putting \\ here and there but with no success. I know that it could have a simple solution, but I can find it. What can I do? Is it a bug of align environment?

enter image description here

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}

\DeclareMathOperator{\di}{d\!}
\DeclareMathOperator{\sen}{\rm sen}

\newcommand{\abs}[1]{\left\lvert\,\strut#1\,\right\rvert} %Absolute value


\begin{document}

\section{Trigonométricas Elementales}
\begin{align}
\int\sen x\,\di x & = -\cos x + C \\
\int\cos x\,\di x & = \sen x + C \\
    \begin{split}
        \int\tan x\,\di x   & = -\ln\abs{\cos x} + C \\
                            & = \ln \abs{\sec x} + C
    \end{split} \\
\int\csc x\,\di x & = -\ln\abs{\csc x- \cot x} + C \\
\int\sec x\,\di x & = -\ln\abs{\sec x+ \tan x} + C \\
    \begin{split}
        \int\cot x\,\di x & = \ln\abs{\cos x} + C \\
                          & = -\ln\abs{\csc x} + C \\
    \end{split} \\
\int\sen^2 x\,\di x & = \frac x2-\frac 14\sen 2x + C \\
\int\cos^2 x\,\di x & = \frac x2+\frac 14\sen 2x + C \\
\int\tan^2 x\,\di x & =\tan x - x + C
\end{align}
\end{document}
2
  • 1
    I suggest \newcommand{\di}{\mathop{}\!\mathrm{d}} that frees you from typing \, before it and works more generally. Also, besides having been deprecated for 20+ years, \rm does nothing relevant in the definition of \sen.
    – egreg
    Sep 22, 2017 at 8:06
  • Thank you @egreg. I will use your suggestion. As you pointed out, this can make me save some time and work. I did not know about \rm, I will take it into consideration in the future.
    – Cragfelt
    Sep 23, 2017 at 9:23

1 Answer 1

5

"Basically the same" is not the same as "the same"...

enter image description here

\documentclass{article}

\usepackage{amsmath}

\DeclareMathOperator{\di}{d\!}
\newcommand{\sen}{\mathop{\mathrm{sen}}\nolimits}
\newcommand{\abs}[1]{\left\lvert\,\strut#1\,\right\rvert} %Absolute value

\begin{document}

\section{Trigonométricas Elementales}
\begin{align}
  \int\sen x\,\di x & = -\cos x + C \\
  \int\cos x\,\di x & = \sen x + C \\
      \begin{split}
          \int\tan x\,\di x   & = -\ln\abs{\cos x} + C \\
                              & = \ln \abs{\sec x} + C
      \end{split} \\
  \int\csc x\,\di x & = -\ln\abs{\csc x- \cot x} + C \\
  \int\sec x\,\di x & = -\ln\abs{\sec x+ \tan x} + C \\
      \begin{split}
          \int\cot x\,\di x & = \ln\abs{\cos x} + C \\
                            & = -\ln\abs{\csc x} + C %\\ <---
      \end{split} \\
  \int\sen^2 x\,\di x & = \frac x2-\frac 14\sen 2x + C \\
  \int\cos^2 x\,\di x & = \frac x2+\frac 14\sen 2x + C \\
  \int\tan^2 x\,\di x & = \tan x - x + C
\end{align}

\end{document}
6
  • I knew it! It has a ridiculously simple solution! I spent more time writting the question than you answering it! Thank you.
    – Cragfelt
    Sep 22, 2017 at 5:46
  • 2
    Optional but worthwhile: Provide a better \abs macro than the one provided by the OP. E.g., load the mathtools package and write \DeclarePairedDelimiter{\abs}{\lvert}{\rvert}.
    – Mico
    Sep 22, 2017 at 5:51
  • 1
    Excellent @Mico!. I will take that into consideration. Thank you for the advice.
    – Cragfelt
    Sep 22, 2017 at 6:02
  • @Mico I changed the command declaration as you suggested, but the new command does not work for "tall" equations like fractions or big operators with \displaystyle.
    – Cragfelt
    Sep 23, 2017 at 9:26
  • 1
    @Cragfelt - Please read the manual of the mathtools package for how \abs macro works. If you want auto-sized "fences", you need to type \abs*{...}.
    – Mico
    Sep 23, 2017 at 10:10

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.