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?

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes) Report
> Merging [#260](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes) (07d59f6) into [develop](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/commit/724897e30317df36f65e5568c988f260bf041e21?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes) (724897e) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260/graphs/tree.svg?width=650&height=150&src=pr&token=muwumsyejV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes)](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes)

```diff
@@            Coverage Diff            @@
##           develop      #260   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        47           
  Lines         2154      2154           
  Branches       237       237           
=========================================
  Hits          2154      2154           
```


| [Impacted Files](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes) | Coverage Δ | |
|---|---|---|
| [test/test\_footcite.py](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes#diff-dGVzdC90ZXN0X2Zvb3RjaXRlLnB5) | `100.00% <ø> (ø)` | |
| [src/sphinxcontrib/bibtex/style/referencing/foot.py](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes#diff-c3JjL3NwaGlueGNvbnRyaWIvYmlidGV4L3N0eWxlL3JlZmVyZW5jaW5nL2Zvb3QucHk=) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes). Last update [724897e...07d59f6](https://codecov.io/gh/mcmtroffaes/sphinxcontrib-bibtex/pull/260?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+C.+M.+Troffaes).


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)