Right justified equation numbers w/o tables

N

nobody

Greetings. I want to put a bunch of equations with right justified
numbers on the same line as the equation but I cannot seem to find a
way of doing this w/o tables, which is really a PITA. I tried
everything I can think of in the Span styles but since I cannot get to
specify a width as "all the remaining space", it doesn't seem to work.
Is there no way of doing this w/o tables? Thanks.

DIV.Math {
font : bold larger "Courier New", Courier, monospace;
color : Navy;
margin : 6px 8% 6px 8%;
width : 100%;
}

SPAN.EqNo {
font : normal italic "Times New Roman", Times, serif;
color : Maroon;
???
}

....

<div class="math">P = B + C<span class="eqno">[3]</span></div>
 
A

Adrienne Boswell

Greetings. I want to put a bunch of equations with right justified
numbers on the same line as the equation but I cannot seem to find a
way of doing this w/o tables, which is really a PITA. I tried
everything I can think of in the Span styles but since I cannot get to
specify a width as "all the remaining space", it doesn't seem to work.
Is there no way of doing this w/o tables? Thanks.

DIV.Math {
font : bold larger "Courier New", Courier, monospace;
color : Navy;
margin : 6px 8% 6px 8%;
width : 100%;
}

SPAN.EqNo {
font : normal italic "Times New Roman", Times, serif;
color : Maroon;
???
}

...

<div class="math">P = B + C<span class="eqno">[3]</span></div>

Is there a reason why tables wouldn't work... after all if I were doing
something with math, I would probably open a spreadsheet.
 
R

rf

nobody said:
Greetings. I want to put a bunch of equations with right justified
numbers on the same line as the equation

Like in a maths text book?

..math {text-align: right;}
..math span {float: left;}

<div class="math"><span>P = B + C </span>[3]</div>
 
N

nobody

nobody wrote:
Like in a maths text book?

.math {text-align: right;}
.math span {float: left;}

<div class="math"><span>P = B + C </span>[3]</div>

That's it! Thank you. I was trying instead to float the eq. number to
the right and it was going on the next line.
 
T

Toby Inkster

Adrienne said:
Is there a reason why tables wouldn't work... after all if I were doing
something with math, I would probably open a spreadsheet.

That's only because you don't have a proper maths package. (Mathematica,
Maple, et al.)
 
J

Jukka K. Korpela

nobody said:
Like in a maths text book?

.math {text-align: right;}
.math span {float: left;}

<div class="math"><span>P = B + C </span>[3]</div>

That's it!

Well, not quite. What happens if the equation itself gets divided into
two or more lines?
I was trying instead to float the eq. number to
the right and it was going on the next line.

The problem with that is that floating makes an element a block
element. If you put the equation number before the equation in markup,
you could make it float to right the intended way - but only when the
equation fits onto one line. Dealing with potentially multi-line
equations makes things tricky. Positioning is one approach but then you
have problems with old browsers like IE - they don't do positioning
well in other than fairly simple cases.

So a table _is_ the practical solution, and not necessarily illogical:

<table class="eq" summary="Equation and its number." width="100%">
<tr>
<td>the equation</td>
<th align="right" valign="bottom">(number)</th>
</tr>
</table>

I just wrote some additional notes on this:
http://www.cs.tut.fi/~jkorpela/math/#eqno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top