Difference between revisions of "Custom Configuration"
m |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | < [[Installation hints]] | |
− | + | == Overview == | |
+ | |||
+ | This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at: | ||
+ | |||
+ | /opt/context | ||
== Default Variables == | == Default Variables == | ||
− | The file | + | The file <tt>/opt/context/tex/texmf/web2c/texmfcnf.lua</tt> contains a number of variables, including: |
− | + | TEXMFCACHE | |
− | + | TEXMFOS | |
− | + | TEXMFCONTEXT | |
− | Do not change this file as upgrading ConTeXt overwrites these files. | + | Do not change this file as upgrading ConTeXt overwrites these files. To customize <tt>texmf.cnf</tt>, change the variables as noted in the following section. |
== Custom Variables == | == Custom Variables == | ||
Line 17: | Line 21: | ||
Modify a variable as follows: | Modify a variable as follows: | ||
− | + | # Change to the location of <tt>setuptex</tt> (e.g., <tt>/opt/context/tex/</tt>). | |
− | + | # Create a new file called <tt>texmfcnf.lua</tt> (or <tt>texmf.cnf</tt>). | |
− | + | # Set only the required variables. | |
For example, to change the cache directory, use: | For example, to change the cache directory, use: | ||
− | + | return { | |
− | + | content = { | |
− | + | variables = { | |
− | + | TEXMFCACHE = "/var/cache/context/texmf-cache", | |
− | |||
}, | }, | ||
− | } | + | }, |
+ | } | ||
Save the file. | Save the file. | ||
− | The allowed locations for texmfcnf.lua are determined by the variable TEXMFCNF | + | The allowed locations for <tt>texmfcnf.lua</tt> are determined by the variable `TEXMFCNF` set in |
− | texk/kpathsea/texmf.cnf in luatex | + | <tt>texk/kpathsea/texmf.cnf</tt> in the LuaTeX source code. |
+ | |||
+ | Most options in <tt>texmf.cnf</tt> of modern TeX distributions also work with ConTeXt. | ||
+ | |||
+ | == Environment Variables == | ||
+ | |||
+ | By default, ConTeXt creates a directory named <tt>luatex-cache</tt> in the user's home directory. One way to change the cache location includes: | ||
+ | |||
+ | export TEXMFCACHE=/tmp | ||
+ | mtxrun --generate | ||
+ | context filename.tex | ||
+ | |||
+ | Another way is to run the <tt>context</tt> executable indirectly via <tt>mtxrun</tt>, as follows: | ||
+ | |||
+ | export TEXMFCACHE=/tmp | ||
+ | mtxrun --autogenerate --script mtx-context filename.tex | ||
+ | |||
+ | Running ConTeXt in either of these ways will create <tt>luatex-cache</tt> inside the <tt>/tmp</tt> directory, rather than the user's home directory. | ||
+ | |||
+ | == Security Concerns == | ||
+ | |||
+ | ConTeXt requires enabling the `write18` function to run [[MetaPost]] and other tools. This implies that malicious TeX code can run any program with user rights. The function is ''disabled'' by default. This can be enabled by changing the setting inside <tt>texmf.cnf</tt>: | ||
+ | |||
+ | shell_escape = t | ||
+ | |||
+ | For MikTeX users, the counterpart to <tt>texmf.cnf</tt> was <tt>miktex.ini</tt>, now the config is [http://docs.miktex.org/2.9/manual/runtimeparams.html stored separately for each program] | ||
+ | |||
+ | == File Priority == | ||
+ | |||
+ | The <tt>texmf.cnf</tt> files are read in the following order: | ||
+ | |||
+ | # /opt/context/bin/x86_64-linux/texmf.cnf | ||
+ | # /opt/context/bin/texmf.cnf | ||
+ | # /opt/context/texmf.cnf | ||
+ | # /opt/context/texmf/web2c/texmf.cnf | ||
+ | |||
+ | Variables set in a particular file are ''not'' overwritten by files that are read later. | ||
+ | |||
+ | The first configuration file listed is useful for system dependent configuration. On | ||
+ | multi-platform installations you could create a file <tt>/opt/context/bin/win32/texmf.cnf</tt> on the server that contains: | ||
+ | |||
+ | OSFONTDIR = $SystemRoot/Fonts | ||
+ | |||
+ | and this only affects Windows clients, even if the third file contains the line: | ||
+ | |||
+ | OSFONTDIR = /usr/share/fonts/ | ||
+ | |||
+ | [[Category:Installation]] |
Latest revision as of 21:17, 6 April 2021
Contents
Overview
This page describes how to configure and persist changes to default settings, including directory paths. For the purposes of this wiki page, it is assumed that ConTeXt is installed at:
/opt/context
Default Variables
The file /opt/context/tex/texmf/web2c/texmfcnf.lua contains a number of variables, including:
TEXMFCACHE TEXMFOS TEXMFCONTEXT
Do not change this file as upgrading ConTeXt overwrites these files. To customize texmf.cnf, change the variables as noted in the following section.
Custom Variables
Modify a variable as follows:
- Change to the location of setuptex (e.g., /opt/context/tex/).
- Create a new file called texmfcnf.lua (or texmf.cnf).
- Set only the required variables.
For example, to change the cache directory, use:
return { content = { variables = { TEXMFCACHE = "/var/cache/context/texmf-cache", }, }, }
Save the file.
The allowed locations for texmfcnf.lua are determined by the variable TEXMFCNF
set in
texk/kpathsea/texmf.cnf in the LuaTeX source code.
Most options in texmf.cnf of modern TeX distributions also work with ConTeXt.
Environment Variables
By default, ConTeXt creates a directory named luatex-cache in the user's home directory. One way to change the cache location includes:
export TEXMFCACHE=/tmp mtxrun --generate context filename.tex
Another way is to run the context executable indirectly via mtxrun, as follows:
export TEXMFCACHE=/tmp mtxrun --autogenerate --script mtx-context filename.tex
Running ConTeXt in either of these ways will create luatex-cache inside the /tmp directory, rather than the user's home directory.
Security Concerns
ConTeXt requires enabling the write18
function to run MetaPost and other tools. This implies that malicious TeX code can run any program with user rights. The function is disabled by default. This can be enabled by changing the setting inside texmf.cnf:
shell_escape = t
For MikTeX users, the counterpart to texmf.cnf was miktex.ini, now the config is stored separately for each program
File Priority
The texmf.cnf files are read in the following order:
- /opt/context/bin/x86_64-linux/texmf.cnf
- /opt/context/bin/texmf.cnf
- /opt/context/texmf.cnf
- /opt/context/texmf/web2c/texmf.cnf
Variables set in a particular file are not overwritten by files that are read later.
The first configuration file listed is useful for system dependent configuration. On multi-platform installations you could create a file /opt/context/bin/win32/texmf.cnf on the server that contains:
OSFONTDIR = $SystemRoot/Fonts
and this only affects Windows clients, even if the third file contains the line:
OSFONTDIR = /usr/share/fonts/