Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The answer of the following problem is given in Ulrikes Comment. Thank you very much!

I am trying to use external data for similar documents I have to write. The number of these data varies so I would like to use whildo or forloop, but both tools create too big spaces between the single data sets.

Thank you

Trillan

Here is a short example:

\documentclass[a4paper,10pt]{scrartcl}

\usepackage{ifthen}
\usepackage{arrayjob}
\usepackage{forloop}

%opening
\newarray\Test
\readarray{Test}{%
   Eintrag 1&%
   Eintrag 2&%
   Eintrag 3&%
   Eintrag 4
}%

\begin{document}

Normal Space:

\Test(2) \Test(3) \Test(4) \Test(1)

\newcounter{i}
\setcounter{i}{1}

Big Space mit whiledo:
\whiledo {\value{i}  <  5}{%
   \Test(\value{i})%
   \stepcounter{i}
}%

A little bit better with forloop:

\forLoop[1]{1}{4}{i}{%
  \Test(\value{i})%
}

Without value everthing is working fine:

\setcounter{i}{1}
\whiledo {\value{i}  <  5}{%
   \Test(3) %
   \stepcounter{i}%
}%

\end{document} 
share|improve this question
2  
Use \Test(\the\value{i}). \value alone works only in some specific locations. See tex.stackexchange.com/questions/21561/…. –  Ulrike Fischer Aug 5 '13 at 8:56
    
That was the problem! Thanx Trillan –  trillan Aug 5 '13 at 9:19
    
@UlrikeFischer An answer? –  egreg Dec 7 '13 at 22:35

1 Answer 1

Use \Test(\the\value{i}). \value alone works only in some specific locations. See What is the proper method of accessing a counter?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.