at first there etex missing before , some_position . Everything between btex and etex taken as a string. This is not interpreted. To do this, the contents of the string must first be calculated by TEX() . Example:
prologues := 2; input tex; verbatimtex \documentclass[12pt,a4paper]{article} \usepackage[T1]{fontenc} \usepackage[ansinew]{inputenc} etex; beginfig(0); n := 10; for i := 1 upto n: label.lrt(TEX("$i = "&decimal(i)&"$"),(0,i*1cm)); endfor; endfig;
If you want to use LaTeX-Struktures, you need to modify the original TEX () as follows:
vardef TEX primary s = write "verbatimtex" to "mptextmp.mp"; write "\documentclass[12pt]{article}" to "mptextmp.mp"; write "\usepackage[T1]{fontenc}" to "mptextmp.mp"; write "\usepackage[ansinew]{inputenc}" to "mptextmp.mp"; write "\usepackage{amsmath,amssymb}" to "mptextmp.mp"; write "\begin{document}" to "mptextmp.mp"; write "etex" to "mptextmp.mp"; write "btex "&s&" etex" to "mptextmp.mp"; write EOF to "mptextmp.mp"; scantokens "input mptextmp" enddef;
Hope that helps
V. Tue
source share