Textoidl/
translate_sub_super.pro
Return the proper IDL font positioning command for TeX
sub/superscripts.
Routine summary
- result = sub_sup_idl(token, FORCE_UD=FORCE_UD)
-
-
- result = translate_sub_super(InputString, RECURSED=RECURSED, HELP=HELP)
-
- NAME: TRANSLATE_SUB_SUPER PURPOSE: Translate TeX sub/superscripts to IDL sub/superscripts.
sub_sup_idl
Text, String
result = sub_sup_idl(token, FORCE_UD=FORCE_UD)
Return value
Either '!U' or !E' for superscripts, or '!D' or '!I' for subscripts.
Parameters
token
Either '^' or '_', the TeX super/subscript characters
Keywords
FORCE_UD
Set this to use !U/!D instead of !E/!I for sub/superscripts.
Examples
Version history
Version
$Id: translate_sub_super.pro 327 2007-12-13 16:22:35Z pinsard $
History
$Log: translate_sub_super.pro,v $
Revision 1.5 2000/06/14 19:09:22 mcraig
Changed name of strtok str_token to avoid conflict in IDL 5.3.
Revision 1.4 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.3 1996/05/09 00:22:17 mcraig
Changed some function calls to reflect changes in those functions, moved
some code out of the main loop that didn't need to be there, added
documentation.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
Known issues
Restrictions
Make sure sub_sup_idl stays before translate_sub_super. At least
for now, when IDL encounters a function and automatically compiles
it, it only compiles the functions in the file up to the named
function. So even if sub_sup_idl was declared with
FORWARD_FUNCTION in translate_sub_super, it would not properly
compile.
The file translate_sub_super.pro contains two functions,
translate_sub_super, and sub_sup_idl. The former is the
generic routine for processing TeX sub/superscripts, the
latter is used only by translate_sub_super and has no general
utility. Hence it lives here. You will see documentation for
translate_sub_super second if you use DOC_LIBRARY.
Used only by translate_sub_super. Should be kept in same
file.
Other attributes
Uses routines
translate_sub_super
result = translate_sub_super(InputString, RECURSED=RECURSED, HELP=HELP)
NAME:
TRANSLATE_SUB_SUPER
PURPOSE:
Translate TeX sub/superscripts to IDL sub/superscripts.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = translate_sub_super( old )
INPUTS:
old -- string to be translated from TeX to IDL. in
KEYWORD PARAMETERS:
/RECURSED -- set if this function is being called
recursively.
/HELP -- Set to print useful message and exit.
OUTPUTS:
new -- string old converted from TeX to IDL out
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- For best results, when both a sub and superscript are used,
place the shorter of the two first (e.g. 'N^{a}_{bbbb}' is
better than 'N_{bbbb}^{a}').
- Single character sub/super scripts do not need to be
protected by braces.
- Sub/superscripts may be nested (e.g. 'N^{N_1^N}').
EXAMPLE:
out = translate_sub_super( 'N^2_{big}' )
Then out='N!U2!N!Dbig!N' which looks like it should on the
display.
LIBRARY FUNCTIONS CALLED:
str_token -- Text/string (mcraig)
sub_sup_idl -- contained in this file
MODIFICATION HISTORY:
$Id: translate_sub_super.pro 327 2007-12-13 16:22:35Z pinsard $
$Log: translate_sub_super.pro,v $
Revision 1.5 2000/06/14 19:09:22 mcraig
Changed name of strtok str_token to avoid conflict in IDL 5.3.
Revision 1.4 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.3 1996/05/09 00:22:17 mcraig
Changed some function calls to reflect changes in those functions, moved
some code out of the main loop that didn't need to be there, added
documentation.
Revision 1.2 1996/02/08 18:54:20 mcraig
Changed default sub/superscript size to be !D/!U rather than !I/!E to
improve readability of plat annotations.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: Rel_2_1_2 $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.
Parameters
InputString
Keywords
RECURSED
HELP
Produced by IDLdoc 2.0.