retorquere / zotero-better-bibtex

Make Zotero effective for us LaTeX holdouts
https://retorque.re/zotero-better-bibtex/
MIT License
5.3k stars 284 forks source link

raw bibtex fields with colon in extra #2750

Closed john-blip closed 9 months ago

john-blip commented 9 months ago

Debug log ID

See in-text

What happened?

Context: I'm trying to cite a podcast, and because Zotero not supporting APA7 formatting of it (see also the Zotero forums, happy to link threads if you think they are relevant) I'm resorting to defining the author in the Extra field and appending the author roles (i.e. Host/Guest) as non-abbreviated initials. This is the closest I could get to the applicable APA 7 guidelines.

Problem: in the Extras field, I have specified:

Issued: 1-1-2024
Container title: Podcast series title
tex.author = {family={Lastname}, given={First second (Host)}, given-i={F. S. (Host)} and family={LastnameOtherauthor}, given={FirstOtherauthor (Guest)}, given-i={F. (Guest)}}
tex.entrysubtype  = {Audio podcast episode}
tex.maintitle = {Podcast series title}

However, in the generated .bib file, the author-line is enclosed in an additional set of curly brackets, as follows: tex.author = {{family={Lastname}, given={First second (Host)}, given-i={F. S. (Host)} and family={LastnameOtherauthor}, given={FirstOtherauthor (Guest)}, given-i={F. (Guest)}}}. As a consequence, the reference does not get printed in my reference list. Removing this redundant set of {} makes the reference visible as intended, but every time my .bib is updated by the auto export I'd have to remove them manually again.

Below my debug log (left out some lines because of privacy reasons, but besides that everything is included):

Application context:

Platform: Win32 Windows NT 10.0; WOW64
Addons:
  Zotero LibreOffice Integration (6.0.4.SA.6.0.30, extension)
  Zotero Word for Windows Integration (6.0.3.SA.6.0.30, extension)
  Zutilo Utility for Zotero (3.10.0, extension)
  Zotero Tag (0.3.0, extension)
  Better BibTex for Zotero (6.7.143, extension)
Settings:
  autoExport = "idle"
  citekeyFormatEditing = "auth.lower + shorttitle(3,3) + year"
  keyScope = "global"
  platform = "win"
Settings at default:
  ascii = ""
  asciiBibLaTeX = false
  asciiBibTeX = true
  autoAbbrev = false
  autoAbbrevStyle = ""
  autoExportDelay = 5
  autoExportIdleWait = 10
  autoExportPathReplaceDiacritics = false
  autoExportPathReplaceDirSep = "-"
  autoExportPathReplaceSpace = " "
  automaticTags = true
  autoPinDelay = 0
  auxImport = false
  baseAttachmentPath = ""
  biblatexExtendedDateFormat = true
  biblatexExtendedNameFormat = true
  biblatexExtractEprint = true
  bibtexEditionOrdinal = false
  bibtexParticleNoOp = false
  bibtexURL = "off"
  cache = true
  cacheFlushInterval = 5
  charmap = ""
  citeCommand = "cite"
  citekeyCaseInsensitive = true
  citekeyFold = true
  citekeyFormat = "auth.lower + shorttitle(3,3) + year"
  citekeySearch = true
  citekeyUnsafeChars = "\\\"#%'(),={}~"
  csquotes = ""
  DOIandURL = "both"
  exportBibTeXStrings = "off"
  exportBraceProtection = true
  exportTitleCase = true
  extraMergeCitekeys = false
  extraMergeCSL = false
  extraMergeTeX = false
  git = "config"
  import = true
  importBibTeXStrings = true
  importCaseProtection = "as-needed"
  importCitationKey = true
  importDetectURLs = true
  importExtra = true
  importJabRefAbbreviations = true
  importJabRefStrings = true
  importNoteToExtra = ""
  importSentenceCase = "on+guess"
  importSentenceCaseQuoted = true
  importUnknownTexCommand = "ignore"
  itemObserverDelay = 5
  jabrefFormat = 0
  jieba = false
  keyConflictPolicy = "keep"
  kuroshiro = false
  language = "langid"
  logEvents = true
  mapMath = ""
  mapText = ""
  parseParticles = true
  patchDates = "dateadded=dateAdded, date-added=dateAdded, datemodified=dateModified, date-modified=dateModified"
  postscript = ""
  postscriptOverride = ""
  preferencesOverride = ""
  qualityReport = false
  quickCopyEta = ""
  quickCopyMode = "latex"
  quickCopyOrgMode = "zotero"
  quickCopyPandocBrackets = false
  quickCopySelectLink = "zotero"
  rawImports = false
  rawLaTag = "#LaTeX"
  relativeFilePaths = false
  retainCache = false
  scrubDatabase = false
  separatorList = "and"
  separatorNames = "and"
  skipFields = ""
  skipWords = "a,ab,aboard,about,above,across,after,against,al,along,amid,among,an,and,anti,around,as,at,before,behind,below,beneath,beside,besides,between,beyond,but,by,d,da,das,de,del,dell,dello,dei,degli,della,dell,delle,dem,den,der,des,despite,die,do,down,du,during,ein,eine,einem,einen,einer,eines,el,en,et,except,for,from,gli,i,il,in,inside,into,is,l,la,las,le,les,like,lo,los,near,nor,of,off,on,onto,or,over,past,per,plus,round,save,since,so,some,sur,than,the,through,to,toward,towards,un,una,unas,under,underneath,une,unlike,uno,unos,until,up,upon,versus,via,von,while,with,within,without,yet,zu,zum"
  startupProgress = "popup"
  strings = ""
  stringsOverride = ""
  testing = false
  verbatimFields = "url,doi,file,pdf,ids,eprint,/^verb[a-z]$/,groups,/^citeulike-linkout-[0-9]+$/, /^bdsk-url-[0-9]+$/"
  warnBulkModify = 10
  warnTitleCased = false
  Zotero: export.quickCopy.setting = "bibliography=http://www.zotero.org/styles/apa"
Auto-exports:
  path: _____redacted______
    type: "collection"
    id: 91
    translatorID: "f895aa0d-f28e-47fe-b247-2ea77c6ed583" (Better BibLaTeX)
    enabled: 1
    recursive: 0
    status: "done"
    error: ""
    updated: 1705241867297
    asciiBibLaTeX: 0
    biblatexExtendedNameFormat: 1
    DOIandURL: "both"
    exportNotes: 0
    useJournalAbbreviation: 0

Zotero.Debug.enabled: 1
Zotero.Debug.enabled at start: undefined

Errors:

[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
1705219481095   addons.update-checker   WARN    Request failed: https://raw.githubusercontent.com/windingwind/zotero-tag/master/update.rdf - 404: Not Found
[JavaScript Error: "TypeError: this._collapseUnusedItems is not a function" {file: "chrome://global/content/bindings/autocomplete.xml" line: 962}]
adjustHeight/this._shrinkTimeout<@chrome://global/content/bindings/autocomplete.xml:962:15

[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
[JavaScript Error: "inputRef.current is null" {file: "resource://zotero/note-editor/editor.js" line: 51436}]
[JavaScript Error: "The connection to wss://stream.zotero.org/ has terminated unexpectedly. Some data may have been transferred."]
[JavaScript Error: "WebSocket connection closed: 1006 "]
[JavaScript Error: "The connection was refused when attempting to contact wss://stream.zotero.org/."]
[JavaScript Error: "WebSocket connection closed: 1006 "]

pdf.pdf (5273 KB)"]
[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
[JavaScript Error: "TypeError: menulist.removeAllItems is not a function" {file: "chrome://zotero-better-bibtex/content/better-bibtex.js" line: 123359}]
[JavaScript Error: "XML Parsing Error: no root element found
github-actions[bot] commented 9 months ago

Hello there @john-blip,

Hope you're doing well! @retorquere is here to help you get the most out of your experience with Better BibTeX. To make sure he can assist you effectively, he kindly asks for your cooperation in providing a debug log – it's like giving him the key to understanding and solving the puzzle!

Getting your debug log is a breeze and will save us both time in getting your problem resolved or the new feature you'd like implemented. Trust me, it's way quicker than discussing why it's important. :smiley:

How to Share Your Debug Log:

  1. If the issue involves specific references, citekey generation, or exports, just right-click on the relevant item(s) and choose "Better BibTeX -> Submit Better BibTeX debug log" from the menu.

  2. For other issues, follow these simple steps:

    • Restart Zotero with debugging enabled (Help -> Debug Output Logging -> Restart with logging enabled).
    • Reproduce the problem.
    • Select "Send Better BibTeX debug report..." from the help menu.

Once you hit that submit button, you'll get a special red debug ID. Just share that with @retorquere in this issue thread. If the question is regarding an export, don't forget to include what you see exported and what you expected.

By sharing your debug log, you're giving @retorquere a clearer picture of your setup and the items causing the issue. It's like a superhero cape for him – he can swoop in and tackle the problem much faster.

We totally get that your time is valuable, and we appreciate your effort in helping @retorquere help you. You might be surprised at how much this simple step speeds up the whole process.

Thanks a bunch!

PS: If the Debug Log menu does not appear, or it does not send the debug log

A fallback option is available under "Help" > "Send debug log to file.io".

retorquere commented 9 months ago

what version of zotero are you on

retorquere commented 9 months ago

~If you go into Help -> Debug Output Logging -> Clear Output there will be nothing in the log that's not above. It would help me if you could do that and then right-click on the item you described above and choose "Better BibTeX -> Submit Better BibTeX debug log" from the menu.~ Oh I see you redacted the path. Then please export the item as "Better BibTeX JSON" and attach it here.

retorquere commented 9 months ago

However, in the generated .bib file, the author-line is enclosed in an additional set of curly brackets

Why not just remove the outer braces in the extra field?

retorquere commented 9 months ago

The next version of BBT will omit the file paths of the auto-exports.

john-blip commented 9 months ago

Thanks for the quick reply. Getting rid of the outer curly braces in the extra field indeed did the trick... It didn't come up in me to try, as the other entries in the Extra field (e.g. tex.maintitle = {Podcast series title}) did not get enclosed in an additional set, but it works. This is on Zotero version 6.0.30 on Windows 10.

See attached for the BetterBibtex json export of the record export.json

retorquere commented 9 months ago

I don't know why you redacted the ID, that's the identifier for my translator and the same for everyone, and the redaction makes that I couldn't import it; finding out why wasted time I could have used in better ways. Please don't edit out stuff without telling me about it, you're putting up roadblocks to my diagnosis.

Please go into Help -> Debug Output Logging -> Clear output, then send a debug log, before you click "Continue" click "Save copy", inspect the contents, and tell me what you do not want in there. Maybe I can structurally remove it from the debug log, maybe it's fine if you edit things out, but the entire point of the debug log is that I don't have to spend time guessing at what you are looking at.

retorquere commented 9 months ago

(e.g. tex.maintitle = {Podcast series title}) did not get enclosed in an additional set

It does. It exports to {{Podcast Title}}.

retorquere commented 9 months ago

(e.g. tex.maintitle = {Podcast series title}) did not get enclosed in an additional set

Come on man, Podcast series title isn't even in the sample you sent. You are making this aggravatingly difficult to diagnose. I have to go by half-descriptions of what you are actually looking at.

Help me find a way that you can send a debug log that omits the stuff you don't want me to have, but the entire point of the debug log is to spare me this back and forth guessing game on what you actually have that triggers the problem, which is a really poor use of my time.

retorquere commented 9 months ago

If I stick the extra content from the original message in the extra field without the outer braces, so

Issued: 1-1-2024
Container title: Podcast series title
tex.author = family={Lastname}, given={First second (Host)}, given-i={F. S. (Host)} and family={LastnameOtherauthor}, given={FirstOtherauthor (Guest)}, given-i={F. (Guest)}
tex.entrysubtype = Audio podcast episode
tex.maintitle = Podcast series title

(and those last two don't even have TeX, so they could have been tex.maintitle: Podcast series title etc)

that exports to

@audio{lastnameTitleWordsPodcast2024,
  entrysubtype = {Audio podcast episode},
  title = {‘{{Title Words}}’: {{The Podcast}}’s Title},
  author = {family={Lastname}, given={First second (Host)}, given-i={F. S. (Host)} and family={LastnameOtherauthor}, given={FirstOtherauthor (Guest)}, given-i={F. (Guest)}},
  date = {2024-01-01},
  journaltitle = {Podcast series title},
  url = {https://www.google.com/},
  abstract = {empty},
  maintitle = {Podcast series title},
  keywords = {/unread}
}

which we could have easily established with a debug log ID, or even by a proper, non-broken BBT-JSON export.

retorquere commented 9 months ago

have we addressed your issue?

john-blip commented 9 months ago

Thanks again for the comments.

It does. It exports to {{Podcast Title}}.

You're right, my bad. I had entered the podcast title in three fields (Series Title, and then again in the Extra field as Container title and as maintitle). Not sure which, but one of these fields got parsed into the JournalTitle field in the .bib with only 1 set of {} (as expected); the .bib also gets a maintitle = where there are two sets of {}, like you described, but I think I overlooked those. I assumed whatever I'd put into the Extras field would just be appended to the .bib entry and never noticed these {} being added consistently. I've also replaced some unnecessary tex.field = xyz with tex.field : xyz as you rightfully pointed out. Probably the result of me trying for hours on end rather than taking a fresh look at it again later. So indeed, there is no 'unexpected' set of {} being added; I just interpreted the working of this Extra field wrongly; that part of the issue is indeed addressed.

Re my incomplete logs: I thought I could redact some lines that seemed mundane to maintain anonymity, but I see I took this way too far, and I also shouldn't have redacted fields without knowing what they do. I appreciate the effort you invested in helping me address my issue, so my sincere apologies for the extra work caused. I created two new debug logs with ID LSIC7P7X-euc/6.7.143-6 (from Tools > Better Bibtex > Send debug log) and 49ULKA86-refs-euc/6.7.143-6 (right mouseclick on this reference > Better Bibtex > Send debug log) in case you still want to have a look. The fields I wished to remove are path (in the application context tab) as that gives away the Windows account name + in my case my occupation and project name; and in the errors tab it will display groups that have run out of storage space; these group names also refer to my work.

Back to why I got here in the first place: citing a podcast in APA7 requires the addition of the authors' roles in the reference list, in my case "Host" for the first author and "Guest" for the second. As per this StackExchange thread, I first tried adding a line author+an:role = {1=host,2=producer} to the bibtex entry. I don't understand why and how to solve this, but it results in (Host) properly being appended for the first author, but nothing shows for the second author. Now, suppose it would work, I'm not sure how I could put this in Zotero so that bbt would auto-export it properly to the .bib entry. If I include author+an:role = {1=host,2=producer} in the Extras field, then in the .bib it shows author+an = {role = \{1=host,2=guest\}}, whereafter neither the (Host) nor (Guest) shows up in the literature list. Writing tex.author+an:role = 1=host,2=guest in the Extras field gives author+an = {role = 1=host,2=guest} in .bib, which also results in neither (Host) nor (Guest) being printed.

Because I could a) not figure out how to get both roles printed, and b) even if I got this working, how to get it into Zotero, I resorted to declaring the roles in the author initials-field. This has as downside that after (Host) a period is printed, but was the best I could do until now. And in this process, I ran into the above "bug" (which turned out not to be a bug but my own lack of error). I suppose addressing the citing of podcasts would be more suited to discuss on the Zotero forum?

retorquere commented 9 months ago

The fields I wished to remove are path (in the application context tab) as that gives away the Windows account name

That has already been removed, the builds you see here now don't have them. I can remove the filename too, but I need a way to refer to the auto-export.

these group names also refer to my work.

If you can describe them, I can remove them. I don't need any personal information. I just need enough information to know what you are looking at; descriptions by end users are often incomplete, misinterpreted, or simply mistyped, and I used to spend way too much time eking out information so I could get to a fix. I need a reliable way to make sure I'm seeing the problem (input) or error message itself, not a description of it. Otherwise I have no chance to reproduce the problem.

Some of the out-of-storage logs have already been removed in the builds that drop here, because privacy issues aside, non-relevant errors a nuisance for me to go through to find mine.

author+an:role = {1=host,2=producer}

tex.author+an:role = {1=host,2=producer} should have worked, but that indeed has a bug. I can get tot that tomorrow.

I suppose addressing the citing of podcasts would be more suited to discuss on the Zotero forum?

If there is a way it works in Zotero, I will adopt that. In the meantime, the tex.author+an:role should have worked, so I'll fix that.

retorquere commented 9 months ago

Ah -- my parser is detecting the first : in author+an:role and thinks that the field name is author+an. I'll think of a way around that.

github-actions[bot] commented 9 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.143.2750.5652 ("quoted extra fields")

Install in Zotero by downloading test build 6.7.143.2750.5652, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

retorquere commented 9 months ago

With build 5662, you can add

tex."author+an:role": 1=host,2=producer

to the extra field.

I hope to put out a new release today pending one bug I'm still trying to fix, but Friday at the latest.

github-actions[bot] commented 9 months ago

:robot: this is your friendly neighborhood build bot announcing test build 6.7.143.2750.5658 ("quoted fields import")

Install in Zotero by downloading test build 6.7.143.2750.5658, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".