Repository: mcmtroffaes/sphinxcontrib-bibtex

Issue:
Add a footnote citation at the end of a sentence
It is not uncommon to write a footnote in English like this:

> ... curve.¹

As I cannot write the role directly after the `.` in RST I can only write:

```rst
... curve. :footcite:`Name2021`
```

which produces

![note_wrong](https://user-images.githubusercontent.com/173624/125063753-2a17c980-e0b0-11eb-9d8c-e40c390772b8.png)

It should more look like this

![note_correct](https://user-images.githubusercontent.com/173624/125063772-30a64100-e0b0-11eb-931b-942e7f8a9a86.png)

Is there a trick to make this work?

Comments:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4cc4127..e35f5c0 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,12 @@
 * Allow specific warnings to be suppressed (see issue #255, contributed by
   stevenrhall).
 
+* Remove space between footnote and author for textual footnote citations in
+  the default foot referencing style.
+
+* Document how to use a backslash escaped space to suppress space before
+  footnotes (see issue #256, reported by hagenw).
+
 2.3.0 (1 June 2021)
 -------------------
 
diff --git a/README.rst b/README.rst
index c25e5e7..cf32819 100644
--- a/README.rst
+++ b/README.rst
@@ -108,17 +108,21 @@ represented by footnotes as follows:
 .. code-block:: rest
 
    See :footcite:t:`1987:nelson` for an introduction to non-standard analysis.
-   Non-standard analysis is fun :footcite:p:`1987:nelson`.
+   Non-standard analysis is fun\ :footcite:p:`1987:nelson`.
 
    .. footbibliography::
 
 which will get rendered as:
 
-See Nelson [#Nel87b]_ for an introduction to non-standard analysis.
-Non-standard analysis is fun [#Nel87b]_.
+See Nelson\ [#Nel87b]_ for an introduction to non-standard analysis.
+Non-standard analysis is fun\ [#Nel87b]_.
 
 .. [#Nel87b] Edward Nelson. *Radically Elementary Probability Theory*. Princeton University Press, 1987.
 
+Note the use of the
+`backslash escaped space <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#inline-markup>`_
+to suppress the space that would otherwise precede the footnote.
+
 Typically, you have a single ``footbibliography`` directive
 at the bottom of each document that has footnote citations.
 Advanced use cases with multiple ``footbibliography`` directives
diff --git a/doc/usage.rst b/doc/usage.rst
index 031a130..f17d157 100644
--- a/doc/usage.rst
+++ b/doc/usage.rst
@@ -278,19 +278,23 @@ Roles and Directives
 
    .. code-block:: rest
 
-      We will make use of non-standard analysis :footcite:p:`1987:nelson`.
+      We will make use of non-standard analysis\ :footcite:p:`1987:nelson`.
 
    which would be equivalent to the following LaTeX code:
 
    .. code-block:: latex
 
-      We will make use of non-standard analysis \footcite{1987:nelson}.
+      We will make use of non-standard analysis\footcite{1987:nelson}.
+
+   Note the use of the
+   `backslash escaped space <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#inline-markup>`_
+   to suppress the space that would otherwise precede the footnote.
 
    As with all citation roles, multiple keys can be specified:
 
    .. code-block:: rest
 
-      I love analysis :footcite:p:`1987:nelson,2001:schechter`!
+      I love analysis\ :footcite:p:`1987:nelson,2001:schechter`!
 
 .. rst:role:: footcite:t
 
diff --git a/src/sphinxcontrib/bibtex/style/referencing/foot.py b/src/sphinxcontrib/bibtex/style/referencing/foot.py
index 69e95b9..8431d12 100644
--- a/src/sphinxcontrib/bibtex/style/referencing/foot.py
+++ b/src/sphinxcontrib/bibtex/style/referencing/foot.py
@@ -22,7 +22,7 @@ class FootReferenceStyle(GroupReferenceStyle):
     person: PersonStyle = PersonStyle()
 
     #: Separator between text and reference for textual citations.
-    text_reference_sep: Union["BaseText", str] = ' '
+    text_reference_sep: Union["BaseText", str] = ''
 
     def __post_init__(self):
         self.styles.extend([


Test patch:
diff --git a/test/test_footcite.py b/test/test_footcite.py
index 1cff584..533a56d 100644
--- a/test/test_footcite.py
+++ b/test/test_footcite.py
@@ -15,22 +15,22 @@ def test_footcite_roles(app, warning) -> None:
     tests = [
         ("p",           " [1] "),
         ("ps",          " [1] "),
-        ("t",           " de Du *et al.* [1] "),
-        ("ts",          " de Du, Em, and Fa [1] "),
-        ("ct",          " De Du *et al.* [1] "),
-        ("cts",         " De Du, Em, and Fa [1] "),
+        ("t",           " de Du *et al.*[1] "),
+        ("ts",          " de Du, Em, and Fa[1] "),
+        ("ct",          " De Du *et al.*[1] "),
+        ("cts",         " De Du, Em, and Fa[1] "),
         ("p",           " [2][3] "),
         ("ps",          " [2][3] "),
-        ("t",           " al Ap [2], Be and Ci [3] "),
-        ("ts",          " al Ap [2], Be and Ci [3] "),
-        ("ct",          " Al Ap [2], Be and Ci [3] "),
-        ("cts",         " Al Ap [2], Be and Ci [3] "),
+        ("t",           " al Ap[2], Be and Ci[3] "),
+        ("ts",          " al Ap[2], Be and Ci[3] "),
+        ("ct",          " Al Ap[2], Be and Ci[3] "),
+        ("cts",         " Al Ap[2], Be and Ci[3] "),
         ("p",           " [4][5][6] "),
         ("ps",          " [4][5][6] "),
-        ("t",           " Ge [4], Hu [5], Ix [6] "),
-        ("ts",          " Ge [4], Hu [5], Ix [6] "),
-        ("ct",          " Ge [4], Hu [5], Ix [6] "),
-        ("cts",         " Ge [4], Hu [5], Ix [6] "),
+        ("t",           " Ge[4], Hu[5], Ix[6] "),
+        ("ts",          " Ge[4], Hu[5], Ix[6] "),
+        ("ct",          " Ge[4], Hu[5], Ix[6] "),
+        ("cts",         " Ge[4], Hu[5], Ix[6] "),
     ]
     for role, text in tests:
         escaped_text = re.escape(text)
@@ -76,22 +76,22 @@ def test_footcite_style_custom(app, warning) -> None:
     tests = [
         ("p",           " [1] "),
         ("ps",          " [1] "),
-        ("t",           " de Du et al [1] "),
-        ("ts",          " de Du & Em & Fa [1] "),
-        ("ct",          " De Du et al [1] "),
-        ("cts",         " De Du & Em & Fa [1] "),
+        ("t",           " de Du et al[1] "),
+        ("ts",          " de Du & Em & Fa[1] "),
+        ("ct",          " De Du et al[1] "),
+        ("cts",         " De Du & Em & Fa[1] "),
         ("p",           " [2][3] "),
         ("ps",          " [2][3] "),
-        ("t",           " al Ap [2]; Be & Ci [3] "),
-        ("ts",          " al Ap [2]; Be & Ci [3] "),
-        ("ct",          " Al Ap [2]; Be & Ci [3] "),
-        ("cts",         " Al Ap [2]; Be & Ci [3] "),
+        ("t",           " al Ap[2]; Be & Ci[3] "),
+        ("ts",          " al Ap[2]; Be & Ci[3] "),
+        ("ct",          " Al Ap[2]; Be & Ci[3] "),
+        ("cts",         " Al Ap[2]; Be & Ci[3] "),
         ("p",           " [4][5][6] "),
         ("ps",          " [4][5][6] "),
-        ("t",           " Ge [4]; Hu [5]; Ix [6] "),
-        ("ts",          " Ge [4]; Hu [5]; Ix [6] "),
-        ("ct",          " Ge [4]; Hu [5]; Ix [6] "),
-        ("cts",         " Ge [4]; Hu [5]; Ix [6] "),
+        ("t",           " Ge[4]; Hu[5]; Ix[6] "),
+        ("ts",          " Ge[4]; Hu[5]; Ix[6] "),
+        ("ct",          " Ge[4]; Hu[5]; Ix[6] "),
+        ("cts",         " Ge[4]; Hu[5]; Ix[6] "),
     ]
     for role, text in tests:
         escaped_text = re.escape(text)