Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mathematical Notation in REDCap Online Data Collection Instruments

ai-assisted code

This repository holds digital resources associated with the article "Mathematical notation in REDCap online data collection instruments" [1]. That article discusses rendering LaTeX mathematical notation as images in REDCap [2, 3] online surveys. An example survey is provided, using questions drawn from a study of students' perceptions of physico-mathematical concepts [4].


Browser-based survey questions with mathematical notation such as fractions, Greek letters, subscripts and superscripts.

Figure 1. REDCap survey with LaTeX-derived mathematical notation.
Equations are SVG images generated via LuaLaTeX and pdftocairo.
Adapted from [1].

Table of Contents

Key Files

File Notes
assets/equation[dd].svg Vector graphics renderings of equations.
src/build.ps1 PowerShell build script.
src/latex/equation[dd].tex
src/latex/typeface-config.tex
LaTeX equation generation files.
 
src/physico-mathematical-concepts.zip REDCap instrument.

Software Requirements

Software Notes
LuaLaTeX Available here. Free in major TeX distributions.
PowerShell
 
 
Free.
   Linux, macOS: available here.
   Windows: included in Windows 7 and Windows Server 2008 R2 onwards.
REDCap
 
 
Details here.
   Free for non-profit, institutional use.
   Fee-based cloud or other hosted service otherwise.
pdftocairo
 
 
Free.
   Linux, macOS: available in poppler-utils.
   Windows: available in poppler-utils or the MiKTeX package miktex-poppler-bin.

LuaLaTeX Configuration

Please ensure the LuaLaTeX environment has the following packages installed:

  • GFSNeohellenicMath.
  • standalone.
  • unicode-math.

Quality Assurance

1. LaTeX Equation Generation Files

Typesetting the LaTeX files has been tested with LuaLaTeX, bundled with MiKTeX.

2. Vector Graphics Rendering of LaTeX Equations

Conversion of LuaLaTeX-output PDF files to SVG files has been tested with pdftocairo.

3. REDCap Instrument

Import of the instrument file has been tested with REDCap, accessed via a browser. Successful online rendering of the data collection instrument (a survey) was confirmed.

4. Testing Environment

Versions of each testing environment component are given below.

Type Component Version
Platform Operating system Windows 11, 25H2 (OS Build 26200.8737)
" Browser Microsoft Edge, 146.0.3856.62
Software LuaLaTeX LuaHBTeX, 1.25.7
" MiKTeX 26.5
" PowerShell 5.1
" REDCap 16.1.1
" pdftocairo 24.04.0
LuaLaTeX package GFSNeohellenicMath 1.02
" standalone 1.5a
" unicode-math 0.8r

Getting Started

Mathematics-to-image Rendering

Pre-built vector graphics (SVG) files of example equations, for online display, are available in the directory assets.

The SVG files were generated using the PowerShell build script src/build.ps1. It may be invoked by opening PowerShell, navigating to the directory src, then making a platform-relevant call:

Linux, macOS

./build.ps1

Windows

.\build.ps1

The build script operates as follows:

  1. LuaLaTeX compiles PDF files from LaTeX mathematical markup. Example LaTeX mathematical markup files are available in the directory src/latex. Those files use the standalone document class to crop PDF bounds to mathematics content.

  2. pdftocairo converts the PDF files to SVG format.

  3. To improve equation accessibility, ARIA roles with MathSpeak labels are set in the SVG files. LaTeX to MathSpeak converters are available online.

Managing Images

REDCap instruments can be configured to display images online with the REDCap Online Designer. Images can be included in instrument field labels, for example, by specifying a relevant src attribute of a HTML <img> tag. Target images may be stored remotely, or locally to a REDCap environment via the REDCap File Repository.

Example REDCap Survey

An example REDCap data collection instrument is available, src/physico-mathematical-concepts.zip. It demonstrates use of LaTeX to style and typeset mathematical notation online, albeit indirectly, via LaTeX rendered as images.

The instrument ZIP file may be uploaded into a REDCap project.

Note

The ZIP files holds links to images, that work with a specific REDCap File Repository. They will need modification for your REDCap project, e.g., via the REDCap Online Designer.

The associated images are the SVG files in assets. They may also be uploaded into a REDCap project File Repository, or other remotely accessible location, and associated links updated in Online Designer. Note, the example survey used HTML/CSS for manually fine-tuning equation image sizes and positioning.

Font Consistency

In testing the instrument in REDCap, the survey design options were set to use the Arial font. Text in field labels was explicitly set to use Arial via the Online Designer. LaTeX files were also configured to output Arial content.

Font choice is a matter for REDCap instrument designers. Consistency across design elements, such as that described here, is however recommended.

Acknowledgements

This work used REDCap electronic data capture tools [2, 3]. REDCap (Research Electronic Data Capture) is a secure, web-based software platform designed to support data capture for research studies, providing:

  • an intuitive interface for validated data capture,
  • audit trails for tracking data manipulation and export procedures,
  • automated export procedures for seamless data downloads to common statistical packages, and
  • procedures for data integration and interoperability with external sources.

This repository used Gemini 3.5 Flash [5] as an assistive tool to provide example JSON, LaTeX and PowerShell syntax. All other repository code, logic and architecture were created by the author.

References

  1. T. Stenborg, "Mathematical notation in REDCap online data collection instruments", TUGboat, vol. 47, no. 1, pp. 89–90, Apr. 2026, doi: 10.47397/tb/47-1/tb145stenborg-redcap.
    View PDF   View at publisher   SciX

  2. P. A. Harris, R. Taylor, R. Thielke, J. Payne, N. Gonzalez and J. G. Conde, "Research electronic data capture (REDCap)—A metadata-driven methodology and workflow process for providing translational research informatics support", J. Biomed. Inform., vol. 42, no. 2, pp. 377–381, Apr. 2009, doi: 10.1016/j.jbi.2008.08.010.
    View PDF   View at publisher   SciX

  3. P. A. Harris et al., "The REDCap consortium: Building an international community of software platform partners", J. Biomed. Inform., vol. 95, Jul. 2019, Art. no. 103208, doi: 10.1016/j.jbi.2019.103208.
    View PDF   View at publisher   SciX

  4. K. P. Mwangala, and O. Shumba, "Physico-mathematical Conceptual Difficulties among First Year Students Learning Introductory University Physics", Am. J. Educ. Res., vol. 4, no. 17, pp. 1238–1244, Nov. 2016.
    View at publisher   SciX

  5. Gemini 3.5 Flash. (Large language model, May 2026 release). Google. [Online]. Available: google.com.

About

Rendering LaTeX mathematics notation as images in REDCap online surveys.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages