Am 30.06.2012 18:17, schrieb Vincent van Ravesteijn:

That would imply that the delimiters are different. But the aim was only to 
support single '\' as
arguments of \verb as in other cases single '\' are not allowed and could break 
the compilation.
I wanted to skip cases like
[\}
because this is in any case invalid LaTeX code.
Perhaps I should add a comment.

The fundamental issue is that you should not change the implementation of a 
method just to implement
a special case of its use.

But it is a special case. Only \verb is allowed to contain a single '\'. No other LaTeX command can have this.

How would your code treat "{\{}" and "{\}}" when left='{' and right='}' ?

Works correctly; you can check with these examples:

\verb{\}{
\verb{\{
and
\test{\{}
\test{\}}
and
\test|\{|
\test|\}|

Verb is such an exceptional case that it might deserve its own function in 
which this exception is
made instead of adding more if-clauses. Verb is special in that it treats the 
backslash as a normal
character; outside verb this exception should not be active. So it doesn't make 
sense to activate
this exception just based on the fact whether left == right. Who says we're 
parsing a verb command
at the moment... just because at the moment the only case where left==right is 
when we're parsing a
verb command. This is wrong.

But my code will only be accessed for \verb: I allow a single '\' only when left==right and when it is the only character within the delimiters. So take for example this:
\test|\{|

As only \verb can contain a single \, there is always a second character behind a \. So my code is not used.

Take now this example:
\test|\|

This is invalid LateX code as there is no closing delimiter (the \ escapes it). texl2yx will allow this, but the user is responsible for this code and if he writes wrong LaTeX, we cannot do much.

I have put my new patch in. Please test. I might have overseen a case buut no example comes into my mind that would fail. If you have one, please tell me.

thanks and regards
Uwe

Reply via email to