From cd195279e99b0a88b99492c89305ac6486ebac6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 17 Feb 2020 15:41:39 +0100
Subject: [PATCH] Manual: workaround for incorrect display of macro-directives
 without arguments

The workaround consists in appending the names of those macro-directives with a
regular space followed by a zero-width space (U+200B).

An extra LaTeX declaration was also added in order to make this hack work with
the PDF.

Ref. #1707
---
 doc/manual/source/conf.py            | 1 +
 doc/manual/source/the-model-file.rst | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/manual/source/conf.py b/doc/manual/source/conf.py
index 64d6888bbd..308bc58ba2 100644
--- a/doc/manual/source/conf.py
+++ b/doc/manual/source/conf.py
@@ -77,6 +77,7 @@ latex_elements = {
                     warningBorderColor={RGB}{255,50,50},OuterLinkColor={RGB}{34,139,34}, \
                     InnerLinkColor={RGB}{51,51,255},TitleColor={RGB}{51,51,255}',
     'papersize': 'a4paper',
+    'preamble': r'\DeclareUnicodeCharacter{200B}{}', # Part of the workaround for #1707
 }
 
 latex_documents = [
diff --git a/doc/manual/source/the-model-file.rst b/doc/manual/source/the-model-file.rst
index 096ebbf34b..2e6ffa269e 100644
--- a/doc/manual/source/the-model-file.rst
+++ b/doc/manual/source/the-model-file.rst
@@ -11025,8 +11025,8 @@ Macro directives
               @#ifdef MACRO_VARIABLE
               @#ifndef MACRO_VARIABLE
               @#elseif MACRO_EXPRESSION
-              @#else
-              @#endif
+              @#else ​
+              @#endif ​
 
     |br| Conditional inclusion of some part of the ``.mod`` file. The lines
     between ``@#if``, ``@#ifdef``, or ``@#ifndef`` and the next ``@#elseif``,
@@ -11114,7 +11114,7 @@ Macro directives
               @#for MACRO_VARIABLE in MACRO_EXPRESSION when MACRO_EXPRESSION
               @#for MACRO_TUPLE in MACRO_EXPRESSION
               @#for MACRO_TUPLE in MACRO_EXPRESSION when MACRO_EXPRESSION
-              @#endfor
+              @#endfor ​
 
     |br| Loop construction for replicating portions of the ``.mod``
     file. Note that this construct can enclose variable/parameters
@@ -11187,7 +11187,7 @@ Macro directives
     |br| Asks the preprocessor to display some error message on standard
     output and to abort. The argument must evaluate to a string.
 
-.. macrodir:: @#echomacrovars
+.. macrodir:: @#echomacrovars ​
               @#echomacrovars MACRO_VARIABLE_LIST
               @#echomacrovars(save) MACRO_VARIABLE_LIST
 
-- 
GitLab