Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Second-line indentation in text of bibliography entries

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Second-line indentation in text of bibliography entries


Chronological Thread 
  • From: Henri Lesourd <address@hidden>
  • To: Andrew Cooper <address@hidden>
  • Cc: address@hidden
  • Subject: Re: [TeXmacs] Second-line indentation in text of bibliography entries
  • Date: Sun, 07 May 2006 20:02:45 +0200

Andrew Cooper wrote:

Henri Lesourd wrote:

That's interesting. Just writing a biblist + bibitem as you do there (without using the automatic generation), with the following markup:

[[
<\bib-list|[99]>
<bibitem*|X>aaa aaaaaaa aaaaa aaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaa\

<bibitem*|<margin-first-other|0mm|50mm|X>>aaa aaaaaaa aaaaa aaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaa
</bib-list>
]]

produces a biblist with two _identical_ entries. Note the deliberately exaggerated argument to margin-first-other (MFO), just to be certain the indent isn't getting 'lost' anywhere. Any values given to MFO make no difference.

Yes, of course. This is because somewhere inside all the embedded
submacros inside <bibitem*|...>, some other <margin-first-other|...>
exists. As a consequence of that, your :
[[
<bibitem*|<margin-first-other|0mm|{exaggerated value}mm|X>>
]]

is expanded as something of the shape :
[[
... <margin-first-other|0mm|{reasonable value}mm|
...<margin-first-other|0mm|{exaggerated value}mm|X>
> ...
]]

From above, it clearly follows that the more
outer <margin-first-other|0mm|{reasonable value}mm|...>
overrides <margin-first-other|0mm|{exaggerated value}mm|X>,
because this latter one is more embedded inside the
expanded expression.


Of course, let's say we give bibitem the argument "Squirrel":

<bibitem*|Squirrel>

This argument goes through the mill of subroutines boiling down to render-bibitem and produces:

[Squirrel] aaa aaaaaaa aaaaa aaaaaaa aaaaaaaaaaaa
>>>> aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaa
>>>> aaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaa
>>>> a aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaa

The text of the entry (aaaa etc.) is superficially indented with respect to the label "Squirrel" that results, but crucially _not_ with respect to the first character of the entry (i.e. the first 'a' in the above examples. So if you don't want a label like [Squirrel] in front of each entry (and I don't), and you get rid of it by changing:

<render-bibitem|<macro|x|[x]>>

to (keeping the empty macro for no good reason):

<render-bibitem|<macro|x|>>

Then bibitem's argument renders as a 'zero-length string':

aaa aaaaaaa aaaaa aaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaa
aaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaa
a aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaa

And the indentation doesn't happen. My contention is that margin-first-other isn't responsible for this indentation

Yes it is. Otherwise, when using <margin-first-other|...> instead
of redefining <render-bibitem|...> the way you do, one would obtain
an output similar to the one you give above. This is not what I
observe. Instead, on my machine, when inserting the following markup
chunk in a TeXmacs document :
[[
<margin-first-other|0mm|5mm|>aaa aa aaa a aa a a a aaaa
a aaaaa aaa aa aaa a aa a a a aaaaa aaa aa aaa a aa a a
aa a a a aaaaa aaa aa aaa a aa a a a aaaaa aaa aa a
]]

I obtain, as usual :
[[
aaa aa aaa a aa a a a aaaa a aaaaa aaa aa aaa a aa a
>>>> a aaaaa aaa aa aaa a aa a a a aaaaa aaa aa aaaa
>>>> aa a a a aaaaa aaa aa aaa a aa a a a aaa

]]

But it's true that something strange happens when one
redefines <render-bibitem|...> the way you did...


- it just happens 'anyway' provided the label is of finite length (i.e. exists). The fact that it appears to act on every entry is a consequence of the fact that every entry is rendered in the same way in this regard ( because it's a list, and this is how 'lists' work?).

No, this is not a consequence of the fact that it is a list. The
effect is purely local, due to the fact that <bibitem*|...> contains
a <margin-first-other|...> inside its expansion.


The question is, how do you do something to _each_ entry in the list?

This is why in my previous mail, I suggested to
redefine <bibitem*|...> _itself_.

This way you shunt completely the old code and start completely
from scratch, instead of having to reason in detail about how
a slight change to this old code operates.

On my machine, redefining <bibitem*|...> as :
[[
<assign|bibitem*|<macro|x|<margin-first-other|0mm|5mm|<arg|x>>>>
]]

Sets the indenting correctly, whether or not the parameter
of <bibitem*|...> is a void string or not. What remains to
be done is to improve this new version of <bibitem*|...> to
use a bold font, add the '[' & ']' symbols, etc.


therefore, if you change <bibitem*|...>, the effect of the change should
clearly have effect on all the items of the <bib-list|...>, just because
each item starts by <bibitem*|...> itself.


This sounds so obvious it's hard to see why it wouldn't be the case. Throw some text into the argument of bibitem and, as it passes through the subroutine mill, it duly appears in front of every entry. As the opening example demonstrates, MFO works on stuff beyond its closing bracket

This is the tricky thing with MFO, and it is due to the fact that it probably
changes some global variable used by the typesetting engine. Therefore, MFO
is not purely functional, and in effect, has consequences on stuff beyond
its closing bracket.


Instead, have a look at the following manually-created biblist:

[[
<\bib-list|[99]>
<bibitem*|X><margin-first-other|40mm|60mm|>aaa aaaaaaa aaaaa aaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaa\

<bibitem*|<margin-first-other|40mm|60mm|X>>aaa aaaaaaa aaaaa aaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaa
</bib-list>
]]

There is a distinct difference between these two entries. The position of MFO in the first clearly has an effect. In the second, it has no (useful) effect.

This is because of the overriding effect described in the beginning of this mail.


Let's consider a related question: how would you go about wrapping the text of each biblist entry into a routine that _required_ the text to be given as an argument, e.g. <with|colour|green|Some text>?

If you want the _whole_ text of each biblist entry be displayed in green,
then it is clearly not possible with the current way bibliography markup
is structured (or either, you would need to put the whole <bibliography|..>
markup inside the <with|color|green|...>).


Are you sure you performed the change I suggested on <bibitem*|...> itself,
and not on some of its (many) subroutines (i.e., <bibitem|...>, without
the '*', for example...) ?


I performed the change as you indicated (and many other ways besides). Anyway, still no progress.

Then we have a problem, and it seems that my machine doesn't behaves
the same as yours...

If you redefine <bibitem*|...> as :
[[
<assign|bibitem*|<macro|x|<margin-first-other|0mm|5mm|<arg|x>>>>
]]

do you obtain lines like :
[[
X aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa

X aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa
>>>> aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa
]]

(which is correct), or either do you obtain incorrectly indented
stuff ?

Anyway, we tested that <margin-first-other|...> works correctly
on your machine. Therefore, it seems rather unlikely that we
cannot find a way to write a macro to embed it on your machine.


I performed the change as you indicated (and many other ways besides). Anyway, still no progress.

Yes, but how did you performed it ? Because if you just changed
the .ts file of the TeXmacs stylesheet (e.g., using emacs), then
it can have no effect before you start TeXmacs anew (and even in
this latter case, it probably has no effect until you erase the
cache).

On the other hand, if you edit the stylesheet using TeXmacs
itself *and* save the changes, then it should work immediately,
but I'm not completely sure.

In any case, the _active_ copies of the stylesheets are stored
in your ~/.TeXmacs/system/cache, and just to be sure, removing
everything inside this directory each time you change a stylesheet
avoids lots of questions.

Finally, while debugging changes to a macro like <bibitem*|...>,
the only 100% sure way to see the effect of your changes immediately
is to put the macro you are hacking _inside the current document_.

If you already operated this way, then what I just said is of
no use. But if you didn't, then it could be the reason why you
cannot see the effects of your changes.




Archive powered by MHonArc 2.6.19.

Top of Page