how to get parentheses to change to brackets when citation is in parentheses?
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
Thanks for taking an interest and sorry about the broken link. Try it now (http://coffeewithbarretts.com/uploads/SearchParens.docm). By the way, I made a couple of changes to the VBA macro because it wasn't working properly for too many levels of nested parentheses/brackets.
The SearchParens.docm document has a few paragraphs of text with various kinds of parentheses. Just put the cursor someplace in the text and press ctrl+alt+shift P to have it pop up a message box saying whether you are inside parentheses or not. My personal bibliographic software uses this information to swap parentheses and brackets in citations if the insertion point is inside parentheses already.
I can post the modified VBA macro if it would be helpful.
I'd love for this sort of functionality to be included in Zotero.
--Rob
My current understanding: So first, a question: is this description correct? Or do I need to amend that middle sentence to: Either way, this is what I mean by clearly defined use cases. You need to explain the needs in general but precise terms that those of us who don't use these styles can understand. I think we collectively wasted hours tying to understand this.
The technical discussion depends a lot on which interpretation is correct.
By way of trying to provide the kind of example that might help, here is a sentence from a footnote on an essay that I'm currently writing: This citation is correctly formatted per CMS (and SBLHS, which defers to CMS at this point) except that: should be: The (LibreOffice) Zotero field text for the citation at the end of the sentence that I've quoted is as follows: As has been mentioned previously, parentheses that are simply typed into the word processor and not entered in the citation editor shouldn't be something for which we'd expect Zotero to account automatically. But, since I've here specified the enclosing parentheses as a prefix to the first and a suffix to the second (and last) citation (cf. adamsmith above): it would be nice if Zotero would translate any medial parentheses into square brackets. Or, since a compound citation of two or more individual sources might be involved (as in my example here), perhaps what's needed is an additional field or option in the citation editor for applying parentheses to the whole compound citation and then, based on this setting, translating what would be medial parentheses, e.g., into square brackets, e.g., These medial parentheses can, of course, already be replaced manually in the citation editor, but making those replacements one-at-a-time over several hundred pages of footnote text makes an automation option desirable.
I hope this example is helpful. Thanks so much for the thoughts.
In your description, you had summarized that: If the "context" mentioned here refers to a situation in which parentheses had been typed directly into the word processor and not into a particular reference's Zotero field through the citation editor—e.g., my example without the elements—then (to me at least), it's quite understandable that these parentheses implications "c[ould ]not be coded in CSL."
But, if the "context" mentioned here could refer to instances where a user had added the framing parentheses in the prefix/suffix fields or some other option in the citation editor (perhaps akin to how the suppress author function already works), having framing parentheses and translating what would be medial parentheses into square brackets would seem to be something that could be automated. . . . "could be" in the sense that the user has then "told" Zotero about his or her desire to have these framing parentheses. The feasibility of the nuts and bolts of the code required to perform such an operation may be (is?) another matter entirely.
There is a test here that illustrates the behavior.
This will not work for text controlled by the word processor, of course; the parens need to be in the affixes of a cite to make them "visible" to the processor.
1. Install Ecology style.
2. begin new MS Word doc. Set the style to Ecology in Zotero Document Preferences.
3. Type some text
4. Search for a citation using the "new" tool. Click on the citation, in the Prefix field add "(parenthetical statement " (no quotes)
5. In the Suffix field add ")" or add some text and then the end parens, no quotes.
6. Hit enter a couple of times. The result is:
((parenthetical statement Author1 and Author2 1995))
I expected:
(parenthetical statement [Author1 and Author2 1995])
put "parenthetical statement [" in the prefix and "]" in the suffix. You'll end up with
(parenthetical statement [Author1 and Author2 1995])
Obviously, this workaround only applies to a small subset of scenarios where the square brackets would be useful to have.
There is one logic/design issue to settle before it's released. Some citation forms contain square braces. Instances I can think of off the top of my head are square-braces years and square-braced paragraph numbers in some legal cites. There may be others.
So the question is whether those should flip as well (bracket to parens) when they are nested. My inclination would be to say "yes," but I'm not 100% sure that's the right call.
Any thoughts? @adamsmith? @rintzezelle?
I'm actually, having consulted the Manual, less certain this is a good idea: apparently, e.g. in UK typography, parentheses within parentheses are generally preferred. So I'm wondering if we're not actually breaking more than we're fixing here, since, as tghoward points out, there is at least a workaround for getting the square brackets. Once implemented, it'd be impossibel to get parentheses within parentheses (right?).
Sorry that didn't occur to me sooner, I just read this.
Not sure what to do in the processor for the time being. The flipping code currently takes effect only on parens inside the layout affixes, which is halfway to the goal, so to speak. Could wind out parens flipping completely, or finish it out completely, or leave it as it is.
(1) If we were to attempt a rational explanation for current behaviour, you could say that it flips in note styles, and does not in in-text styles. That's not a 100% accurate description, but in effect that's what most users will see.
(2) Alternatively, I could remove parens-flipping entirely, which as Sebastian has noted would align behaviour with Chicago.
(3) Or I could go forward with robust parens flipping, which given what we know so far would probably be a very bad idea.
I don't much like (3), but as between (1) and (2) I don't have a strong preference myself. Any thoughts?
If UK styles prefer parentheses within parentheses, the ideal would be to make parens-flipping style-dependent — be able to turn it on or off in the csl code.
If that is not feasible, it seems that one group of users will have to be making manual changes. So then it would be a matter of weighing the greater inconvenience. Unless you're hearing complaints about current behavior, it would seem a shame to me to lose this function, even if it's not perfect.
"The Chicago Manual of Style" 15th edition (2003), p. 266 has:
"6.102 Parentheses within parentheses. Athough the use of parentheses within parentheses (usually for bibliographic purposes) is permitted in some publications -- especially in law -- Chicago prefers brackets within parentheses (see 6.106)."...
and p. 268:
[under section "Brackets, Square Brackets"]:
"6.106. Within Parentheses. Square brackets are used as parentheses within parentheses, usually for bibliographic purposes."...