Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix toBiblatex when BibEntry has Japanese author names #107

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mwmclean
Copy link
Collaborator

  • tools::encoded_text_to_latex(text, UTF-8) can fail when text contains Japanese characters, replacing valid text with questions marks
  • Add escape hatch to return origin/unformatted/unescaped text if this occurs
  • Closes toBiblatex can't handle CJK author names #106

* tools::encoded_text_to_latex(text, UTF-8) can fail when text contains
Japanese characters, replacing valid text with questions marks
* Add escape hatch to return origin/unformatted/unescaped text if this
occurs
* Closes #106
Copy link

@kijinosu kijinosu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for giving this your attention.

This works beautifully for names that cleanly format given and family names, but not for names that aren't, which is usually the case for CJK bibtex. See the second BibEntry below.

bib <- c(BibEntry(bibtype = "article", 
		key = "shiotsuki2011kasai", 
		title = "葛西賢太著,『現代瞑想論-変性意識がひらく世界-』",
		author = "塩,亮子 and 葛西,賢太", 
		journal = "宗教と社会",
		volume = 17,
		pages = "67--69",
		year = 2011, 
		publisher = "「宗教と社会」学会"),
		BibEntry(bibtype = "article", 
		key = "hiromitsu2022altered", 
		title = "意識状態の変容と脳内ネットワーク",
		author = "弘光健太郎 and ヒロミツケンタロウ", 
		journal = "鶴見大学仏教文化研究所紀要",
		volume = 27,
		pages = "53--66",
		year = 2022, 
		publisher = "鶴見大学"),
		BibEntry(bibtype = "article",
		key = "galante2024altered",
  		title="Altered states of consciousness caused by a mindfulness-based programme up to a year later: Results from a randomised controlled trial",
  		author="Galante, Julieta and Jesús Montero-Marín and Maris Vainre and Géraldine Dufour and Javier García-Campayo and Peter B. Jones",
  		journal="Plos one",
  		volume=19,
 		number=7,
  		pages="e0305928",
  		year=2024,
  		publisher="Public Library of Science San Francisco, CA USA")
		)
biblatex <- toBiblatex(bib)
writeLines(biblatex)

Result:

@Article{shiotsuki2011kasai,
  title = {葛西賢太著,『現代瞑想論-変性意識がひらく世界-』},
  author = {亮子 塩 and 賢太 葛西},
  journal = {宗教と社会},
  volume = {17},
  pages = {67--69},
  year = {2011},
  publisher = {「宗教と社会」学会},
}

@Article{hiromitsu2022altered,
  title = {意識状態の変容と脳内ネットワーク},
  author = {{?????} and {?????????}},
  journal = {鶴見大学仏教文化研究所紀要},
  volume = {27},
  pages = {53--66},
  year = {2022},
  publisher = {鶴見大学},
}

@Article{galante2024altered,
  title = {Altered states of consciousness caused by a mindfulness-based programme up to a year later: Results from a randomised controlled trial},
  author = {Julieta Galante and Jes{\a'u}s Montero-Mar{\a'\i}n and Maris Vainre and G{\a'e}raldine Dufour and Javier Garc{\a'\i}a-Campayo and Peter B. Jones},
  journal = {Plos one},
  volume = {19},
  number = {7},
  pages = {e0305928},
  year = {2024},
  publisher = {Public Library of Science San Francisco, CA USA},
}

* See toBibtex.person, braces seem necessary if no family name is detected
* Addresses #106
@mwmclean
Copy link
Collaborator Author

Thanks @kijinosu. This should be fixed with my most recent commit, if you'd like to reinstall and retest.

@kijinosu
Copy link

This works! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toBiblatex can't handle CJK author names
2 participants