AllenDowney / plastex-oreilly

Branch of plastex that generates DocBook 4.5 that meets O'Reilly style guidelines.
6 stars 7 forks source link

renewcommand has no effect #24

Closed AllenDowney closed 12 years ago

AllenDowney commented 12 years ago

To get Data Analysis to translate cleanly, I want to get rid of the \subparagraph commands, which yield improperly nested XML.

I thought I could do that with something like this:

\renewcommand{\subparagraph}[1]{\textbf{#1}\\}

But that has no effect; the subparagraphs get interpreted as if the \renewcommand did not exist.

But if I define

\newcommand{\mysubparagraph}[1]{\textbf{#1}\\}

and replace \subparagraph with \mysubparagraph, that works.

So the behavior of plasTeX does not seem to be consistent with the meaning of these commands in LaTeX.

tiarno commented 12 years ago

A subparagraph is a sectioning command that takes a single argument for its title. But the stuff underneath it belongs to it since it is a section. mysubparagraph is a command that bolds its argument but has no effect on sectioning.

I would think (guess) that subparagraph could be overridden: class subparagraph(Command): args = 'text' def invoke(self,tex): Command.invoke(self,tex)

then you can bold the text in the templates.

untested! --T

On Wed, Aug 15, 2012 at 3:28 PM, AllenDowney notifications@github.comwrote:

To get Data Analysis to translate cleanly, I want to get rid of the \subparagraph commands, which yield improperly nested XML.

I thought I could do that with something like this:

\renewcommand{\subparagraph}[1]{\textbf{#1}}

But that has no effect; the subparagraphs get interpreted as if the \renewcommand did not exist.

But if I define

\newcommand{\mysubparagraph}[1]{\textbf{#1}}

and replace \subparagraph with \mysubparagraph, that works.

So the behavior of plasTeX does not seem to be consistent with the meaning of these commands in LaTeX.

— Reply to this email directly or view it on GitHubhttps://github.com/AllenDowney/plastex-oreilly/issues/24.

AllenDowney commented 12 years ago

That explains it. Thanks!

But the fix did not work for me. I put this

class subparagraph(Command): 
    args = 'text' 
    def invoke(self,tex): 
        Command.invoke(self,tex) 

in localdefs.py, but I am still getting this

<sect5 id="a0000000022" remap="subparagraph">
</sect5>Accuracy<indexterm>

in the output.

tiarno commented 12 years ago

First I made the class class subparagraph(Base.Command): args = 'text'

and then I had to remove the old subparagraph template and put in a new one:

name:subparagraph

and it works for me.

On Wed, Aug 15, 2012 at 4:05 PM, AllenDowney notifications@github.comwrote:

That explains it. Thanks!

But the fix did not work for me. I put this

class subparagraph(Command): args = 'text' def invoke(self,tex): Command.invoke(self,tex)

in localdefs.py, but I am still getting this

Accuracy in the output. — Reply to this email directly or view it on GitHubhttps://github.com/AllenDowney/plastex-oreilly/issues/24#issuecomment-7767525.
AllenDowney commented 12 years ago

Got it. Will try it tomorrow.

Thanks again!

On Wed, Aug 15, 2012 at 5:48 PM, Tim Arnold notifications@github.comwrote:

First I made the class class subparagraph(Base.Command): args = 'text'

and then I had to remove the old subparagraph template and put in a new one:

name:subparagraph

and it works for me.

On Wed, Aug 15, 2012 at 4:05 PM, AllenDowney notifications@github.comwrote:

That explains it. Thanks!

But the fix did not work for me. I put this

class subparagraph(Command): args = 'text' def invoke(self,tex): Command.invoke(self,tex)

in localdefs.py, but I am still getting this

Accuracy in the output. — Reply to this email directly or view it on GitHub< https://github.com/AllenDowney/plastex-oreilly/issues/24#issuecomment-7767525>.

— Reply to this email directly or view it on GitHubhttps://github.com/AllenDowney/plastex-oreilly/issues/24#issuecomment-7770247.

AllenDowney commented 12 years ago

Fixed. Thanks, Tim!