This is a tricky question. I am not sure whether you are in practice required to refer to the post that helped you if you just got the idea of how to fix a TeX related problem via this site.
If you are asking about attribution check the bottom right of every page and you will find a link to the license CC BY-SA 3.0 which is how material on Stack Exchange is licensed. It says
Attribution — You must attribute the work in the manner specified by
the author or licensor (but not in any way that suggests that they
endorse you or your use of the work).
However some users have relicensed the code in their answers by answering to a meta question or by a statement in their profile which means that code by those users are available under different conditions.
I am not a lawyer and not knowledgeable enough to say how to interpret licenses on what is really required when it comes to attribution but it seems overly strict if you have to include notices in your typeset material, e.g. in resulting PDF. However, it makes sense to include a comment in your source with a link to the post that helped you. This is what I usually do. Here is a LaTeX example
\usepackage[T1]{fontenc}% Load after fonts http://tex.stackexchange.com/a/49775/5701
and here is an example from my .emacs
(setq reftex-cite-format ; Use ReTeX with biblatex http://tex.stackexchange.com/a/31992/5701
'((?t . "\\textcite[]{%l}")
(?a . "\\autocite[]{%l}")
(?c . "\\cite[]{%l}")
(?s . "\\smartcite[]{%l}")
(?f . "\\footcite[]{%l}")
(?n . "\\nocite{%l}")
(?b . "\\blockcquote[]{%l}{}")))))
There are more reasons for including comments that references posts on Stack Exchange (or to any other places) that explains a technique than to comply with licenses:
- It helps you keep track of where you the idea for a particular technique.
- It serves to document your source, e.g. others will have an easier time understanding your code.