mkdocs-bibtex does not render citations where a period (.) exists in the key - bibtex

When rendering a site with mkdocs using the mkdocs-bibtex plugin, citations are not recognised if they have a period within the citation key.
I tried a minimum working example and could reproduce the behaviour. To reproduce the behaviour, set up a folder containing the files below and run the command mkdocs serve. The browser should render both citations correctly but it only functions as expected for the citation key without the period.
MWE
Site structure:
MWE
docs
index.md
mkdocs.yml
mwe.bib
index.md
# Home
Blah blah [#Jarse2023].
Woof woof [#Jarse.2023]
mkdocs.yml
site_name: MWE
docs_dir: docs
site_dir: site
plugins:
- search
- bibtex:
bib_file: mwe.bib
markdown_extensions:
- footnotes
mwe.bib
#article{Jarse2023,
author = {Jarse, Hugh},
journal = {Beano},
title = {{The width of seats on urban public transport}},
year = {2023}
}
#article{Jarse.2023,
author = {Jarse, Hugh},
journal = {Beano},
title = {{The width of seats on urban public transport}},
year = {2023}
}

This has been fixed in v2.8.13 of mkdocs-bibtex plugin.
https://github.com/shyamd/mkdocs-bibtex/releases/tag/v2.8.13

Related

How to make cross page reference work in Hugo?

I have a hugo project setup based on this theme and have the below project structure.
content
learning
aws
index.md
how-we-use
index.md
Inside the aws > index.md file, I want to have a link which opens up how-we-use > index.md. I tried below (and a lot other things), but every time I click it, it give me 404.
Tried below in aws > index.md.
- [How we use AWS](./how-we-use)
- [How we use AWS](/how-we-use)
- [How we use AWS](/learning/aws/how-we-use)
Below is my how-we-use > index.md
+++
title = "How we use AWS"
aliases = "/learning/aws/how-we-use/"
+++
Hi There
Also, tried changing this alias to /how-we-use/ and /how-we-use but still doesn't work.
config.toml
baseurl = "https://welcome-page"
title = "welcome"
theme = "hugo-universal-theme"
themesDir = "./themes"
languageCode = "en-us"
uglyURLs = false
# Site language. Available translations in the theme's `/i18n` directory.
defaultContentLanguage = "en"
# Define the number of posts per page
paginate = 10
# not pluralize title pages by default
pluralizelisttitles = false
[[menu.main]]
name = "Learnings"
identifier = "menu.learnings"
url = "/img/learnings.png"
weight = 4
[[menu.main]]
name = "Learnings"
identifier = "section.learnings"
url = ""
weight = 1
parent = "menu.learnings"
post = 1
[[menu.main]]
name = "AWS"
identifier = "learning.aws"
url = "/aws"
weight = 1
parent = "section.learnings"
How to get this cross reference to work ?
p.s - if I change the name of the files to _index.md, then no content is displayed and I just see the title getting displayed but nothing else.
md link format []() could be used with full link [](https://...) or with anchor [](#anchor), but you need relative link and hugo has another syntax for it: []({{< ref "" >}})
According to Hugo documentation index.md can be reference either by its path or by its containing folder without the ending /. _index.md can be referenced only by its containing folder.
So try it:
[How we use AWS]({{< ref "/how-we-use" >}})
It works with my ananke theme. But you could try also:
[How we use AWS]({{< ref "/how-we-use/index" >}})
[How we use AWS]({{< ref "/learning/aws/how-we-use" >}})
[How we use AWS]({{< ref "/learning/aws/how-we-use/index" >}})

Biblatex doesn't compile. Probably .bib file not recognised

I've spent many hours trying to get my bibliography working - unsuccessfully. I suspect that, somehow, my .bib file doesn't get recognised.
Help would be greatly appreciated.
MWE:
\documentclass[a4paper, 12pt]{article}
\usepackage{array}
\usepackage{lscape}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage{babel,csquotes,xpatch}
\usepackage[backend=biber,style=authoryear, natbib]{biblatex}
\addbibresource{test.bib}
\usepackage{xurl}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\begin{document}
This is a test... test test\\
\cite{glaeser_gyourko}\\
\cite{hsieh-moretti:2019}\\
\cite{glaeser_gyourko}\\
\printbibliography
\end{document}
test.bib file:
#article{hsieh-moretti:2019,
Author = {Hsieh, Chang-Tai and Moretti, Enrico},
Title = {Housing Constraints and Spatial Misallocation},
Journal = {American Economic Journal: Macroeconomics},
Volume = {11},
Number = {2},
Year = {2019},
Month = {4},
Pages = {1-39},
DOI = {10.1257/mac.20170388},
URL = {https://www.aeaweb.org/articles?id=10.1257/mac.20170388}
}
#article{glaeser_gyourko,
Author = {Glaeser, Edward and Gyourko, Joseph},
Title = {The Economic Implications of Housing Supply},
Journal = {Journal of Economic Perspectives},
Volume = {32},
Number = {1},
Year = {2018},
Month = {2},
Pages = {3-30},
DOI = {10.1257/jep.32.1.3},
URL = {https://www.aeaweb.org/articles?id=10.1257/jep.32.1.3}
}
In PDF it looks like this: enter image description here
I get the following information in the source viewer:
Process started
INFO - This is Biber 2.14 INFO - Logfile is 'test.blg' INFO - Reading
'test.bcf' INFO - Found 2 citekeys in bib section 0 INFO - Processing
section 0 INFO - Globbing data source 'test.bib' INFO - Globbed data
source 'test.bib' to test.bib INFO - Looking for bibtex format file
'test.bib' for section 0 INFO - LaTeX decoding ... INFO - Found
BibTeX data source 'test.bib'
Process exited with error(s)
I use texmaker 5.0.4 on MacOS and I post my configurations here:
enter image description here enter image description here
I really have very little idea on what goes on. Today, I started a work session, added a new source and it didn't work. I deleted the new source so that the bibliography would be the same as prior to me changing it, and it didn't work either. So, this let's me assume that, somehow, the program doesn't understand where the bibliography is. The .bib file and the document are in the same folder.
What I tried:
Triple checked code in bibliography using tools such as https://biblatex-linter.herokuapp.com/
Clear the cache of all documents.
change the natbib in the command \usepackage[backend=biber,style=authoryear, natbib]{biblatex} to biber -> doesn't seem to work.
Left out natbib and got same result. \usepackage[backend=biber,style=authoryear, natbib]{biblatex} => \usepackage[backend=biber,style=authoryear]{biblatex}
Add the command \usepackgage{natbitb} in addition to biblatex but this produces compatibility issues.
Add the codes \usepackage[utf8]{inputenc} &
\usepackage{babel,csquotes,xpatch} because they are recommendet by this biblatex cheat sheet: http://tug.ctan.org/info/biblatex-cheatsheet/biblatex-cheatsheet.pdf. Didn't change anything.
Thanks for your time!
I had a similar problem, what helped me was looking up the articles and rewriting them via the Google Scholar bibTex version.
The problem arose as I changed the name manually. This results in an error which is not recognized. And this threw me into researching exactly the same kind of .bib file not recognized error.
Your housing article should be formatted like this:
#article{hsieh2019housing,
title={Housing constraints and spatial misallocation},
author={Hsieh, Chang-Tai and Moretti, Enrico},
journal={American Economic Journal: Macroeconomics},
volume={11},
number={2},
pages={1--39},
year={2019}
}
I found another source of this problem Citavi generates invalid bibtex syntax. Often the year field is not correctly filled or special characters are not escaped properly. Maybe these are data errors which have their origin in the sources not in Citavi, but nonetheless often Citavi does not export valid bibtex format.

How to add "Forthcoming" to year bibliography field in pandoc/pandoc-citeproc

I'm trying to cite a paper that is forthcoming, and unfortunately if I put year = {Forthcoming} in my BibTeX citation entry, pandoc-citeproc always takes this as n.d. (e.g. "Greig (n.d.)" in footnotes/bibliography entry). Ideally it'd be nice to have it just output Forthcoming (e.g. "Greig (Forthcoming").
I tried searching here and other places for solutions to this issue, but couldn't find anything. I then tried using some suggested solutions from others with a standard LaTeX/BibTeX output---e.g. here: https://jblevins.org/log/forthcoming.
I attempted this (from the link above):
#Preamble{ " \newcommand{\noop}[1]{} " }
#Article{smith-2011,
author = "John Smith",
year = 2011,
journal = "Unorganized Scholarly Impressions",
...
}
#Article{smith-inpress-a,
author = "John Smith",
year = "\noop{3001}in press",
journal = "Journal of Nothingness",
...
}
#Article{smith-inpress-b,
author = "John Smith",
year = "\noop{3002}forthcoming",
journal = "Review of Random Thoughts",
...
}
Unfortunately pandoc-citeproc doesn't seem to do anything with \noop{xxx}forthcoming---I still get n.d. in the resulting citation. I would otherwise expect Forthcoming (e.g. "Greig (Forthcoming) ...").
How would I then go about that when exporting citations via pandoc/pandoc-citeproc?
I haven't worked out totally how to implement this myself, but for "forthcoming" works, the variable you'll want to use is "status" and not "year". You can look at this closed issue from JGM to see a bit about usage here.

How do you check in code if a request matches an EPiServer Visitor Group

We've set up a new "visitor group" in EPiServer 6r2, and we want to add a css class to the <body> tag of the site if the user is in that group, so different groups get different site designs. I'm trying to find out if the current visitor is in a matching group in the code-behind of a masterpage file in order to add this extra class and can't get the below code to return anything but false.
I'm not sure if the role name mentioned is the name you enter in the CMS UI when adding a visitor group.
Paul Smith blogged a proposed solution to this but I haven't been able to get it to return anything but false yet, and judging by the only comment on the blog article I'm not alone. Code sample #1 from this link (which is the one I'm using):
using EPiServer.Personalization.VisitorGroups;
...
bool match = EPiServer.Security.PrincipalInfo.CurrentPrincipal
.IsInRole("My Visitor Group", SecurityEntityType.VisitorGroup);
I found the developer guide to membership and role providers which states that replacePrincipal must be set to true for the correct principal to be in place. I checked and this is already the case for my config.
Documentation
EPiServer 7 doc
IPrincipal.IsInRole() extension
SecurityEntityType enum
Oddly I searched the 6r2 documentation from http://sdk.episerver.com/ and can't find the documentation for IPrincipalExtensions at all, even though I see the class in object browser in 6.2. in my sln. Details: Assembly EPiServer.ApplicationModules - C:\Windows\assembly\GAC_MSIL\EPiServer.ApplicationModules\6.2.267.1__8fe83dea738b45b7\EPiServer.ApplicationModules.dll - public static bool IsInRole(this System.Security.Principal.IPrincipal principal, string role, EPiServer.Security.SecurityEntityType type)
Member of EPiServer.Personalization.VisitorGroups.IPrinicipalExtensions
Please comment if you spot errors or I've missed anything as coding for EPiServer is a bit of a fog-of-war affair and I'm a little battle-weary.
Found it by browsing the object model and guessing. So much for documentation.
using EPiServer.Personalization.VisitorGroups;
using EPiServer.Security;
const string visitorGroupName = "Some users";
var groupHelper = new VisitorGroupHelper();
bool isPrincipalInGroup = groupHelper.IsPrincipalInGroup(
PrincipalInfo.CurrentPrincipal, visitorGroupName);
Tested and working in EPiServer 6r2 (aka 6.1).
String visitorGroupName must match the string entered into the "Name" box on the EPiServer admin interface when creating / editing the visitor group. See screenshot below:

Google App Engine, How to automatically load model class for ReferenceProperty

I have modular project structure, like this:
./main.py
./app.yaml
../articles
.../__init__.py
.../models.py
../blog
.../__init__.py
.../models.py
../comments
.../__init__.py
.../models.py
I have defined models in file models.py for each package (this is application). I have defined next models for "comments" application:
class Comment(db.Model):
author = db.UserProperty(auto_current_user_add=True)
title = db.StringProperty(default="Title")
text = db.TextProperty("Message", default="Your message")
# references to any model
object = db.ReferenceProperty()
and in "articles" application I have defined next models:
class Article(db.Model):
author = db.UserProperty(auto_current_user_add=True)
title = db.StringProperty(default="Title")
text = db.TextProperty("Message", default="Your message")
1) On first loading of page - I create new article:
from articles.models import Article
article = Article(title="First article", text="This is first article")
article.put()
2) On second loading of page I create new comment:
from articles.models import Article
from comments.models import Comment
article = Article.get_by_id(1)
comment = Comment(title="First comment", text="This is first comment")
comment.put()
3) On thind loading of page, I want to see all comments for all articles, blogs, and other objects in whole datastore:
from comments.models import Comment
comments = Commen.all()
for comment in comments:
# print comment and article title
print "%s: %s" % (comment.title, comment.object.title)
Actual result: "KindError: No implementation for kind 'Article'"
Expected result: automatically detect object type for reference and load this class
See more on: http://code.google.com/p/appengine-framework/issues/detail?id=17
Project need your help!
In order to be able to return entities of a given kind, App Engine has to be able to find the Model class for it. There's no mechanism built in for doing so, because all it has to look it up with is the entity kind, which can be any arbitrary string.
Instead, import the modules containing the models you may reference from the module containing the Comment model. That way, any time you can perform a query on Comment, all the relevant models are already loaded.
In my project GAE framework I have solve this issue. On the first page loading I have load all models in memory.
What if we have models with the same name, for example Comment model in "blog" and "board" applications? In this case we have automatically add prefix for models for the King of this model. In result we have the different names for models in different applications: BlogComment and BoardComment.
You can learn more in source code to understand how we do this implementation.

Resources