Hi Arash, thank you for looking into this.
On Thu, 11 Apr 2024 at 05:36, Arash Esbati <[email protected]> wrote: > How do you write these citation lists, especially the long one? I mean, > what is the syntax of the TeX parser for this? For example, do you > write: > > \textcites(See, for example)()[45]{sigfridsson}[67]{reese}[24]{companion} > > or > > \textcites(See, for example)()[45]{sigfridsson}% > [67]{reese}[24]{companion} > > and some such? I'm asking because for the version with everything in a > single line, the following change should work: I can see you cursing me when you read this one. :-) But, worse, much worse, I'm a sinner: I enable `reftex-allow-detached-macro-args' and use it widely ("wildly" one might say). An example from an actual document of mine: destes sobre os benefícios obtidos pelas diferentes partes envolvidas e os resultados gerais da valorização.\footcites(Sobre a primeira valorização, veja)() {Holloway1978} [40-88]{DelfimNo1959} [vol.~10, \pnfmt{55-218}, vol.~11, \pnfmt{35-436}]{Taunay1941} [213-225]{Fausto1989} [52-66]{Pelaez1971} [494-501]{Krasner1973} [410-463]{Calogeras1960} [13-22]{Fritsch1988} [44-50, 188-195]{Love1980} [62-73, 84-91]{Topik1987} [112-134]{Kugelmas1986} Or how about: militar, mas que contrastava com ele ao especificar detalhadamente as medidas a serem tomadas.\footnote{\cites[1917, vol.~II, sessão de 20/06/1917, \pnfmt{125-131}]{AS} % Assinado: % Pires Ferreira (PI), presidente % F. Mendes de Almeida (MA), relator % A. Indio do Brasil (PA) % Soares dos Santos (RS) % todos militares [1917, vol.~III, sessão de 04/07/1917, \pnfmt{30-34}]{AS}. A primeira referência é a publicação original da leitura do parecer em plenário, mas (I hope the email will preserve line breaks, but I think this should be enough to grasp how bad it can get). This is legit (La)TeX syntax, or at least valid (see https://tex.stackexchange.com/a/175359/105447). From AUCTeX/RefTeX's sides pretty much everything works, except that you cannot detach the very first argument after the macro. (If I recall correctly, this exception is due to an implementation detail in font-latex.el, but I don't recall if I had filled this as a mal-function or not, I'm just used to it by now. I also don't recall if this exception affects only citation lists or is general, probably general). (My ears feel hot by now, I don't know what might be going on. :-D ). > Do you want to give it a roll? I did some light testing and it does indeed handle the MWE of the original report, that is, the simplest cases. But it is easy to beat it, you know it. Simply detaching the arguments with white space is enough to fool it (that would be easy to fix, I guess). Any macro in the pre- or postnotes which itself has an optional argument would fool `re3' and break the loop (that would be hard to fix...). And, as you have noted yourself, a comment between two arguments would also beat it. I'm sure you know much better than me how hard it is to parse TeX arguments solely based on regexps (as opposed to sexp navigation). Despite that, I'd say this is still a good improvement relative to the current state of things, and you might want to go with it. That said, I really don't recall what the "barely out of noobness five year ago me" was up to when "he" opened this bug report. But gladly people learn and, nowadays, I'd not even consider for this task something which does not rely on generated files (.aux, .bcf, etc.) instead of the main file. biber tool mode, bibtool, bibexport, there are plenty of options (https://tex.stackexchange.com/q/41821/105447 seems to be a good list). So, while the "old me" opened this report, the "current me" would advise you not to invest much of your time in this. It is a losing battle. You can improve things on the margin but ultimately it will always remain a "good approximation". Unless, of course, you want to go all out and start parsing the relevant generated files. But I'm not sure RefTeX should invest in this, given there are specialized tools for that. True, `reftex-create-bibtex-file' already exists, so it does pose the question as to whether "let it wane", "marginally improve" or "replace it with something better" is the best option. Not a question for me to answer tough. ;-) WDYT? Best, gusbrs _______________________________________________ bug-auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-auctex
