In writing, there are many things one can do to make the text better.
Some basic rules of thumb include avoiding repetitions, avoiding passive voice, breaking down long and complicated sentences, or letting the reader to think for themselves.

Do such rules also apply to scientific texts, and if not, why?

For example, avoiding repetition may create confusion—it might not be immediately clear if the alternative term is just a synonym, or if it is different and in what way.
Moreover, using more advanced devices (or,  for that matter, sophisticated vocabulary) could be problematic even for native speakers.

There is a similar issue with regard to jokes and other distractions in the text. For example, [Concrete Mathematics](https://en.wikipedia.org/wiki/Concrete_Mathematics) is written using an informal style with margin notes containing tangentially-related remarks,
while [Abstract and Concrete Categories ­– The Joy of Cats](katmat.math.uni-bremen.de/acc/acc.pdf) includes besides "normal" diagrams, playful drawings of introduced concepts.
Personally, I find such additions entertaining, I like them a lot and in my opinion they add positive value. 
However, there are many people who are annoyed and think of them as unnecessary and distracting.
Furthermore, there also others who have "if you have time for this, you are not working hard enough" attitude, which also can have consequences.

Surely we need to make the text as accessible and clear as possible, but it would be great if it were also enjoyable to read.
Where lies the right balance?