Ideally, I'd like to have a way to type
\tally{12}
and get the equivalent tally, two groups of 5, followed by //
-Michael
--
Michael Friendly Email: frie...@yorku.ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
> How can one print in LaTeX the tally symbols
> (/, //, ///, ////, cant do 5 on a keyboard, but it has a diagonal stroke
> thru the ////)
> often used manually to count occurrences of things?
Look at the symbollist
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=symbols
Ulrike Fischer
For the record, thanks to Ulrike (should have known to look there
first), I found these symbols in the ifsym package,
\usepackage[misc]{ifsym}
then I can say \StrokeFive\StrokeFive\StrokeTwo to get the tally symbol
for 12.
I'd like to use this more easily, to say \tally{12} to get the same
result, but I think this goes beyond my TeXnical expertise.
> then I can say \StrokeFive\StrokeFive\StrokeTwo to get the tally symbol
> for 12.
> I'd like to use this more easily, to say \tally{12} to get the same
> result, but I think this goes beyond my TeXnical expertise.
\def\tally#1{{\count0=#1\loop\ifcase\count0\or\StrokeOne\or\StrokeTwo
\or\StrokeThree\or\StrokeFour\else\StrokeFive\fi
\advance\count0by-5 \ifnum\count0>0\repeat}}
Someone a bit more TeXnical can propose some improvements.
--
Brian Blackmore
blb8 at po dot cwru dot edu
Here's a version which goes without the brackets. Throw away the
\Stroke... definitions if you use ifsym package (I don't have ifsym
installed):
\documentclass{article}
%\usepackage[misc]{ifsym}
\newcommand{\StrokeOne}{I}
\newcommand{\StrokeTwo}{II}
\newcommand{\StrokeThree}{III}
\newcommand{\StrokeFour}{IIII}
\newcommand{\StrokeFive}{\rlap{\raise1ex\hbox{\underline{%
\hphantom{\StrokeFour}}}}\StrokeFour}
\newcount\tallycount
\newcommand{\dotally}{%
\loop\ifnum\tallycount>4\relax\StrokeFive\
\advance\tallycount by-5\repeat
\ifcase\tallycount\or\StrokeOne\or\StrokeTwo\or
\StrokeThree\or\Strokefour\else ERROR\fi\unskip}
\newcommand{\tally}{\afterassignment\dotally\tallycount }
\begin{document}
Zero: \tally 0.
Two: \tally 2.
Twelve: \tally12.
Hundred: \tally100.
\end{document}
Greetings Hartmut
--
Hartmut Henkel, Oftersheim, Germany
I don't know how to program in TeX, but I do know some LaTeX. Here is
a version of the tally{} macro you requested using only features
documented in Lamport:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tallyho.tex
% Peter S. Simon
% 9 September 2003
\documentclass[12pt]{article}
\usepackage[misc]{ifsym}
\usepackage{ifthen}
%% Define \tally{#1} command where #1 is a number. The macro then
%% typesets the appropriate number of tally marks from the ifsym
%% package. Also requires the ifthen package, documented in Lamport.
\newcounter{strokecount}
\newcommand{\tally}[1]{\setcounter{strokecount}{#1}%
\whiledo{\value{strokecount}>5}%
{\addtocounter{strokecount}{-5}\StrokeFive}%
\ifthenelse{\value{strokecount}=5}{\StrokeFive}{}%
\ifthenelse{\value{strokecount}=4}{\StrokeFour}{}%
\ifthenelse{\value{strokecount}=3}{\StrokeThree}{}%
\ifthenelse{\value{strokecount}=2}{\StrokeTwo}{}%
\ifthenelse{\value{strokecount}=1}{\StrokeOne}{}}
\begin{document}
%% Test out the \tally macro in a loop from 1 to 29:
\newcounter{mycounter}
\setcounter{mycounter}{1}
\whiledo{\value{mycounter}<30}%
{\tally{\value{mycounter}} is \arabic{mycounter}.
\par\addtocounter{mycounter}{1}}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%