1

Photo of Code and LaTeX

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

\title{Removed text for Stack exchange Post}
\author{Cameron Eggart}
\date{Fall 2021}

\begin{document}

\maketitle

\section*{Problem 1}


Removed text for Stack Exchange Post
 \begin{align*}
\text{Removed text for Stack Exchange Post}
 \end{align*}
\clearpage
\section*{Problem 2}
Removed text for Stack Exchange Post \\
\\
Calculating Normal and Axial Forces using (1.7) and (1.8) pg 22. \\
Note: $\theta = 0$ because plate is flat
\begin{align*}
    N'&=-\int_0^1\left[(4*10^4(x-1)^2+5.4*10^4)cos(0)+(288x^{-0.2}sin(0))\right]ds_u \\
    +\int_0^1\left[(2*10^4(x-1)^2+1.73*10^5)cos(0)-(735x^{-0.2}sin(0))\right]ds_l \\
    \boxed{N' = 112333\text{ N}}\text{ (wolfram alpha)} \\
    A'&=\int_0^1\left[-(4*10^4(x-1)^2+ 5.4*10^4)sin(0)+(288x^{-0.2}cos(0))\right]ds_u \\
    +\int_0^1\left[(2*10^4(x-1)^2+1.73*0^5)sin(10)+(735x^{-0.2}cos(0))\right]ds_l \\
    \boxed{A' = 1279\text{ N}} \text{ (wolfram alpha)} \\
    \end{align*}
Calculate Lift and Drag using (1.1) and (1.2) pg 20
\begin{align*}
    L = 112333*cos(10)-1279*sin(10) \\
    \boxed{L = 110404.31\text{ N}} \\
    D = 112333*sin(10)+1279*cos(10) \\
    \boxed{D = 20765.99\text{ N}}
\end{align*}
\clearpage
\section*{Problem 3}
Removed text for Stack Exchange Post
\end{document}

First-time LaTeX user, so if you see any other glaring issues, I would appreciate any general feedback on how to format my text. Thank you for your time, Cameron

--------------------------Suggestion 1: ---------------------------

I moved the first two lines of the \text{} in the \begin{align*} out of the align portion. See image :here

--------------------------Suggestion 2: ---------------------------

Updated code to contain a full document.

7
  • 2
    You have put \text{Calculating Normal and Axial Forces using (1.7) and (1.8) pg 22.} this is a wide unbreakable box in the left hand side of the alignment so everything after & on later rows is to the right of that. Move that text before the alignment Commented Sep 10, 2021 at 14:27
  • 1
    use \cos not cos (never use math italic for operators or words it is designed to separate the letters for a product of 1-letter variables, c times o times s Commented Sep 10, 2021 at 14:29
  • 1
    using * for multiplication isn't necessarily wrong but somewhat unusual in typeset mathematics, more commonly it is \times at elementary levels and nothing or \cdot at higher levels. Commented Sep 10, 2021 at 14:30
  • 1
    Most of the text should be outside the align environment, maybe you can put some of it, like the Wolfram alpha calculation, inside with \intertext{...} Commented Sep 10, 2021 at 14:38
  • 1
    the boxed line with "wolfram alpha" and "Calculate Lift " are almost as wide, but it would be much easier to test if you provided an complete test document debugging code from an image is painful. I suspect you are looking for \intertext to add unaligned text in between aligned rows of math see texdoc amsmath Commented Sep 10, 2021 at 14:44

1 Answer 1

1

Too long for a comment. As pointed out by @David Carlisle, you have elements that are too wide and reject what is after the & outside the page. Indeed, since you don't have alignment characters in the second line of your align environment, it is considered as if you had written <your second line> & \\ (please, someone correct me if I'm wrong). Therefore, the third line being considered the same (i.e. <your third line> & \\), it is aligned on the alignment character &. Because of this, the left side of your first and fourth lines is also right aligned on the alignment character and the right side of these lines is left aligned on the alignment character.

Here is a suggestion to try to improve your code. I guessed that the lines that didn't have alignment characters (&) were lines that you wanted to center. Therefore, I got rid of the align environment and broke the long equations over several lines with the multlined environments, letting the other equations be naturally centered with gather environment. Finally, given the length of your equations, the equations that "should" be aligned are more or less visually aligned.

\documentclass{article}

%\usepackage{amsmath} % Not necessary since it is loaded by mathtools as pointed out in the comments
\usepackage{mathtools}

\begin{document}

Calculating Normal and Axial Forces using (1.7) and (1.8) pg 22.
Note: $\theta = 0$ because plate is flat.
\begin{gather*}
    \begin{multlined}
        N' = -\int_0^1\left[(4\cdot10^4(x-1)^2+5.4\cdot10^4)\cos(0)+(288x^{-0.2}\sin(0))\right]ds_u\\
            + \int_0^1\left[(2\cdot10^4(x-1)^2+1.73\cdot10^5)\cos(0)-(735x^{-0.2}\sin(0))\right]ds_l
    \end{multlined}\\
    \boxed{N' = 112333\text{ N}}\text{ (wolfram alpha)}\\
    \begin{multlined}
        A' = \int_0^1\left[-(4\cdot10^4(x-1)^2+ 5.4\cdot10^4)\sin(0)+(288x^{-0.2}\cos(0))\right]ds_u\\
            + \int_0^1\left[(2\cdot10^4(x-1)^2+1.73\cdot0^5)\sin(10)+(735x^{-0.2}\cos(0))\right]ds_l
    \end{multlined}\\
    \boxed{A' = 1279\text{ N}} \text{ (wolfram alpha)}
\end{gather*}
Calculate Lift and Drag using (1.1) and (1.2) pg 20
\begin{gather*}
        L = 112333\cdot\cos(10)-1279\cdot\sin(10)\\
        \boxed{L = 110404.31\text{ N}}\\
        D = 112333\cdot\sin(10)+1279\cdot\cos(10)\\
        \boxed{D = 20765.99\text{ N}}
\end{gather*}
    
\end{document}
7
  • Thank you, this is what I was failing to achieve. If you have a moment, could you explain your thoughts on the differences between \begin{align*} and \begin{gather*}? For \begin{multilined}, I believe, I understand what is occurring. I will use multilined for long equations going forward.
    – Eggart
    Commented Sep 10, 2021 at 15:01
  • Be careful with multlined, it is meant to be used inside another math environment (like align, gather, etc.) I invite you to look at the mathtools documentation. To break a single long equation, you should use the multline environment instead of multlined, but align can be OK, depending on what you want to achieve. You can also search "long equation" directly on this site and you will have several way of doing that.
    – KersouMan
    Commented Sep 10, 2021 at 15:07
  • gather is meant to group successive equations: instead of writing \begin{equation}<your first equation>\end{equation}\begin{equation}<your second equation>\end{equation} yous should write \begin{gather}<your first equation>\\<your second equation>\end{gather} while align is meant to align, for example, equations belonging to a linear system of equations.
    – KersouMan
    Commented Sep 10, 2021 at 15:14
  • 1
    Off-topic: mathtools loads amsmath automatically; no need to load amsmath expicitly.
    – Mico
    Commented Sep 10, 2021 at 16:02
  • 1
    @Mico I edited the answer accordingly
    – KersouMan
    Commented Sep 10, 2021 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .