1

enter image description hereWhy are my 2 items not aligning properly?

\newtheorem{ex}{Exercise}

\begin{ex}
\textup{Consider the differential equation
\begin{align}
\label{eq3}
    \frac{x}{y(x)}y'(x)+1=y(x)\,\textup{log}(x)
\end{align} with unknown quantity $y:(0,+\infty)\rightarrow\mathbb{R^*}$.
\begin{itemize}
    \item Show that Equation \eqref{eq3} is a Bernoulli-type differential equation and that $z(x):=\frac{1}{y(x)}$ satisfies
    \begin{align}
    \label{eq4}
        z'(x)-\frac{z(x)}{x}=-\frac{log(x)}{x}\ .
    \end{align}
    \item Find all the solutions to Equation \eqref{eq4} on (0,+\infty).
\end{itemize}}
\end{ex}\hfill\break
6
  • 1
    align switches to display math which is usually centered. However, answering would be much easier if you explained what kind of alignment you expect.
    – campa
    Mar 26, 2021 at 13:02
  • i pasted the entire code, the second item appears more to the left than the first one
    – Martin
    Mar 26, 2021 at 13:07
  • Welcome to TeX.SC..Please do post a MWE and a clear picture of your requirement to help you in better way...
    – MadyYuvi
    Mar 26, 2021 at 13:08
  • Your question is not reproducible, the code causes an error for me. If you want some help, you need to post a minimum working example.
    – Felix Phl
    Mar 26, 2021 at 13:08
  • i posted a picture
    – Martin
    Mar 26, 2021 at 13:10

1 Answer 1

1

The misalignment is a consequence of

Find all the solutions to Equation \eqref{eq4} on (0,+\infty).

as \infty is a math-mode command. Compiling your code results in a classic Missing $ inserted error: never, ever ignore errors! TeX tries to recover but whatever PDF output you get is usually rubbish, as you've seen.

Another couple of comments:

  • Don't use \textup{log} but rather \log: the latter has the correct operator spacing, and you need no explicit \, in front of it.
  • : is a relational symbol; for a puctuation colon as in this case use \colon.
  • Avoid align for single-line equations.
  • Avoid wrapping the whole environment content in \textup; use a theorem style which uses upright text from the very beginning.
\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\theoremstyle{definition} % predefined style with upright text
\newtheorem{ex}{Exercise}

\providecommand*{\coloneq}{\mathrel{\mathop:}=}

\begin{document}

\begin{ex}
Consider the differential equation
\begin{equation}
\label{eq3}
    \frac{x}{y(x)} \, y'(x)+1=y(x)\log(x)
\end{equation}
with unknown quantity $y\colon(0,+\infty)\rightarrow\mathbb{R}^*$.
\begin{itemize}
    \item Show that Equation \eqref{eq3} is a Bernoulli-type differential equation
    and that $z(x)\coloneq\frac{1}{y(x)}$ satisfies
    \begin{equation}
    \label{eq4}
        z'(x)-\frac{z(x)}{x}=-\frac{\log(x)}{x}\ .
    \end{equation}
    \item Find all the solutions to Equation \eqref{eq4} on $(0,+\infty)$.
\end{itemize}
\end{ex}

\end{document}

enter image description here

You must log in to answer this question.

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