[petsc-dev] Manual figures are messed up

Barry Smith bsmith at mcs.anl.gov
Wed Oct 7 17:54:13 CDT 2015

> On Sep 30, 2015, at 7:46 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
> I just noticed that Figures 19 and 20 in the manual (current release and master) are messed up. The htmlmap process seems not to work properly.

The tool /bin/maint/mapnameslatex.py is what looks through the tokens in the .tex files and replaces PETSc functions etc with an href. Unfortunately it is simple minded. It should turn off replacement when it detects a \begin{verbatim} and turn it back on when it hits the \end{verbatim} here is the entire engine

    while 1:
        token = lex.token()       # Get a token
        if not token: break        # No more tokens
	if token.type == 'NEWLINE':
	    print text
	    text = ''
            # \href cannot be used in many places in Latex
	    if token.value in ['\\href{','\\findex{','\\sindex{','\\subsection{','\\chapter{','\\section{','\\caption{','\\trl{']:
		bracket = bracket + 1;
            if bracket == 0:
		value = token.value
		if mappedstring.has_key(value):
                    mvalue = mappedstring[value].replace('_','\\_')
		    value = '\\href{'+'http://www.mcs.anl.gov/petsc/petsc-'+version+'/docs/'+mappedlink[value]+'}{'+mvalue+'}\\findex{'+value+'}'
		value = token.value
	    if token.value[0] == '}' and bracket:
		bracket = bracket - 1;
	    text = text+value

You want to take a crack at fixing it? Because I don't really feel like it :-(


> -- 
> Stefano

More information about the petsc-dev mailing list