NumberedList = [[ 1 M1 2 M2a 3 M2b 4 M2c 5 M3 6 M4a 7 M4b 8 M4c 9 M5 10 M6 11 M7 12 M8a 13 M8b 14 M8c 15 M8d 16 M8e 17 M8f 18 M9 19 M10 20 M11 21 M12 22 M13 23 M14a 24 M14b 25 M14c 26 M15a 27 M15b 28 M16a 29 M16b 30 M17 31 M18a 32 M18b 33 M19 34 M20 35 M21a 36 M21b 37 M21c 38 M21d 39 M21e 40 M21f 41 M22a 42 M22b 43 M23a 44 M23b 45 M24 46 M25 47 M26 48 M27a 49 M27b 50 M28 51 M29 52 M30 53 M31 54 M32 55 M33a 56 M33b 57 M33c 58 M34a 59 M34b 60 M35 61 M36 62 M37a 63 M37b 64 M38 65 M39a 66 M39b 67 M40 68 M41a 69 M41b 70 M41c 71 M42 72 M43 73 M44 74 M45 75 M46 76 M47 77 M48 78 M49 ]] spectral = getf("y") -- spectroscopic parameters along the y dimension -- spectral.size contains the number of rows in our spectrum -- we must be sure that spectral.size = 78 = no. of labels into the table -- up to now we have simply declared a long string conaining the oredered labels and their -- corresponding indeces; now we'll put the labels into their own table Label = {} -- our table is empty, initially start = 1 for i = 1,spectral.size do pos, endline = string.find( NumberedList, tostring(i), start ) -- finds the index into the table endline = string.find( NumberedList, "\n", endline + 1 ) -- end of the line containing the index pos = endline + 1 -- beginning of the label endline = string.find( NumberedList, "\n", pos ) -- the character (end-of-line) after the label Label[i] = string.sub( NumberedList, pos, endline-1 ) -- label i stored into the table start = endline + 1 -- we'll start the next search from where the last one ended end -- the third part writes the label into the spectrum font( "Courier", 18 ) -- optional: sets the font and size step = - spectral.width / spectral.size -- decrement in ppm from row to row y = spectral.start + spectral.width + step / 2 -- y position, in ppm, for the first label x = 10.4 -- x position, in ppm for i = 1,spectral.size do text( Label[i], x, y, true ) -- we write an unicode label x = x - 0.5 -- this is optional: we skew the labels if x < 7.7 then x = 10.4 end -- into the range 7.7 .. 10.4 y = y + step -- this is necessary to have a single label per row end