LaTeX forum ⇒ TeXworksHow to edit this math formula?

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

How to edit this math formula?

Postby yaozhao » Sat Aug 03, 2019 6:36 am

$$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 Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

How to edit this math formula?

Postby Ijon Tichy » Mon Aug 05, 2019 11:42 am

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?

Postby yaozhao » Mon Aug 05, 2019 4:49 pm

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?

Postby Ijon Tichy » Tue Aug 06, 2019 3:23 pm

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:


Return to “TeXworks”

Who is online

Users browsing this forum: No registered users and 1 guest