# Non-duplicate question with overlapping answer

The question datetime2 define dates "globally" outside of \begin{document} has been marked as a duplicate of Formatting datetime2 in LaTex to 4th September, 2016 without the current day? but the questions aren't actually duplicates even though the code in the answer of one is a subset of the code from an answer in the other.

The first question is asking how to define dates in the preamble for later use (migrating from datetime to datetime2). Although it's been tagged as , the question isn't actually asking how to format the date. The minimal answer to this question is

\documentclass{article}

\usepackage{datetime2}

\DTMsavedate{sample}{2017-01-31}

\begin{document}
\DTMusedate{sample}

\end{document}


The second question is asking how to display the date in a particular format (using either datetime or, preferably, datetime2). The minimal answer to this question is

\documentclass{article}

\usepackage[UKenglish]{babel}
\usepackage[useregional]{datetime2}

\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}}

\begin{document}
\today
\end{document}


However, this question provided a slightly modified MWE from the first. When I answered it, I automatically converted the date storage command used in the MWE, so the OP was able to correctly deduce the answer to the other question from it and posted the solution, but the question was then closed as a duplicate.

There was no discussion about the questions being duplicates before the answer was posted, and the first answer to be posted in the second question certainly doesn't answer the first question.

I'm sure I've seen other questions where an answer has taken a subset of code from another answer (although I can't remember examples off the top of my head), follow-on questions quite often contain code from an earlier answer, and if the OP had posted one question with two parts (storing and displaying) it might've triggered an "ask one question per post" comment.

What's the reasoning behind the close vote when there are plenty of follow-on questions that expand on an answer to an earlier question?

• I agree with you. But I suspect the answer containing "The answer is here" with a link to the other question caused people to decide (without much real investigation) that the question was indeed a duplicate. But questions should be closed on the basis identity of question not identity of answer. – Alan Munn Sep 6 '16 at 13:24

I was the first to cast a vote-to-close for datetime2 define dates "globally" outside of \begin{document} (see the post timeline) as I am a firm believer that a duplicate question is defined by the answer 99 times out of 100. I noted the OP posting "The answer is here" as the lead-in to the answer, visited the link and saw similarities, so I voted to close. I should have read the differences in the answers more closely...