refactoring gerar latext