# How do one think about $\mathcal{O}_X(D)$?

The notation $\mathcal{O}_X(D)$ appears a lot in algebraic geometry, for which I get confused sometimes. More specifically my question is the following:

1. When is $\mathcal{O}_X(D)$ defined, and is it always a line bundle? Is the $D$ appear here always a Cartier divisor? Is it true that when $D$ is Cartier divisor, then this is always a line bundle? Does there exist example when $\mathcal{O}_X(D)$ is not a line bundle?

2. In the cases $\mathcal{O}_X(D)$ is a well-defined line bundle, how do people view them? Which way is good in which contexts?

Thanks, minimax

-
Have you opened a book on algebraic geometry (for example EGA or Liu)? $\mathcal{O}_X(D)$ is the line bundle associated to the Cartier divisor $D$, this construction can be found everywhere. For every scheme $X$, it induces an injective group homomorphism $\mathrm{CaCl}(X) \to \mathrm{Pic}(X)$, whose image consists of all invertible subsheaves of $\mathcal{M}_X$ (the sheaf of meromorphic functions). If $X$ is noetherian and reduced, this homomorphism is an isomorphism. –  Martin Brandenburg Jan 5 at 18:13
Dear @MartinBrandenburg, it looks like Hartshorne does not use this notation, nor does Shafarevich, and it is only barely mentioned in Eisenbud and Harris, so it is quite likely that the OP did open a book, and did not see, or realise he was seeing, what he was looking for. –  Andrew Jan 6 at 6:38
@MartinBrandenburg: I have read sections in Liu, thanks for the clarification! –  minimax Jan 9 at 3:45