Discussion:
Aligning number in tables at decimal point
fuellerer
2006-11-03 10:08:40 UTC
Permalink
I am using the dcolumn package for aligning numbers in tables at their
decimal points which works fine. However I would like to print
negative numbers bold. When I use textbf the dcolumn package does not
find the decimal point and so the aligning collapses. \bf only makes
the first number bold. Any ides how to resolve this problem?





Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:TeXnicCenter-Users-digest-***@public.gmane.org
mailto:TeXnicCenter-Users-fullfeatured-***@public.gmane.org

<*> To unsubscribe from this group, send an email to:
TeXnicCenter-Users-unsubscribe-***@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Kristof Möller
2006-11-03 11:08:41 UTC
Permalink
Quick and dirty:

\documentclass{article}
\usepackage{dcolumn}
\newcommand{\bfneg}[2]{-\mathbf#1.\mathbf#2}
\newcolumntype{d}[1]{D{.}{\cdot}{#1}}
\begin{document}
\begin{tabular}{d{-1} d{2} d{1}}
\bfneg{1}{2} & 1.2 & 1.3 \\
1.54 & 1.24 & 12.5
\end{tabular}
\end{document}

Greetings
Kris
Post by fuellerer
I am using the dcolumn package for aligning numbers in tables at their
decimal points which works fine. However I would like to print
negative numbers bold. When I use textbf the dcolumn package does not
find the decimal point and so the aligning collapses. \bf only makes
the first number bold. Any ides how to resolve this problem?
Kristof Möller
2006-11-03 12:06:34 UTC
Permalink
Sorry,

it was really quick and dirty ;-)

...this one works fine (even with more decimal places):

\documentclass{article}
\usepackage{dcolumn}
\newcommand{\bfneg}[2]{-\mathbf{#1}.\mathbf{#2}}
\newcolumntype{d}[1]{D{.}{\mathbf\cdot}{#1}}
\begin{document}
\begin{tabular}{d{-1} d{2} d{1}}
\bfneg{1}{233} & \bfneg{1}{233} & \bfneg{1}{3334} \\
1.54 & 1.24 & 12.5
\end{tabular}
\end{document}

Greetings
Kris
Post by fuellerer
I am using the dcolumn package for aligning numbers in tables at their
decimal points which works fine. However I would like to print
negative numbers bold. When I use textbf the dcolumn package does not
find the decimal point and so the aligning collapses. \bf only makes
the first number bold. Any ides how to resolve this problem?
Kristof Möller
2006-11-03 12:13:39 UTC
Permalink
Time for weekend...

I'm sorry - it's more tricky - {...} won't work here...

Have to think about it...

Greetings
Kris
Post by fuellerer
I am using the dcolumn package for aligning numbers in tables at their
decimal points which works fine. However I would like to print
negative numbers bold. When I use textbf the dcolumn package does not
find the decimal point and so the aligning collapses. \bf only makes
the first number bold. Any ides how to resolve this problem?
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:TeXnicCenter-Users-digest-***@public.gmane.org
mailto:TeXnicCenter-Users-fullfeatured-***@public.gmane.org

<*> To unsubscribe from this group, send an email to:
TeXnicCenter-Users-unsubscribe-***@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Yannick
2006-11-03 18:26:52 UTC
Permalink
Hi,
did you try to make a table like this?
\begin{tabular}{l@{.}r}
123 & 45\\
3 & 0\\
0 & 005\\
\end{tabular}
?
It schould the look like this:
123.5
3.0
0.005

like this, you have two columns separated by a decimal dot. Since both
entries (before and after the point) are in different columns, it
shouldn't be a problem to print them in boldface.
However, the decimal point won't be in boldface. I hope it's what you want,

Yannick




Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/TeXnicCenter-Users/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:TeXnicCenter-Users-digest-***@public.gmane.org
mailto:TeXnicCenter-Users-fullfeatured-***@public.gmane.org

<*> To unsubscribe from this group, send an email to:
TeXnicCenter-Users-unsubscribe-***@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Kristof Möller
2006-11-09 12:08:32 UTC
Permalink
Hi again...

this example is now working fine, and can be adjusted to Your needs
(e.g. different seperation symbols, here the german version):

\documentclass{article}
\usepackage{dcolumn}
%
\newcommand{\bfneg}[2]{-\mathbf{#1}.\mathbf{#2}}
%
\newcolumntype{d}[1]{D{.}{,}{#1}}
%
\begin{document}
\begin{tabular}{|d{-1}|d{2}|d{1}|}
\bfneg{1}{233} & \bfneg{12}{23} & \bfneg{1}{3} \\
1.54 & 1.24 & 12.5 \\
\end{tabular}
\end{document}

But, be sure the decimal places fit with the number in d{...} - e.g.
d{2} assigns
two decimal places for the column-width - this was the mistake in my
last example!

Greetings
Kris
Post by fuellerer
I am using the dcolumn package for aligning numbers in tables at their
decimal points which works fine. However I would like to print
negative numbers bold. When I use textbf the dcolumn package does not
find the decimal point and so the aligning collapses. \bf only makes
the first number bold. Any ides how to resolve this problem?
Loading...