how to get parentheses to change to brackets when citation is in parentheses?
February 27, 2016
A patch on (1) might be to code for (3) in the processor, but enable it only in note styles. For author-date styles, it would still be possible to use the workaround described by tghoward above.
It would have some advantages. Behaviour would change very little from what we have now. It is simpler to describe accurately. And when a style setting is introduced into CSL further down the road, everything would be in place for across-the-board style-specific control of parens flips.
June 7, 2018
Sorry to resurrect an old thread, but I've searched everywhere for an answer to this and it seems that this thread is the only thing close to being a solution.
Basically I'm wondering whether there is any workaround that will allow the use of square brackets inside parenthetical text in places where Zotero does not automagically provide them (i.e., in styles where the behavior is not implemented), or in situations where using the prefix/suffix fields would be unwieldy. Or is the only solution to manually edit the citation and lose updating (or to do the same thing "at the end" using VBA)?
In particular, I'm wondering about how to use Zotero for this rule from the American Sociological Association Style Guide (4th ed., p. 26):
Use brackets to: Enclose material included within parentheses: (See also the discussion in Bowers  and Bureau of Justice Statistics data .)
Zotero's ASA style does not implement this rule, even when all of the parenthesized text is entered as prefixes and suffixes; although even if it did, that would get pretty unwieldy with long non-citation text, as in the following parenthesized sentence:
(See Halloron's  treatment of Common Cause, Jonas's  treatment of AFSC, and Hentoff's  treatment of FOR for analyses of the wide range of goals pursued by these SMOs.)
So I don't really expect Zotero to handle this automagically, and I don't think that requiring long parenthesized sentences to be put in prefixes or suffixes would be a very good solution. But does anybody know if there is at least a workaround that permits this (very common!) usage without breaking updating?
June 7, 2018
I just posted a long request for a workaround before I noticed tghoward's workaround upthread at
. That's a bit unwieldy since it may require very long affixes, but I think it will at least work. If there are any other tricks that will work even better I'm all ears!
August 9, 2018
A simple way to solve all of this automatically would be to have a without-parentheses option for citations, as discussed in detail in this thread:
If we could have without-parentheses, and name-only options, we could build any variants we need ourselves.
It's too much to ask that Zotero handle every possible case automatically, but it doesn't seem too much to ask that we could get stripped down citations that we could do what we want with.
So, in short, use without-parentheses, and add your own brackets. Simple. But not possible because there are currently no customization options except suppress-author.
November 23, 2018
I too have been looking for a solution where I could have square or a without-parentheses options. I can imagine an automated solution is complex. A manual solution would work well for me, at least.
November 23, 2018
edited November 23, 2018
As mentioned in the other thread, it sounds like the Zotero devs are working on adding some features. (I'm not positive it will include options for all options like parentheses, but at least more.)
For the moment, however, I've written a macro that will strip the parentheses if you would like to use it:
I wrote it for myself and there might be some bugs, but I hope it works for others too. The main goal was to handle cites like
, but I also just added the function of removing parentheses. The main Author-only function is limited to a specific style and would need to be adapted to others. But removing parentheses should work for any style with parentheses (not footnotes, etc., but those would just be ignored because it only searches for then replaces parentheses).
Because we have limited input options, it uses a trick to remove them: add "(" as a prefix and/or ")" as a suffix, doubling the parentheses. Then when doubled, the macro automatically strips them (
that is, when you run the macro: not automatically on inserting a cite, but can be done for the document all at once-- see the instructions in the linked thread
Of course you can then just type out square brackets around the citation if needed. (Note: don't add them as prefixes/suffixes in the cite or that will interfere with the macro's search-- I suppose you could easily write an alternative search/replace macro where a prefix "[" or suffix "]" is used to swap out the parentheses if you wanted, but that wouldn't allow 'open' cites then).
I'll add an additional version of the macro there with only the parentheses-removal option, not the Author-only function (which must be adjusted per style), in case you want to use that.
Note: the correct way to do this
in most cases
is to use the prefix and suffix options on cites.
So continue to do that when possible. But once in a while that isn't, including the scenario you describe where you're already in parentheses for some reason (especially when for example there's another Word field already in there, like a cross-reference as mentioned in the other thread).