Command/readfile

From Wiki
Jump to navigation Jump to search


\readfile

Summary

The command \readfile is used for including an external file

Settings

\readfile{...}{...}{...}
{...}file
{...}true
{...}false

OptionExplanation
true ConTeXt code that is included before the inclusion, when the file is found
false ConTeXt code that is executed when the file is not found

Description

The command \readfile {filename}{true code}{false code} is replaced by the content of the text file filename, if it exists. The {true code} is processed before actual inclusion happens. If filename does not exist, the {false code} is processed.

When no file extension is specified, the extension .tex is assumed.

Similar to the case with project structure commands such as \environment, \readfile causes ConTeXt to look in ancestor directories for the specified file.

During execution of the {true code}, the actual found file name is stored in \readfilename.


Examples

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: