Skip to content

Pure lua demo for Pandoc cross-references

License

Notifications You must be signed in to change notification settings

wenbopeng/luarefnos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

luarefnos

Pure lua implementation of table, figure, section and equation cross-references.

Sample usage

# Chapter 1

In-text references to @fig:1 [B] and @tab:foobar.

Multi-reference to [@fig:1 (A); the cool part of @fig:1; @fig:three]
and [@tab:foobar (very cool); *especially* @tab:foobar].

![The number one.](img/fig-1.png){#fig:1 width=1in}

![The unlabeled number two.](img/fig-1.png){#fig: width=1in}

![The number three.](img/fig-1.png){#fig:three width=1in}

Plot [-@fig:three] is given above, without adding the "Figure" prefix.

As seen in @tab:foobar, commas are handled properly.

## Equations {#equationchapter}

Equations, such as @eq:pythagoras, have to be put into a span with an id:

[$$a^2 + b^2 = c^2$$]{#eq:pythagoras}

## Tables

Foo Bar
--- ---
1   2

Table: With caption string {#tab:foobar border=1 attr2=foo}

Sample output

Chapter 1

In-text references to Figure 1B and Table 1.

Multi-reference to Figures 1 (A), the cool part of 1 & 3 and Tables 1 (very cool) & especially 1.

Figure 1: The number one.

Figure 1: The number one.

Figure 2: The unlabeled number two.

Figure 2: The unlabeled number two.

Figure 3: The number three.

Figure 3: The number three.

Plot 3 is given above, without adding the “Figure” prefix.

As seen in Table 1, commas are handled properly.

Equations

Equations, such as Equation 1, have to be put into a span with an id:

*a*2 + *b*2 = *c*2

Tables

Foo Bar
1 2

Table 1:With caption string

What about pandoc-xnos

Feature luarefnos pandoc-xnos
Figure references
Subfigures (✗)
Table references
Equation references
Section references (✔)
Clever references
Customization
Maturity 👶
Corner cases Many Probably none
Installation One file Python + 3 packages
Native docx references

Usage

Before anything can be referenced, it has to have an ID.

Figures

The native attribute syntax is reused:

![Figure caption here](fig.png){#fig:example}

Tables

A (not yet) native attribute block is at the end of the caption is applied to the table:

Col A Col B
----- -----
    1     2

: A table caption {#tab:example}

Equations

Display math in a span with an ID is counted:

[$$a^2 + b^2 = c^2$$]{#eq:pythagoras}

Sections

Section IDs are re-used, the sec: is added automatically!

# Section A

The section below has the number @sec:someotherid

# Section B {#someotherid}

Referencing

Citations with a namespace (e.g. sec:, fig: etc.) are replaced with the reference:

We reference @tab:example and @fig:example.

About

Pure lua demo for Pandoc cross-references

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 80.0%
  • TeX 17.9%
  • Shell 2.1%