Option for "et al" instead of "et al." in renaming rules
I'm really impressed with the rollout of Zotero 7!
I'm currently migrating all my plugins and workflows, and one extremely minor issue is that I can't find a way to customize how et al is spelled and formatted. To keep things consistent with my prior workflow (which relied on zotfile for file renaming), I would like to be able to set it so et al is not followed by a period. But it might also be nice to "explode" the firstCreator variable and ensure greater customization capabilities too. I realize that this is probably a very low priority, but it could be important for people who run local automation/scripting that relies on consistent file-naming patterns.
I'm currently migrating all my plugins and workflows, and one extremely minor issue is that I can't find a way to customize how et al is spelled and formatted. To keep things consistent with my prior workflow (which relied on zotfile for file renaming), I would like to be able to set it so et al is not followed by a period. But it might also be nice to "explode" the firstCreator variable and ensure greater customization capabilities too. I realize that this is probably a very low priority, but it could be important for people who run local automation/scripting that relies on consistent file-naming patterns.
{{ firstCreator replaceFrom="et al.$" replaceTo="et al" }}
With some additional effort, it's possible to use
authors
with formatting and logical statements to replacefirstCreator
. Here's an example from another thread:https://forums.zotero.org/discussion/comment/470491/#Comment_470491
{{ authors join="&" }}
.By default, the authors are joined with a comma (,) rather than the word "and".
Please refer to the file renaming documentation for more details.
https://www.zotero.org/support/file_renaming#customizing_the_filename_format
Output example when the reference has 4 authors:
"AuthA & AuthB & AuthC & AuthD" instead of "AuthA et al"
@tim820, that "join" feature doesn't work with "firstCreator"
So I use {{ firstCreator join="&" }}, which follows the APA 7 style but uses the word "and" instead of "&"
Output example when the reference has 2 authors:
"AuthA and AuthB"
Output example when the reference has 3 or more authors:
"AuthA et al"
I've played around with it using the documentation. I don't think there is a quick one line fix
authors
yourself, here is an example that will result in AuthA et al for three or more authors, but for two it will produce AuthA & AuthB for two authors.{{ if {{ authors match="[^,]+,[^,]+,[^,]+" }} }}
{{ authors max="1" suffix=" et al" }}
{{ else }}
{{ authors join=" & " }}
{{ endif }}
"AuthA & AuthB ( 2024) RandomTitleHere.pdf"
For three authors:
"AuthA et al. ( 2024) RandomTitleHere.pdf"
I think using
authors
just adds one " " (i.e., one space) in between open-paracentesis.Here is the code I am using:
{{ if {{ authors match="[^,]+,[^,]+,[^,]+" }} }}
{{ authors max="1" suffix=" et al. (" }}{{ year suffix=") " }}{{ title truncate="30" }}
{{ else }}
{{ authors join=" & " suffix=" (" }}{{ year suffix=") " }}{{ title truncate="30" }}
{{ endif }}
Furthermore, it breaks if I have 1 and 4 or more authors. I have experimented with code, but I can't think of solving this elegantly or without hard coding.
firstCreator
variable is useful as it nearly does what I want, thanks to the back-end of codes doing the heavy lifting. But because the back-end code spits out "and", I can't simply write something to replace "and" to "&"suffix
onauthors
toprefix
onyear
. This makes more logical sense and also fixes cases where thedate
field is empty.I've tested the exact code you provided and couldn't identify the problem with having one or four authors, so you'll need to be more specific. I also wasn't able to reproduce the extra space inside the bracket. Does it appear in the preview when editing the template in the Zotero preferences pane?
join
character forfirstCreator
(which does a good job easily selecting whatever creator the reference has and limiting it's lenght for the file name), and tnajdek's suggestion above works fine.I still think it would be more obvious and easier to allow most of the
author
/editor
parameters (join
,name
... would be some useful ones) forfirstCreator
as well.Thanks again in any case, I got things working as I wanted!
Now I have this: {{ firstCreator suffix="_" }}{{ year suffix="_" }}{{ title truncate="75" }}
But I don't want two authors neither "et al." when is more than two.
Can anyone help me please?
https://www.zotero.org/support/file_renaming#customizing_the_filename_format
Very helpful.