# [Rd] Writing lgrindefs

Uwe Ligges ligges@statistik.uni-dortmund.de
Thu, 27 Apr 2000 17:47:54 +0200

```> >> however, having all the functions defined in base highlighted as keywords.
> >> Would that be a good idea, and if it is, how can I extract the function
> >> names most easily?
> >
> >1. You get a list of objects (not only functions!!!) by typing
> >    ls(env=environment("R_GlobalEnv"))
> >
> >2. In the html-help files, e.g. the "Functions" index could help you.
> >   Attention: Not only functions are listed here!
>
> Yeah, that's the problem with both of those, that it doesn't only contain
> functions.
>
> >3. For my R-WinEdt "package", I extracted names of functions of many R
> >packages.
> >   If you want, I will send some files.
>
> Oh, I thought about it, but then I figured for this to work consistently,
> every user would have to generate his own defs, depending on what packages
> he has installed, which would be a bit bothersome I guess.

OK. Fritz has got it! And I feel stupid...

After thinking:
Only functions of the base package are not enough for some users,
on the other hand you will never be up to date with names of all
functions of all packages, I suppose.
Of course TeX cannot know names of R functions, if they are not
specified explicitly.

Suggestions:
1)
Another way is to write a R function, that generates "nice" TeX code.
Or a R function, that generates code to be interpreted by a TeX macro.
user specific functions, other objects in the users environment (as
needed).

2)
Providing names of functions of the most used packages (e.g. base,
ctest, ts, ...) would be enough, if the user could easily extend the
list of "known" functions (or other objects).
I think about a TeX command (defined in your macro), that could be used
as follows: