Fix issues in this cell, refactor it to the rules, don't add imports to it, make the output use latex and markdown, check that the code it correct