I am modifiyng some macros to enforce a section style that should end with a full stop. The full stop is added automatically, but sometimes people add the full stop and I get two. How can I modify the code to detect the punctuation and add it only if it is needed? I guess I need to use futurelet, but I don't know how to use it.
Firstly it is always best to post a MWE. As you have not posted one I am posting a general answer, for exact formatting of the section you will need to add your own formatting commands.
You don't need a
The rest of the code are minor details. Here is the MWE.
If you want the macro to work both for
and test with
You can also visit the link quoted by Philippe Goutet in the comments below.
The problem can be solved at a macro level without 'meddling' with the space factor.