Closed TomBener closed 3 years ago
Like this:
@coser1956 [@coser1957]
Really handy, thank you ^_^
A related issue about using multiple "AuthorInText" citations.
For removing spaces before citations, I used this Lua filter, which was saved as rsbc.lua
:
local function is_space_before_author_in_text(spc, cite)
return spc and spc.t == 'Space'
and cite and cite.t == 'Cite'
-- there must be only a single citation, and it must have
-- mode 'AuthorInText'
and #cite.citations == 1
and cite.citations[1].mode == 'AuthorInText'
end
function Inlines (inlines)
-- Go from end to start to avoid problems with shifting indices.
for i = #inlines-1, 1, -1 do
if is_space_before_author_in_text(inlines[i], inlines[i+1]) then
inlines:remove(i)
end
end
return inlines
end
But as the comment says, the space before only a single citation can be removed. If I have multiple citations like above, for example:
Thanks you, Pandoc. @coser1956 [@coser1957]…
Run:
$ pandoc -C -L rsbc.lua input.md -o output.docx
The space before @coser1956 [@coser1957]
in output.docx
can’t be removed. Is it possible to manage to remove the space before multiple citations via Lua Filters or other solutions? Thank you!
Thanks for your amazing work!
The Problem
I have a sentence where 2 citekeys with the same author were inserted as the subjective, the expected output should be:
And the BibTeX file contents in
ref.bib
:I have tried to write in the Markdown file
input.md
:Run Pandoc command in terminal:
But it rendered with 2 separate parentheses wrapped the year in
output.docx
:Not the expected:
Questions
Whether it's possible to write raw LaTeX command in Markdown to make a workaround like:
And then convert the Markdown file via Pandoc to
.docx
, it should be like the ideal format:I'm not sure if it’s possible. Or could you please provide alternative solutions for this issue? Thank you 😊