Marcio Cunha

How to cite code snippets and diagrams in ABNT

Learn how to adapt software code blocks, architecture diagrams, and system tables to ABNT standards for academic projects and theses.

Marcio Cunha•3 min
Also available in:PortuguêsEspañol
Summary
  • Extensive code blocks must be inserted as illustrations or appendices depending on their overall length.
  • The source and explanatory notes must appear immediately below any technical figure or table.
  • The use of monospaced fonts preserves original indentation and prevents visual breaks in text editors.
  • Architectural diagrams require standardized labeling with sequential numbering linked to the element type.
  • Short snippets integrated into the paragraph do not require special figure formatting if clearly highlighted.

The challenge of documenting systems in academic standards

Writing a thesis or scientific paper in the technology sector brings a classic friction: how to fit purely technical structures, such as code snippets, microservices architecture diagrams, and database tables, into the rigid rules of ABNT. In practice, this means translating the visual and syntactic language of software into the formal standard of paper, margins, and fonts. The big mistake most students make is trying to paste screenshots or entire scripts in any way, generating formatting issues that compromise the final grade and methodological rigor. ABNT was not originally designed for modern software engineering, but with the correct adaptation of figures, illustrations, and tables, it is entirely possible to maintain technical elegance without breaking institutional norms.

When code becomes a figure, chart, or table in ABNT

The first major doubt when drafting technical documentation is deciding whether a software snippet should be treated as an illustration, table, or chart. In ABNT taxonomy, illustrations include charts, flowcharts, organizational charts, maps, and drawings, a category where architecture diagrams fit perfectly. Source code in languages like Python, JavaScript, or SQL creates a gray area: short blocks can be embedded directly into the paragraph flow using monospaced fonts, but extensive functional scripts are best treated as graphical elements or placed directly in appendices. If you need to organize structured data from an API or database migrations, using open-sided tables with clear headers resolves the demand precisely, aligning directly with guidelines discussed in how to structure automatic tables of contents in ABNT.

Golden rules for formatting code blocks and scripts

Formatting a code snippet within an academic paper requires rigorous aesthetic and functional care to ensure readability. Code should never be inserted as a low-resolution static image, as this prevents screen reader access and destroys visual quality when generating PDFs. Always prefer typing text using a standard monospaced font, maintaining a smaller font size than the body text and simple line spacing. Furthermore, indentation must be rigorously preserved with consistent spaces or tabs so that the algorithm's logic remains understandable to the evaluation committee. To prevent structural margin or pagination errors from ruining your document quality, check the detailed guidelines in why ABNT margins and pagination cause recurring errors in text editors.

How to label and reference technical diagrams and illustrations

Every technical diagram, whether an OAuth2 authentication flow or an entity-relationship model, must be preceded by a clear identification at the top, containing the word 'Figure', followed by the order number, dash, and descriptive title. Below the illustration, it is mandatory to insert the consulted source, even if the diagram was developed by the author, in which case the expression 'Source: Prepared by the author (2025)' is used. This traceability is essential to avoid plagiarism accusations and ensure academic integrity. If the diagram was extracted from official documentation or a third-party scientific paper, the complete citation must strictly follow authorship rules, complementing automated writing processes discussed in how to format ABNT references in Word automatically.

Essential precautions when finalizing the document for delivery

Before exporting your academic project to the final delivery format, perform a thorough check on all inserted graphic elements and code blocks. Verify that no line of code was cut off at the lateral margins due to excessive characters per line, adjusting font size or breaking long commands in a controlled manner. Also make sure that figure and table numbering is perfectly synchronized with the text, avoiding broken cross-references that confuse the evaluator. Visual consistency and respect for standards demonstrate the professionalism of the engineer or developer, proving mastery of both software construction and formal technical communication required by academia.