Etiquetas y referencias
ComdTeX numera automáticamente ecuaciones, figuras, tablas, secciones y entornos, y permite referenciarlos desde cualquier parte del documento con la sintaxis @prefijo:nombre. Estas etiquetas también exportan de forma limpia a LaTeX/Overleaf, así que el mismo documento sirve para trabajar en ComdTeX y para compilar en Overleaf sin retocar nada.
Ecuaciones numeradas
Cada bloque $$...$$ se numera secuencialmente; la etiqueta es opcional:
$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\, e^{-2\pi i x \xi}\, dx
$$ {#eq:fourier}
Equation @eq:fourier shows that $\hat{f}$ depends linearly on $f$.
@eq:fourier se resuelve como un enlace clicable (1) en la vista previa.
Figuras
Las figuras se numeran igual, con la etiqueta entre llaves después de la imagen:
{#fig:label}
La referencia @fig:label se resuelve como un enlace “Figura N” (“Figure N” si la interfaz o el lang de la nota está en inglés).
Tablas
Las tablas Markdown también se pueden etiquetar, con la etiqueta en su propia línea justo después de la tabla:
# Introduction {#sec:intro}
See @sec:intro and @tbl:constants for notation.
| Symbol | Meaning |
|---|---|
| $G$ | Group |
| $e$ | Identity |
{#tbl:constants}
Encabezados
Cualquier encabezado se puede etiquetar de la misma forma, colocando {#sec:nombre} al final de la línea del título, como se ve arriba con # Introduction {#sec:intro}.
Tabla de prefijos
| Prefijo | Uso |
|---|---|
sec: | Encabezados |
eq: | Ecuaciones en bloque |
fig: | Figuras |
tbl: | Tablas Markdown |
thm:, lem:, cor:, prop:, def:, ex:, exc: | Entornos tipo teorema |
El panel de Etiquetas
Abre el panel Etiquetas para auditar todo el sistema de referencias del vault de un vistazo: referencias rotas (apuntan a una etiqueta que no existe), etiquetas duplicadas (dos bloques con el mismo nombre) y etiquetas sin usar (definidas pero nunca referenciadas). Es el lugar donde detectar antes de exportar que un @thm:bolzano quedó mal escrito o que una etiqueta se repitió sin querer.
Referencias entre archivos
Los entornos matemáticos (teoremas, lemas, definiciones, etc.) admiten además referencias cruzadas entre archivos distintos del vault, con la forma @documento@prefijo:nombre, usando la ruta relativa al vault sin extensión. Por ejemplo, @gp/calendario@def:valor referencia la definición valor en el archivo gp/calendario.md. Si el archivo o la etiqueta contienen espacios, existe una forma alternativa entre corchetes: @[mi carpeta/mi nota]@def:valor. Las rutas con tildes u otros caracteres especiales también usan la forma con corchetes (@[Álgebra/Teoría]@thm:x); el editor la escribe por ti al completar una referencia.
Al exportar a LaTeX, una referencia cruzada entre archivos no puede convertirse en un \ref{} real (el entorno de destino vive en otro documento y está ausente de una exportación de un solo archivo), así que ComdTeX la reemplaza por texto plano que nombra el documento de origen, en vez de dejar un \ref que compilaría como ??.
Mientras escribes
El editor te ayuda con todo esto al teclear: @thm: lista las etiquetas de ese tipo con su número y título, {# propone una etiqueta única para el encabezado o entorno de la línea, el editor subraya las referencias que no apuntan a nada, y Ctrl+clic o F12 sobre una referencia salta a su definición. Ver El editor.
Material suplementario
Un paper suele traer un suplemento cuyas figuras y tablas se numeran aparte del texto principal. Pon esta línea sola donde empieza el suplemento:
<!-- supplement -->
Desde esa línea, cada figura y tabla reinicia en 1 con el prefijo S: los pies de la vista previa dicen “Figura S1” y “Tabla S1”, y las referencias @fig: y @tbl: a ellas las siguen. El panel de Etiquetas muestra los mismos números.
- Las ecuaciones conservan una sola numeración en todo el documento, porque las revistas rara vez piden “Ecuación S1”.
- El marcador es un comentario HTML, así que es invisible en Obsidian y en cualquier otro visor de Markdown.
- Solo cuenta el primer marcador. Un segundo no hace nada.
- Exportar como .tex reinicia los contadores de figuras y tablas en ese punto, de modo que se imprimen como S1, S2 y así sucesivamente. Las exportaciones de texto (Markdown, Obsidian, DOCX, PDF) escriben las referencias S completas.
Labels and references
ComdTeX automatically numbers equations, figures, tables, sections, and environments, and lets you reference them from anywhere in the document with the @prefix:name syntax. These labels also export cleanly to LaTeX/Overleaf, so the same document works for editing in ComdTeX and for compiling on Overleaf without touching anything.
Numbered equations
Every $$...$$ block is numbered sequentially; the label is optional:
$$
\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\, e^{-2\pi i x \xi}\, dx
$$ {#eq:fourier}
Equation @eq:fourier shows that $\hat{f}$ depends linearly on $f$.
@eq:fourier resolves to a clickable (1) link in the preview.
Figures
Figures are numbered the same way, with the label in braces after the image:
{#fig:label}
The reference @fig:label resolves to a “Figure N” link (“Figura N” when the interface or the note’s lang is Spanish).
Tables
Markdown tables can be labeled too, with the label on its own line right after the table:
# Introduction {#sec:intro}
See @sec:intro and @tbl:constants for notation.
| Symbol | Meaning |
|---|---|
| $G$ | Group |
| $e$ | Identity |
{#tbl:constants}
Headings
Any heading can be labeled the same way, placing {#sec:name} at the end of the title line, as shown above with # Introduction {#sec:intro}.
Prefix table
| Prefix | Use |
|---|---|
sec: | Headings |
eq: | Display equations |
fig: | Figures |
tbl: | Markdown tables |
thm:, lem:, cor:, prop:, def:, ex:, exc: | Theorem-like environments |
The Labels panel
Open the Labels panel to audit the whole vault’s reference system at a glance: broken references (pointing at a label that does not exist), duplicate labels (two blocks with the same name), and unused labels (defined but never referenced). It is the place to catch a misspelled @thm:bolzano or an accidentally repeated label before you export.
Cross-file references
Math environments (theorems, lemmas, definitions, etc.) also support cross-references between different files in the vault, in the form @document@prefix:name, using the vault-relative path with no extension. For example, @gp/schedule@def:value references the definition value in the file gp/schedule.md. If the file or label contains spaces, there is an alternative bracketed form: @[my folder/my note]@def:value. Paths with accents or other special characters use the bracketed form too (@[Géométrie/Théorème]@thm:x); the editor writes it for you when it completes a reference.
When exporting to LaTeX, a cross-file reference cannot become a real \ref{}: the target environment lives in another document and is absent from a single-file export, so ComdTeX replaces it with plain text naming the source document, instead of leaving a \ref that would compile as ??.
While you write
The editor helps with all of this as you type: @thm: lists the labels of that kind with their number and title, {# proposes a unique label for the heading or environment on the line, the editor underlines references that point nowhere, and Ctrl+click or F12 on a reference jumps to its definition. See The editor.
Supplementary material
A paper often ships a supplement whose figures and tables are numbered apart from the main text. Put this line on its own where the supplement starts:
<!-- supplement -->
From that line on, every figure and table restarts at 1 with an S prefix: the preview captions read “Figure S1” and “Table S1”, and @fig: and @tbl: references to them follow. The Labels panel shows the same numbers.
- Equations keep one numbering through the whole document, since journals rarely ask for “Equation S1”.
- The marker is an HTML comment, so it is invisible in Obsidian and any other Markdown viewer.
- Only the first marker counts. A second one does nothing.
- Export as .tex restarts the figure and table counters at that point, so they print as S1, S2 and so on. The text exports (Markdown, Obsidian, DOCX, PDF) write the S references out in full.