I faced the issue of having to remove sections from a maple document in order to export to a pdf without the indentation and lines that come when you export documents with sections. Here is small tool I wrote that removes all sections in a maple document. It takes a target file as the first argument and writes that file without sections to the destination file specified as the second argument.

RemoveSection := module()
    local ModuleApply := proc(target, destination)
        XMLTools:-WriteFile(destination, subsindets(XMLTools:-ReadFile(target), ':-specfunc'(_XML_Section), section_handler));
    end proc;
    local section_handler := proc(s)
        local partresult := remove(type,[op(s)],`=`);
        return op(subsindets(partresult, ':-specfunc'(_XML_Title), f -> `_XML_Presentation-Block`("",_XML_Group("view"="presentation","inline-output"="false",    
    end proc;
end module:

#RemoveSection takes two arguments the first is the target file and the second is the destination file where the target file will be written without sections



Download RemoveSection.mw


Please Wait...