Math & Scienceannuity symbol problems

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
omglatex
Posts: 4
Joined: Sat Jun 13, 2009 8:57 pm

annuity symbol problems

Post by omglatex »

Code: Select all

   1. \documentclass[a4paper,12pt]{article}
   2. \usepackage{amsmath}
   3.

   4. \newcommand\annu[2][]{\ensuremath{_{%
   5. \def\arraystretch{0}%
   6. \setlength\arraycolsep{1pt}% adjust these
   7. \setlength\arrayrulewidth{.2pt}% two settings
   8. \scriptstyle{#1} \begin{array}{@{}c|}\hline
   9. \\[\arraycolsep] %
  10. \scriptstyle{#2} %
  11. \end{array}%
  12. }}}
  13.

  14.


  15. \begin{document}
  16.

  17. \[
  18. \overline{A}\annu[ 53: ]{10}^{1} \quad \overline{A}\annu[xxx:]{n}^1
  19. \]
  20.

  21. \end{document}
Expected:
aim for this
aim for this
aim.jpg (48.67 KiB) Viewed 7894 times
current output:
current
current
now.jpg (15.28 KiB) Viewed 7894 times

Problems:
1- numbers are not on the same horizon

2- superscript is not exactly over the "1st" item

3- i dont know how to add "[]" to the 1st input

can someone kindly modify the code for me please?

Thanks in advance!

LateXer

Recommended reading 2024:

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

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

stanlio
Posts: 4
Joined: Thu Jun 11, 2009 2:39 am

annuity symbol problems

Post by stanlio »

At least the last two problems I know how to deal with, if perhaps not cleanly.
I'm no TeX expert, so there might have been a better way--it necessitates making
the superscript into another argument, although this can be empty.

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{ifthen}

\newcommand\annu[3][]{% HAX
\newdimen\annutempA\setbox0=\hbox{\ensuremath{\scriptstyle{\left[#1\right]}}}\annutempA=\wd0
\newdimen\annutempB\setbox0=\hbox{\ensuremath{^{#3}}}\annutempB=\wd0
\addtolength{\annutempA}{-\annutempB}\ensuremath{_{%
\def\arraystretch{0}%
\setlength\arraycolsep{1pt}% I don't feel like adjusting these
\setlength\arrayrulewidth{.2pt}% two settings
\ifthenelse{\equal{#1}{}}{}{\scriptstyle{\left[#1\right]:}}
\begin{array}{@{}c|}\hline
\\[\arraycolsep] %
 \scriptstyle{#2} %
\end{array}}}^{\ifthenelse{\lengthtest{\annutempA > 0.0pt}}{\hspace{0.5\annutempA}}{}#3}}

\begin{document}

\[
\overline{A}\annu[53]{10}{1} \quad \overline{A}\annu[xxx]{n}{1} \quad
\overline{A}\annu{10}{1} \quad \overline{A}\annu[54]{10}{12345} \quad
\]

\end{document}
stanlio
Posts: 4
Joined: Thu Jun 11, 2009 2:39 am

annuity symbol problems

Post by stanlio »

http://maths.dur.ac.uk/stats/courses/AMII/lifecon.sty
If you want it in your style, then:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{lifecon}

\newcommand\annu[3][]{
\newdimen\annutempA\setbox0=\hbox{\ensuremath{_{\scriptstyle{\left[#1\right]}}}}\annutempA=\wd0
\newdimen\annutempB\setbox0=\hbox{\ensuremath{^{#3}}}\annutempB=\wd0
\addtolength{\annutempA}{-\annutempB}\ensuremath{_{
\ifthenelse{\equal{#1}{}}{}{\scriptstyle{\left[#1\right]:}}\lcroof{#2}
}}^{\ifthenelse{\lengthtest{\annutempA > 0.0pt}}{\hspace{0.5\annutempA}}{}#3}}

\begin{document}

\[
\overline{A}\annu[53]{10}{1} \quad \overline{A}\annu[xxx]{n}{1} \quad
\overline{A}\annu{10}{1} \quad \overline{A}\annu[54]{10}{12345} \quad
\overline{A}\annu[55]{11}{}
\]

\end{document}
omglatex
Posts: 4
Joined: Sat Jun 13, 2009 8:57 pm

annuity symbol problems

Post by omglatex »

stanlio wrote:http://maths.dur.ac.uk/stats/courses/AMII/lifecon.sty
If you want it in your style, then:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{ifthen}
\usepackage{lifecon}

\newcommand\annu[3][]{
\newdimen\annutempA\setbox0=\hbox{\ensuremath{_{\scriptstyle{\left[#1\right]}}}}\annutempA=\wd0
\newdimen\annutempB\setbox0=\hbox{\ensuremath{^{#3}}}\annutempB=\wd0
\addtolength{\annutempA}{-\annutempB}\ensuremath{_{
\ifthenelse{\equal{#1}{}}{}{\scriptstyle{\left[#1\right]:}}\lcroof{#2}
}}^{\ifthenelse{\lengthtest{\annutempA > 0.0pt}}{\hspace{0.5\annutempA}}{}#3}}

\begin{document}

\[
\overline{A}\annu[53]{10}{1} \quad \overline{A}\annu[xxx]{n}{1} \quad
\overline{A}\annu{10}{1} \quad \overline{A}\annu[54]{10}{12345} \quad
\overline{A}\annu[55]{11}{}
\]

\end{document}

First of all, I have to confess that I am so forgetfull that I got the lifecon.sty last year when I was trying yo type something not so complicated. Then I just ignored that and didnt read the manual at all unitl this minute that you brought it up again.

Yes, indeed that the lifecon.sty from durham university is very helpful and contains FULL symbols that I will need.

Thanks!

Latex Fans
omglatex
Posts: 4
Joined: Sat Jun 13, 2009 8:57 pm

annuity symbol problems

Post by omglatex »

stanlio wrote:At least the last two problems I know how to deal with, if perhaps not cleanly.
I'm no TeX expert, so there might have been a better way--it necessitates making
the superscript into another argument, although this can be empty.

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{ifthen}

\newcommand\annu[3][]{% HAX
\newdimen\annutempA\setbox0=\hbox{\ensuremath{\scriptstyle{\left[#1\right]}}}\annutempA=\wd0
\newdimen\annutempB\setbox0=\hbox{\ensuremath{^{#3}}}\annutempB=\wd0
\addtolength{\annutempA}{-\annutempB}\ensuremath{_{%
\def\arraystretch{0}%
\setlength\arraycolsep{1pt}% I don't feel like adjusting these
\setlength\arrayrulewidth{.2pt}% two settings
\ifthenelse{\equal{#1}{}}{}{\scriptstyle{\left[#1\right]:}}
\begin{array}{@{}c|}\hline
\\[\arraycolsep] %
 \scriptstyle{#2} %
\end{array}}}^{\ifthenelse{\lengthtest{\annutempA > 0.0pt}}{\hspace{0.5\annutempA}}{}#3}}

\begin{document}

\[
\overline{A}\annu[53]{10}{1} \quad \overline{A}\annu[xxx]{n}{1} \quad
\overline{A}\annu{10}{1} \quad \overline{A}\annu[54]{10}{12345} \quad
\]

\end{document}
though it didnt work perfectly
and it still helps

Thank you as well!

Latex Fans
omglatex
Posts: 4
Joined: Sat Jun 13, 2009 8:57 pm

annuity symbol problems

Post by omglatex »

Hi there,

However,I do have a problem now.

\lcroof{#2}

I just wonder how I can change the width of the horizontal line in the "angle" symbol?

it's a bit thicker than the vertical line
%\DeclareRobustCommand{\lcroof}[1]{%
%\def\arraystretch{0}%
%\setlength\arraycolsep{1pt}% adjust these
%\setlength\arrayrulewidth{.3pt}% two settings
%\begin{array}{@{}c|}\hline
%\\[\arraycolsep]%
%\scriptstyle #1%
%\end{array}%
%}

i tried to adjust this in the lifecon.sty
but i dont know how wide is that hline





annuity-new.jpg
annuity-new.jpg (42.15 KiB) Viewed 7877 times
cperrin
Posts: 1
Joined: Wed Jul 15, 2009 9:21 pm

annuity symbol problems

Post by cperrin »

I am working on a LaTeX project in which I need a weird new symbol called a 'mark'
or 'cross'. I'm using a modified version of the \annu symbol. Here is an example
Example from http://en.wikipedia.org/wiki/Laws_of_Form to see how the Cross symbol looks and<br />how it is used (hit the link for section 5.5.2 Sentential logic).
Example from http://en.wikipedia.org/wiki/Laws_of_Form to see how the Cross symbol looks and
how it is used (hit the link for section 5.5.2 Sentential logic).
BrownWiki.JPG (23.41 KiB) Viewed 7818 times
This is what I came up with by modifying the \annu code:
%G. Spencer-Brown's 'Mark' or 'Cross' symbol
%Modified from \annu, p95, http://www.ctan.org/tex-archive/info/sy ... ols-a4.pdf
%with Array environment

\DeclareRobustCommand{\cross}[1]{%
\def\arraystretch{0}%
\setlength\arraycolsep{3pt}%
\setlength\arrayrulewidth{.4pt}
\begin{array}{@{}c|}\hline\\
[\arraycolsep]%
#1
\end{array}
}


with the following results:

Results.JPG
Results.JPG (35.71 KiB) Viewed 7818 times
Problems:
1) The symbol needs to maintain its size when empty
2) Should be able to space it properly from definition (I added \, in the example)
3) Should maintain a constant height with lowercase content
Post Reply