Math & ScienceAdditional flushed right Text in Math Environments

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
arstaer
Posts: 12
Joined: Sun Jun 17, 2012 5:56 am

Additional flushed right Text in Math Environments

Post by arstaer »

Dear all,

I'm trying to set up flushed right text in the cases environment inside the align* environment. It's for the exam to specify how many points each linear equation in the equation system is worth. It doesn't seem to work that well as in normal text environment as I want it to be flushed right in the page but instead it's too close to the equation.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{amsfonts,amssymb}
\begin{document}
\begin{align*}
\begin{cases}
\mathbb{E}(r_A)&=r_f + \beta_A FP ~\hspace*{\fill}[5~points] \\
\mathbb{E}(r_B)&=r_f + \beta_B FP \\
\end{cases}
\end{align*}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Any idea what can be done in this case?


Thank you,
Arsenio

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Additional flushed right Text in Math Environments

Post by cgnieder »

I would go a different way and define a command that places the points in the margin.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{amsfonts,amssymb}
\usepackage{showframe} % to show page dimensions
\usepackage{marginnote}
\newcommand*\points[1]{\marginnote{[#1~points]}} % in the margin
\begin{document}
\begin{align*}
\begin{cases}
\mathbb{E}(r_A)&=r_f + \beta_A FP \points{5} \\
\mathbb{E}(r_B)&=r_f + \beta_B FP
\end{cases}
\end{align*}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Regards
site moderator & package author
arstaer
Posts: 12
Joined: Sun Jun 17, 2012 5:56 am

Additional flushed right Text in Math Environments

Post by arstaer »

This looks great!

Have never used the marginnote package. Are there any drawbacks to putting points on the margin, e.g., conflicts with other packages, problems when printing?


Thanks a lot mate,
Arsenio
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Additional flushed right Text in Math Environments

Post by cgnieder »

arstaer wrote:Have never used the marginnote package. Are there any drawbacks to putting points on the margin, e.g., conflicts with other packages, problems when printing?
Not that I know of. I regularly use it myself and haven't encountered any problems yet.

Regards
site moderator & package author
Post Reply