Export formatter with leading whitespace gobbles initial reference whitespace

When I make an export formatter that has leading whitespace (for example, I want a tab at the beginning of each entry), it correctly places the leading whitespace on every entry except the first.

It appears that the export formatter is gobbling leading whitespace after-the-fact or something.

I’m trying to make a reference list that is indented 1 level, so I can include it a separate document. Obviously, I need the first reference also indented, not just the later ones. Are there any suggestions?

With export formatter you mean a custom .layout file? I had a look at the code and it appears that all entries are treated exactly the same way (so no special handling of the very first entry). It may be worth a shot if you create a sameNameAsBefore.begin.layout file next to the original layout file which contains only whitespace /tabs (or some other text as test). The contents of this file will be inserted before the entries are written.

Yes I mean a .layout file. I realized I made a mistake; in fact no entry has a tab.

So you’re right – they are all treated the same. So for some reason if you write a layout file like this:


It will be the same as:


Is there any format code to insert whitespace that will not be gobbled up?

You could try to use the   html whitespace character.

If you are creating html exports, then you could also wrap that thin a div container or pre tag and format it with css. For a complex example see the tablerefs.layout files

I know it’s been a few years since I posted this, but I just ran into the problem again in another scenario.

Using HTML characters might work if you’re targeting HTML outputs, but I want generic outputs. I’m trying to output to a custom yaml format, so I need each entry to have two spaces at the beginning so that it fits under the header defined elsewhere.

I guess this is a limitation with the custom formatters. I find it kind of strange that the custom formatters will automatically and silently gobble any leading whitespace with no alternative. This makes it so I can’t figure out a way to implement the output format I need.


JabRef has a YAML exporter and this is also built using the Template-based layout files:

That seems to have no problems with the spaces

That layout doesn’t have any leading whitespace.

They are between the begin and end statements.

I’m sorry I haven’t been clear – I mean leading whitespace at the very beginning of the layout.

In my hands there’s no problem with whitespace in the middle of a layout – even on the beginning of the line. But try putting any spaces as the first characters at the very beginning of the layout.

The example you showed has spaces in the middle of the layout, but it starts with a - character, so I can see why this is not a problem.

Ah thanks for the clarification, I will investigate where the problem comes from