TeXworksHow to edit this math formula?

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
Post Reply
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

How to edit this math formula?

Post by yaozhao »

Code: Select all

$$max U(z)   such that \Sigma p_i z_i \leq I$$
There should have 2 improvements.

1st: Between max U(z) and such that should have some whitespace, how to do that?

2nd: I want to add a letter 'z' below max U(z). How to do?

Many thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

How to edit this math formula?

Post by Ijon Tichy »

Are you using plainTeX? In LaTeX you should never use the plainTeX displayed math $$…$$ but a LaTeX math environment, e.g., \[…\] or align (amsmath/mathtools), e.g.,
\documentclass{article}

\usepackage{mathtools}

\begin{document}
\[ \max_z{U(z)}  \text{ such that } \Sigma p_i z_i \leq I\]% Perhaps the \Sigma should be a \sum?
\end{document}
See amsldoc.pdf or l2tabu for reasons why not to use $$…$$. See amsldoc.pdf also for handling of limits to \max or \sum or alternative math environments.

BTW: Math & Sience would be the better forum section for such a question, because it is independent from the editor. tI was more or less a accident, that I found this question in the section of an editor I do not use.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

How to edit this math formula?

Post by yaozhao »

Thank you so much. Instead, I am using TeXworks. So you suggest I should never use $$ or $$ $$ to edit math?
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

How to edit this math formula?

Post by Ijon Tichy »

Once again: TeXworks is only the editor! Mostly it is used to edit LaTeX documents. And in LaTeX documents you should not use $$…$$. Please, see the links in my previous answer.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply