Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/tex/tpic/libtex/text.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "tex.h"
text(s)
char	*s;
{
	register char *p;
	int centered, right, newline, more;
	double y;

	while(1){
	centered = right = newline = more = tweek = 0;
	for(p=s; *p != '\0'; p++){
		if(*p == '\\'){
			switch(*(++p)){
			case 'C': centered++;
				s = p+1;
				continue;
			case 'R': right++;
				s = p+1;
				continue;
			case 'n': newline++;
				*(p-1) = '\0';
				if(*(p+1) != '\0')more++;
				goto output;
			case 'L': s=p+1;
				continue;
			}
		}
	}
output:
	*p = '\0';
	fprintf(TEXFILE,"    \\rlap{\\kern %6.3fin\\lower%6.3fin\\hbox to 0pt{",
			INCHES(SCX(e1->copyx)), INCHES(e1->copyy));
	fprintf(TEXFILE,centered?"\\hss%s\\hss":(right?"\\hss%s":"%s\\hss"),s);
	if(newline){
		y = TRY(e1->copyy) ;
		y -= (e1->psize+2) / 72.27;
		e1->copyy = (y - e1->bottom)/e1->scaley + e1->ymin;
	}
	if(!more)break;
	s = p+1;
	}
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.