Skip to content

xiaoyanit/TeXpert

Repository files navigation

TeXpert

LaTeX document preparation app for Android

Donate version is now available on Play store. To build it from source, see instruction at the end of the file.

TeXpert aims not only to be a TeX document development environment application like its counter parts TeXMaker or TeXworks on PC but also to provide a better experience on mobile TeX editing.

Features

The target of TeXpert is for tablets like Nexus 7:

  • lack physical keyboard
  • reasonably big screen for document editing
  • modern Android (4.2+)

Phone is not supported. I contemplate the following key features:

  1. Efficient input: complementing, not replacing, useful existing tools like SwiftKey
  • shortcut to insert commonly used TeX characters such as {, }
  • shortcut to insert frequently-used and user-defined commands via \newcommand (assuming that if the user defines a command, he/she wants to use it frequently in the document)
  • shortcut to insert labels, references
  • create document from templates
  1. Easy navigation
  • Link to document sections
  • Link to beamer frame
  1. Smart correction suggestion
  • Begin align --> \begin{align}
  • right arrow --> \rightarrow
  1. Integration with TeXPortal
  • load log file
  • open associated PDF
  • annotate generated log
  • link log line to source
  • clean up generated files
  1. Basic syntax highlighting: NO consideration for
  • \catcode`\[char]=[num] (cf. this Wiki page)
  • verbatim environment
  • complicated context-free grammar styling (e.g. math formulas in $$ ... $$)

Being a Turing-complete macro expansion programming language, TeX actually has NO grammar in the first place! Sometimes ago, I have tried to look for parsing part in TeX source code but (to my surprise) there was none.

  1. Document reorganization (inspired by Eclipse's refactoring features) such as
  • move \newcommand to preamble
  • rename defined command (in a context-sensitive way)
  • format the source code E.g. separate displayed math, \begin, \end, \item, or line comments to new line.
  • convert $$ ... $$ to the recommended \[ ... \]
  • textually align the array-kind environment

These features are ordered based on perceived importance.

Unlike their PC counterparts where one can easily type in the content. The unavailability of physical keyboard makes it substantially more laborious to write on Nexus 7. Many text editor tends to treat LaTeX editing as a special case of code editing. This is a prevalent viewpoint on PC. Yet I believe that source code and LaTeX editing are fairly different things.

What SwiftKey has to offer? What it lacks?

Availability of efficient input methods (IMEs or keyboards) is a great distinguishing factor of Android from other mobile platforms. Examples are SwiftKey, Swype and default IME of Jelly Bean 4.2.

SwiftKey has input prediction based on usage history, email messages, social media, etc. Unfortunately, this requires significant processing power and thus SwiftKey constantly crashes, especially on long texts. (It seems that whenever it is invoked, it reads the whole input field and update its internal database; resulting in sluggish and noticeable delay before the
keyboard is shown up.) Android 4.2 has a great improvement in its IMEs. It is much faster than SwiftKey and also has support for Swype gesture typing.

These IMEs are useful to input textual inputs. Yet, TeX documents typically consist of significant amount of special control characters, such as backslash \, curly braces { and }, or math shift $. To type these symbols, one usually have to press 2-3 buttons on the IME.

Technical Limitations

In most situation, TeXpert only supports files up to 2MB.

Build Instruction

  • Compile MuPDF library:
    • Modified files are in mupdf/ subdirectory. Main changes are:
      • File fitz/doc_document.c : Remove XPS/CBZ consideration & dependent extern functions in fz_open_document and fz_open_document_with_stream
      • File android/jni/Application.mk : Various tweaks following optimization tips from https://blog.algolia.com/android-ndk-how-to-reduce-libs-size/
      • File android/jni/Core.mk : Append LOCAL_CFLAGS line with -DNOCJK -DNODROIDFONT and remove XPS/CBZ-related source
      • File android/jni/mupdf.c : Change package to lah.texpert, remove unused functions and simplify some of them
    • Follow the build instruction of MuPDF i.e. execute make generate and then ndk-build in the android/. The shared libraries are in android/libs/. Just copy them to TeXpert.
    • Note: All directories mentioned here are relative to root of extracted MuPDF source package.
  • Clone my projects LAHIndex and LAHWidgets
  • Import to Eclipse and build

About

TeX document preparation Android app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published