Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1def latex(name): 

2 """Convert name to LaTeX""" 

3 s = '$' 

4 last = False 

5 for i in name: 

6 if i.isalpha(): 

7 if not last: 

8 s = s + r'\rm{' 

9 last = True 

10 elif last: 

11 s = s + '}' 

12 last = False 

13 s = s + i 

14 if i.isalpha(): 

15 s = s + '}' 

16 s = s.replace(' ', r'\ ') + '$' 

17 return s 

18 

19 

20def rest(name): 

21 """Convert name to reStructuredText.""" 

22 s = '' 

23 while name: 

24 c = name[0] 

25 if c == '_': 

26 s += r'\ :sub:`%s`\ ' % name[1] 

27 name = name[2:] 

28 elif c == '^': 

29 s += r'\ :sup:`%s`\ ' % name[1] 

30 name = name[2:] 

31 else: 

32 s += c 

33 name = name[1:] 

34 return s