Lame Android Hero

### Welcome to Lame Android Hero

We are the group of developers behind various Android app dealing with TeX/LaTeX such as our user-friendly TeX/LaTeX compiler TeXPortal and our modern LaTeX editor TeXpert. This is our main support page where you will find lots of information relating to our distributed software.

For your enquiries and feedback, please send email to lameandroidhero at Google mail. We prefer having the name of the app and the nature of your enquiry to email subject.

### Refund Policy

Please note that we do not provide refund at personal request unless for specified reasons. Google Play gives a 15 minute grace period to test your purchased app. If you are not happy with the purchased application, please get the refund within this period via Google Play by yourself.

Under no circumstance will our app collect your personal data, save it to our server or publish for third-party.

Even so, bear in mind that we do use third-party advertisement API (Google's admob for particular example) and we do not know its working under the hood. Neither are we aware of Android's internal working so we cannot guarantee that your data is never collected or misused by third-party such as Google or your device manufacturer.

# TeXPortal

TeXPortal is an application to typeset TeX documents, targeting mainly at academic researchers.

### Features

Local TeX distribution

As its primary goal, TeXPortal HELPs compile their TeX documents on Android devices using common TeX engines such as TeX, pdfTeX, XeTeX, LuaTeX i.e. generate DVI, PDF output from the source code. Other useful companion programs commonly used by researcher (BibTeX, MakeIndex, MetaPost) are also provided. Of course, to be useful, a large collection of macro packages as those in Comprehensive TeX Archive Network (CTAN, TeX Live) is also supported.

There are available TeX compiling applications in Android market. Unfortunately, they mainly send the document to a remote server to handle the compilation task and then download the result. TeXPortal really works locally (but requires Internet access for downloading additional packages) and this is strongly desirable on mobile devices. It is a huge data bandwidth and waiting time saver in mobile devices where network access (usually wireless) is costly (3G/4G data plan) and much slower than wired access on PC. Local compilation also forstalls security issue of having to send document to unverified server. This also means TeX is always available, even if you are on a plane to your conference where no network access is available.

User friendly with automatic issue resolution

A secondary goal is to make TeX more amicable to users . To do that, we improvise a feature to resolve errors automatically by installing the right missing packages using hints in the generated log. This has an advantage of being much simpler (and hopefully more efficient) than MiKTeX, which probably performs lots of intercepts in TeX.

Optimized for mobile devices

Beyond that, a noteworthy advantage of TeXPortal is its minimalistic approach. That is to say, it acquires only necessary packages .

Major TeX distributions in PC install most TeX engines and accompanying utilities available. Because of that, they gorge lots of storage space. MiKTeX, for instance, consumes 300MB in its basic scheme; a similar amount is applicable to TeXLive. This is a huge space wastage since many users do not touch most distributed programs. A basic TeXPortal installation requires 2MB (for pdfTeX only) and 40MB for basic LaTeX packages (half of that if download packages are deleted), a saving factor of 5, extremely useful in limited storage mobile devices.

NO rooting

Last but not least, TeXPortal does not require rooting the device, unlike various dangerous methods available such as installing and utilizing a full Linux distributions via chroot . The advantage (of such approach) might be the availability of all TeX utilities at the expense of technical competence requirement from user's side.

### Usage

#### Basic operations

All operations are available in actions panel which is embedded in the UI on the left side (for large screen) or can be drawn out by dragging finger from the left edge of the screen. Compilation and package installation should be trivial.

This is some solution where one wants to forcibly kill a process started by TeXPortal such as compiling infinitely loop documents. As the last resort, TeXPortal allows user to kill a process it spawned. To do that, one needs to pick up process ID using some terminal emulator app.

Generation of font configuration is necessary if one intends to use XeTeX. Do it after font installation.

#### Customization

The settings panel can be drawn from the right edge. Current version allows one to change location to obtain packages: either from the developer's public Dropbox folder (recommended), one of TeX Live online archive or a local folder. Another option is the location to put TeX packages, indicated as TeXMF Root . The default location is TeXPortal's public folder which will be deleted after TeXPortal is uninstalled. The last option is for supported languages to use with package babel . US English is always enabled by default.

#### Install custom LaTeX packages (macros, document classes, etc.)

Under TEXMF root folder (c.f. above section), you might find several folders whose name starts with texmf such as texmf, texmf-dist, texmf-var. Let TEXMF refers to any of them.

LaTeX styles files (*.sty) should be placed in TEXMF/tex/latex/*/ where * can be any folder. For example, you can make a folder personal in TEXMF/tex/latex/ and then places all your personal styles there.

Many LaTeX packages such as shortlst or undertilde are distributed in source form ( *.dtx files , *.ins files). These packages usually need to be compiled into *.sty to be usable. In those cases, please consult their manuals for installation instructions. A good reference is this entry in LaTeX wikibook.

Note: After copying files into anywhere under TEXMF , one needs to update path databases. In TeXPortal, this is achieved by installing an empty list of package.

#### Install non-distributed fonts

This is a hard task which depends on the engine and we totally discourage users from installing custom fonts. Anyway, a good reference is again an article from LaTeX wikibook.

In general, to install fonts, there are two steps:
(i) Produce the font files (if necessary) and copy relevant files to correct locations (followed by path database update): font-related files (vf, afm, tfm, type1) should go to somewhere within TEXMF/fonts/ while *.sty, *.fd should go to TEXMF/tex/latex/*/ as above.
(ii) For fonts to be used in pdfTeX, one needs to add correct entries to font map file TEXMF/fonts/map/pdftex/updmap/pdftex.map . (TeXPortal provides a button to open this file in external editor.) Typically, font packages provide a *.map which should simply be appended to pdftex.map .

Our advice is that one should switch to modern engines like LuaTeX which simplifies much of font handling and automatically generates the necessary configurations at runtime.

### FACTS/FAQs

Is TeXPortal open-source? How do I develop app based on TeXPortal?

No. It used to be. Please consult our developer guide if you wish to develop applications that make advantage of TeX.

Note that TeXPortal uses the *TeX engines as command line programs from TeX Live project whose source code is available at TeX Live. You can grab a copy from our website as well. We compile the engines for Android with the help of the Android NDK released by Google. There is no linkage [in DLL/LIB/SO-sense of the word] between TeXPortal and the engines.

What is the difference between free version and paid version?

The paid version supports many features such as other engines (bibtex, luatex, metapost, ps2pdf), custom package installation, customize location of packages, customize babel languages, and kill a spawn process. The free version source code lags roughly 300-500 revisions behind the paid one.

Why can't I compile in background with TeXPortal Free?

Because the free version does not have feature to kill a spawned process, you might end up having indefinitely run processes in case TeXPortal is nominated to be killed by the Android system while running in the background. In that case, the only solution is to reset the device and this is undesirable. (The author already encountered this situation.)

Why is TeXPortal Free generally slower than paid version?

The free version provides advertisement feature and thus, suffers a bit in term of performance; for example, it has to perform garbage collection more frequently than paid version. As mentioned, free version's source code lags and is not enhanced anymore so it generally lacks a lot of bug fixes discovered in the development of the paid one. This is also the reason most features are stripped off.

What are the requested permissions for?

We require INTERNET and ACCESS_NETWORK_STATE to download additional packages and WRITE_EXTERNAL_STORAGE to write compilation outputs (PDF file, log, whatever) to sdcard. The free version in addition requires READ_PHONE_STATE, ACCESS_WIFI_STATE and ACCESS_COARSE_LOCATION to track app usage and provide targeted advertisements.

Shouldn't TeXPortal and TeXpert be a single app instead of two?
The main reason is due to the original author's design and in any case, we have no intention of merging them to honor his work. His explanations for such design choice are:
1. He did not intend to write TeXpert at all as he believed that there was a lot of good editors in the market already so he provided the facility for those editors to make use of TeXPortal as in described in our developer guide . Sadly, nobody was interested. Developing TeXpert as a separate app utilizing the specified developer guide is a way to illustrate and test that such idea works.
2. Two separating apps facilitate development processes. It is much faster to build and test each app individually. Unlike desktop software, there is no libraries linking (e.g. DLL for Windows) mechanism on Android.
3. RAM limit of earlier Android OS. In early days, Android apps are limited to 32MB heap memory. By separating into two apps, we can utilize 64MB. And TeXpert is memory consuming.
4. UNIX Philosophy: do one thing and do it best.

### For developers

TeXPortal can be invoked by external app to compile documents. This comes in handy if you want to make use of TeXPortal, for instance, in your TeX editing app. The following code snipet, which should be put in your activity, is to display a dialog to compile a file. For security reason, TeXPortal needs user consent to do compilation.

static final String TPARG_ENGINE = "TP_ENGINE";
static final ComponentName TEXPORTAL = new ComponentName("lah.texportal.donate",
"lah.texportal.CompileDocumentActivity");
startActivityForResult(new Intent().setComponent(TEXPORTAL)
.setData(Uri.fromFile(file_to_compile))
.putExtra(TPARG_ENGINE, engine),
TEXPORTAL_REQUEST_CODE);

Then, override method onActivityResult of your activity to get information returned by TeXPortal about user action.

static final String TP_TASK_ID = "TP_TASK_ID";
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TEXPORTAL_REQUEST_CODE:
if (resultCode == RESULT_OK) {
// User consent the request
} else if (resultCode == RESULT_CANCELED) {
// User cancel
}
break;
}
}

TeXPortal broadcasts the state changes of a task. To obtain information, implement and register a BroadcastReceiver with the following intent filter:

<intent-filter>
<action android:name="lah.texportal.NOTIFY_COMPILATION_STATUS" />
</intent-filter>

# TeXpert

TeXpert is LaTeX integrated writing app for Android.

### Features

Integrated Edit-Compile-View

As an integrated environment, TeXpert allows users to execute writing cycles (edit, compile (generate PDF output) via TeXPortal and view the result). As a result, it provides the convenience and productivity because it eliminates the hassles of switching back and forth between different applications. Meaning: one does not have to open, say TeXPortal, to (re)compile the document and wait for it to complete then open generated PDF with another app; finally using Android's Recent apps button or re-open the editing app to go back to continue editing the file.

The user interface is designed with usability optimization purpose. For instance, scrollbar is added for fast scrolling through the document.

TeXpert provides an embedded PDF viewer that can be displayed along side with the document.

Remark: TeXPortal is required to compile documents.

Syntax and Mathematics Highlighting

TeXpert provides fast syntax highlighting with little lagging. Noteworthy capability is mathematical formula highlighting , a feature rarely provided by editors. Even on PC, only TeX Maker seems to provide that capability.

LaTeX Specific

Beyond that, TeXpert understands LaTeX unlike general purpose text editors. It offers easy access to frequently used symbols in LaTeX documents such as dollar and backslash, hierarchical document outline (i.e. \chapter , \section , \subsection , etc.; Version 2.3.2 goes a step further by considering beamer frame 's.), annotated log, etc. These features facilitate much better navigation because writer usually works on organizational units and also help in debugging process.

TeXpert also provides smart code completion.

Cloud Storage Support

Further than being an editor, TeXpert simplifies lots of mundane storage operations such as downloading, editing and then uploading files back to cloud storage such as Dropbox. Not only that, from version 2.3.2, it hints user and acquires necessary resources for compilation, namely images in \includegraphics command or additional source in \input command and even bibliographic database. How inconvenience it is having to download all those files individually!

### Usage

Action panel
• Accessed by swiping from the left edge of the app screen: put your finger at the left side of the screen and move it to the right without lifting
• Most actions should be explanatory. We have some remark on some of them.
• Compile document: click to compile with primary engine (pdfLaTeX by default), long click to do BibTeX
• Open document: click on the button to browse your SD card, Google Drive or Dropbox for the document to open, long click to pick up a document from a list of recently opened document
• View PDF: click to view PDF (either split the screen or show the PDF fullscreen, depending on how you last close the PDF viewer), when the PDF viewer opens, it will attempt to jump to the position corresponding to the cursor position, long click to view PDF in external app such as Adobe Reader
• Extra keyboard: can select which keys to show in the Settings
• Document outline: click on item to jump to the code declaring that item; in case it is a referenced resource such as \input, long click on the item to open the resource file.
Embedded PDF viewer

The PDF viewer included in TeXpert provides SyncTeX technology to jump back to the position in the source document that generates the particular content in PDF file. To do that, long tap at a position in PDF file.

• Our SyncTeX implementation can only jump to the "correct" line so break lines frequently
• For this to work, make sure to open your document under /storage/emulated/0/ in the file explorer. The symbolic link /sdcard in Android actually points to /storage/emulated/legacy/.

Suggestion and expansion

TeXpert provides two mechanisms to assist you in your writing.

• Popup suggestion: Pop up the command matches your partially typed command, tap on the item from the pop up list to insert it to the document.

Note: One must check the option in Settings to enable this feature.

• Expansion via patterns: Press the button in the app's extra keyboard or Tab to expand the token at the cursor based on your defined expansion pattern. This feature is borrowed from TeXworks. Open Settings from action panel, click on Manage expansion pattern and then Add expansion pattern to open dialog to add patterns.

See this document for more details. Note that unlike TeXworks, we do not support bullet character. But you can add an #INS# in its place and use Ctrl+I to cycle through the #INS# and replace them.

Keyboard Shortcuts
• Can be viewed in Settings
• For your convenience, we list the keybinding here as well. Many combinations such as Ctrl+C and Ctrl+Z should be standard to remember.
File-related commands
Combination Action
Ctrl+N Create new document
Ctrl+O Open existing document (from SD card, Google Drive or Dropbox)
Ctrl+S Save current document
Ctrl+T or F1 Compile main document using the primary engine (pdfLaTeX by default, change in Settings).
Ctrl+B or F2 Do BibTeX
Ctrl+P View PDF: either split the screen to show the editor and PDF side-by-side or show PDF in fullscreen. Then jump to the PDF position corresponding to the code location at the editor's cursor.
Editing commands
Combination Action
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+A Select all
Ctrl+C Copy
Ctrl+X Cut
Ctrl+V Paste
Ctrl+K Comment the selected block
Ctrl+Shift+K Uncomment the selected block
Tab Expand the word at cursor using defined expansion pattern
Ctrl+I Go to next insertion point #INS# in the expanded text
Ctrl+Tab Insert tab character to the text
Shift+Arrow keys Select block for copy/paste/comment
Settings

• Theme, editor font size and font family, wordwrap: self explanatory
• Ergonomic features: Show dialog to periodically remind you to rest your eye
• Compilation options: Select primary compilation engine, bypass the TeXpert consent dialog, and automatically save the document before compling
• Debugging option: Generate a debug file which you should send to us for investigation

### Screenshots

All screenshots here are for tablets. Phone is not officially supported although TeXpert also works well on them. Also, these screenshots are captured for full version. As a result, some are not applicable to Lite version.

### Release Notes

Version 2.3.5.7.11
• Show file path in open/save dialog
• Add button to close "Go to line" tool; Esc also close the toolbar
• Bind short cut for search next, replace, replace all actions when search is active
• Esc to close search tool
• Ctrl+F or F3 to search for next occurrence
• Ctrl+R or F4 to replace text
• Ctrl+A to replace all occurrences of the search pattern
• Add frequently used [compile, undo] buttons next to file name
• Tap on file name to show the action panel
• Long tap on file name to save the file
• Focus on search field when showing search tool
• Display progress dialog when reading/writing files
• Load/save cloud files locally if cannot do it remotely and warn user about pending synchronization
• Add option to write local copy only [no difference for local files]
• Allow for working offline on cloud files and synchronize later
• Optimize network usage: sync when done
• User should be in charge of synchronization: long click on the upload button will attempt to upload local copies marked for synchronization to origin
• Remove ending } in patterns such as \textit{} for more natural auto completion
Version 2.3.5.7.10
• Fix crash due to theme handling bug in Android < 5.0
Version 2.3.5.7.9
• Use custom resources instead of hardcoding themes for UI consistency - Improve theme: apply to toolbars, icons, etc. not just text editor background - Add solarized themes
• Redesign action toolbar: swipe from left edge to access the command panel
• Redesign search, go-to-line toolbars
• Document outline is embedded in action panel
• Redesign settings: embed as bottom panel instead of floating
• Redesign PDF settings: - Switch between 'full screen' and 'split screen' mode in PDF view instead of going through app Settings - Tap on PDF button to open PDF in split view or full screen view (depending on how you last close the viewer) and jump to the corresponding source location at the cursor - Long tap on PDF button to open PDF in external app - Add button to close PDF viewer - Note: only applicable to full version
• Update UI with latest Android icon design
• Fix awkward PDF rendering when the page width is less than the available screen width
• Requires pressing [Back] twice to exit app to avoid accidental exit - Toast a reminder to save files
• Bind Ctrl+B to do BibTeX
• Add [Help] button to launch app website for help
Version 2.3.5.7.8
• Use Android's build-in PDF renderer instead of lahpdf on Android Lollipop; should enhance PDF viewer responsiveness significantly on recent devices. (Devices such as Nexus 7 (2012 version) does not work well with Lollipop.)
• Fix minor bug unable to compile with TeXPortal Free in previous version; require update to TeXPortal Free
• Enable customization of the extra keys to shown; add back quote , single quote ', tilde ~ keys
• Fix bug: crash when creating new non-Blank documents
Version 2.3.5.7.7
• Rudimentary SyncTeX support - Require latest version of TeXPortal [Full/Free] - Jump from PDF->Source: long tap or double tap on PDF document - Jump from Source->PDF: Ctrl+J or Edit (pencil icon) > Jump to PDF in toolbar - Note: SyncTeX can only jump to the "correct" line so break lines frequently - Usage note: For this to work, make sure to open your document under /storage/emulated/0/. The symbolic link /sdcard in Android actually points to /storage/emulated/legacy/.
• Fix crash when \input-ed document has no \section, \subsection, etc.
• Fix bug when adding automatic extension when handling \input, \bibliography
• Fix toolbar: need to be scrollable in split screen situation
Version 2.3.5.7.6
• Enhance document outline with files referenced via \input, \includegraphics, etc. - When click, outline of referenced source code will also be incorporated into master document's outline - Long click to open included file
• Use Ctrl+I to jump to next #INS# point; Alt+Tab on physical keyboard is handled by Android to show recent apps
• Handle all config changes in activity to avoid being killed when bluetooth keyboard is plugged in
• No longer display PDF on external display - Should use "Cast screen" feature to mirror screen - Prevent crash in some non-standard device lacking MediaRouter API
• Fix (hopefully) crashes when opening *.tex files
Version 2.3.5.7.5
• Fix various bugs concerning embedded PDF viewer such as not reloading PDF every time compilation finishes
• Pull buttons to bottom in the file selection dialog to work with 'short' screens (i.e. those that cannot stack 5 buttons vertically)
• Add parent link .. to go to parent folder to save the up button
• Fix bug: log is not flingable
• Make keyboard toolbar scrollable
Version 2.3.5.7.4
• Support ConTeXt (requires latest TeXPortal)
• Enable Android L's Material theme
• Add option to embed PDF viewer right beside the editor: edit while viewing the result
• Distribute static assets via network to reduce app size; user only needs to download necessary files, not those intended for other platforms
• Update native PDF rendering executable to conform with security requirement
Version 2.3.5.7.3
• Support vertical fling gesture on editor and PDF view
• Add option to use double tap to expand word at cursor
• Fix cannot insert text bug
• Update Google Drive's app account as well.
Version 2.3.5.7.2
• Auto-hide scrollbar: Tap on the area near right edge to expose scrollbar for interaction; scrollbars are automatically hidden if inactive for a few second. Also restore scrollbar for editor.
• Support multiple #INS# in expansion patterns: use Alt+Tab to go to next insertion point.
• Bind key F1 to compile with primary engine (pdfLaTeX) and F2 to compile with secondary engine (BibTeX).
• Fix bug: editor and PDF settings not being applied on start-up.
• Fix bug: missing meta-data for google play service version.
Version 2.3.5.7.1
• Swipe to remove recent file from list; similarly swipe to remove an expansion pattern from list
• Remove scrollbar in editor to save editing space
• Overlay scrollbar in PDF viewer for more view space
• Better PDF view customization (i.e. select zoom level, etc.): Add [Setting] button to show/hide PDF view customization panel
• Major UI revamp: Remove swiping from edges gesture to pull out the document outline panel, click on file name to do that. Also Setting panel, like document outline, is shown as pop up panel. Keyboard shortcut dialogs & manage patterns dialog are now part of the Settings pop-up.
• Remove blue rectangle around editing area
• Smaller log font
• Fix display bug in file browser
• No longer support Android below ICS 4.0
Version 2.3.5.7
• Support pdfLaTeX using TeXPortal Free
• Keep track of recently opened files; long click on [Open] to open a previously opened file
• Fix bug not saving expansion pattern file, consider more symbols like \$, ^, ... to set of pattern delimiters
• Eliminate PDF viewer view transition
• Save and restore viewing state when returning to PDF viewer
• Add option to force orientation in PDF viewer
• Add missing toolbar button (in sub-toolbar containing extra keys) to expand text; needed when there is no [Tab] key
• Long click on open braces { and [ to insert closing ones } and ]
• [Lite] Remove unused ads SDK
Version 2.3.5.6
• Fix cloud storage listing crash
• Long click on [Compile] button to do BibTeX (button [Bib] in sub-toolbar is removed)
• Long click on [Comment] button to uncomment a selected block
• Long click on [PDF] button to open generated *.log file
• Add alternative toolbar tailored to larger tablet screen (e.g. Nexus 7). Remove ( ) + = symbol keys on small screen. Hopefully, this might fix overlaid [Maximize] button on Samsung devices.
• Change to Ctrl+Tab to insert tab \t character to discourage tab usage in TeX documents
• Support TeXWorks code completion (press Tab to expand word at cursor using pre-defined patterns). Add completion patterns from Settings panel. Note that bullet is not supported.
Version 2.3.5.5
• Fix bug: [Save] button does not work for cloud files
• Fix bug: not considering listing error in file explorer
• Remove box-related stuff, shrink app size
Version 2.3.5.4
• Click on [Save] will not show file explorer dialog; long click on [Save] button for [Save as]
• Fix bug: pressing tab does not insert tab character but move to next focus i.e. first button in bottom bar
• Toast error encountered while listing folder
• Add debugging option to save log file at /sdcard/texpert.log. Currently only log storage and I/O operations.
Version 2.3.5.3
• Fix bug: Ctrl+P should open internal/external viewer based on user preference
Version 2.3.5.2
• Fix crash due to missing class for Lite version
• Fix "invisible" (black) cursor in black background
• Highlight undo/redo positions
• Implement and add shortcut Shift+Ctrl+K to uncomment block
• Add shortcut Ctrl+P to view PDF (P for preview)
• Dialog to list available shortcuts (Settings > Keyboard Shortcuts)
• Longer editing time for Lite version (from 5 minutes previously to 10 minutes)
Version 2.3.5.1
• Fix crash due to unsupported CTRL key below Android 3.0 (Honeycomb)
• Fix crash when searching with invalid regular expression and notify user regex syntax error
• Fix crash when swiftly pressing PDF button multiple time
• Close PDF viewer when pausing app, various enhancement for safety
Version 2.3.5
• Support viewing PDF in external display (e.g. when HDMI monitor is connected)
• Simplistic code completion; enable in settings.
• Ergonomic feature: periodic rest reminder. Note: On Lite version, it will attempt to load and show a fullscreen advertisement every 5 minutes. If advertisement cannot be loaded, a 1-minute break is compulsory. If the advertisement can be successfully shown, user can dismiss it [by pressing Back button] to continue editing.
• Add option to periodically save latest document content to a backup file. Backup file name is the original file appended with tilde ~ character. Remark: This is a bit unconventional back-up method. Usually, editors simply save the changes to original file and make a copy of the original file.
• Enable Dropbox/Google Drive integration, forgotten in 2.3.3 and 2.3.4
• Fix crash in Android below HoneyComb due to unavailable/incompatible clipboard manager
• Fix PDF bitmap caching problem
Version 2.3.4
• Fix "blackout" in PDF rendering
• Fix wrong key combinations (Alt istead of Ctrl)
• Fix crashes due to no status or paste when nothing is in clipboard
• Add Ctrl+N to create new document
Version 2.3.3
• Add Go to line and Comment selection editing commands
• Also, add button to upload the compiled PDF to cloud storage. NB: This is applicable to cloud files only i.e. those open directly from Dropbox or Google Drive. The PDF file will be uploaded to the same folder as the source.
• Support physical keyboard combinations
• File-related commands
Combination Action
Ctrl+O Open
Ctrl+S Save current document
Ctrl+T Compile main document
Editing commands
Combination Action
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+A Select all
Ctrl+C Copy
Ctrl+X Cut
Ctrl+V Paste
Ctrl+K Comment the selected block
Shift+Arrow keys Select block for copy/paste/comment
• Fix and enhance the resource navigator: Handle recursive \input tree; Expand item on click; Do not download resource if it already exists; Prevent edit loss due to reload; Nicer view with connecting lines. Warning: App might crash in case of circular inclusion!
• More user friendly: Add title for dialogs to avoid confusion; Report error when folder cannot be listed
• Enhanced PDF viewer: Save and restore viewing state; Option to crop white space in PDF; Add Fit width zoom factor; Full screen (instead of dialog form)
• Multi-window support. NB: This feature is only applicable to several Samsung devices.
• More optimization, purge unused resources and codes
Version 2.3.2
• IMPORTANT: Compilation requires TeXPortal 2.3.5.7.11.13 due to changes in TeXPortal service structure.
• IMPORTANT: After logging in Drive or Dropbox, the file browser might spin forever. In such case, click on the corresponding Drive/Dropbox button.
• Show dialog to prompt user about acquisition of additional resources (TeX files in \input or \include , images in \includegraphics and bibliography database in \bibliography ) before compilation. Note that recursive inclusion ( \input within included files) is not yet supported!
• Document outline now takes beamer frame into account.
• User interface is revamped and redesigned. Secondary toolbar is removed and replaced by ephemeral modification of the main toolbar. Actions are reorganized: frequent actions (save, compile, view pdf) are put in main toolbar while infrequent ones (open, bibtex, settings, etc.) are accessed via "three dots" buttons. Settings is also integrated into main UI so that user can see instant effect on the editor. Dialogs share common/unified style with ok/cancel-icons buttons. Text color theme for syntax highlighting is revised to work well for dark background. There is also a top status bar showing status of background operations.
• Show message when there is no accessible Google account. For e.g. the list of accounts is shielded by privacy apps.
• The file browser will now open last visited folders and also select last selected files. We no longer support Box due to high maintenance cost.
• PDF rendering is now performed via external processes and pipes to prevent crashing due to native code in JNI. This is also to conform with MuPDF's AGPL licensing and potentially allow Lite version to display PDF. See LAHpdf.
• Add background service to keep app process alive when there is unsaved modifications: to prevent app being killed (hence, changes are lost). Notification is shown if one closes app with modified document.
• Fix many other miscellaneous stuffs such as eliminating all Parcellable-related stuffs (hopefully fix crashes on incompatible rooted devices); "zoomed" PDF scrolling i.e. page shift amount is different from actual finger movement distance; auto-save-before-compile feature for remote documents.

# LAHpdf

LAHpdf is an interactive program to get information about PDF document and render PDF pages to PNG images.

LAHpdf is used in TeXpert to render PDF document for two important reasons. First, it is executed in separate process and thus, if it crashes, TeXpert does not crash. Second, it allows TeXpert to have its source code private because there is no linking: there is thus no violation of MuPDF AGPL v3.0 license as long as LAHpdf is open source and licensed under the same AGPL v3.0.

Remark: On Android 5.0 Lollipop, we use Android PDFRenderer API to render PDF.

### Usage

Execute lahpdf path_to_pdf to start interaction. At the moment, the following commands are supported:
exit : (evidently) exit the program;
info : print number of pages and (common) width and height of all pages assuming default resolution of 72dpi; and
%d %f %d %d %d %d : render a rectangular region of a page. For this rendering command, the first number is the index of the page to render (count from 0), the second is the zoom factor, the remaining are for coordinates of left-top corner followed by the width and height of the target region. The bitmap (in PNG format) is dumped to standard output stream.

### Source code

/* Copyright © by L.A.H.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include <mupdf/fitz.h>
#define VERSION "1"
int main(int argc, char **argv)
{
if (argc == 0) {
printf(VERSION);
return 0;
}
char *filename = argv[1];
fz_context *ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
fz_output *out = fz_new_output_with_file(ctx, stdout);
fz_document *doc = fz_open_document(ctx, filename);
fz_colorspace *colorspace = fz_device_rgb(ctx);
char cmd[1024];
int pagenumber, px, py, pw, ph, old_pgnum, old_pw, old_ph;
fz_page *page = NULL;
fz_pixmap *pix = NULL;
float zoom;
old_pgnum = 0;
old_pw = old_ph = -1;
while (gets(cmd))
{
if (!strcmp(cmd, "exit"))
break;
// Process info command
if (!strcmp(cmd, "info")) {
int pagecount = fz_count_pages(doc);
if (page == NULL) page = fz_load_page(doc, 0);
fz_rect bounds;
fz_bound_page(doc, page, &bounds);
printf("%d %f %f\n", pagecount,
bounds.x1 - bounds.x0,
bounds.y1 - bounds.y0);
fflush(stdout);
continue;
}
sscanf(cmd, "%d %f %d %d %d %d", &pagenumber, &zoom,
&px, &py, &pw, &ph);
if (pagenumber != old_pgnum)
{
if (page != NULL) fz_free_page(doc, page);
old_pgnum = pagenumber;
}
// Make new the pixmap if necessary
if (pix == NULL || pw != old_pw || ph != old_ph)
{
if (pix != NULL) fz_drop_pixmap(ctx, pix);
pix = fz_new_pixmap(ctx, colorspace, pw, ph);
old_pw = pw;
old_ph = ph;
}
fz_clear_pixmap_with_value(ctx, pix, 0xff);
pix->x = px;
pix->y = py;
fz_matrix transform = fz_identity;
fz_pre_scale(&transform, zoom, zoom);
fz_device *dev = fz_new_draw_device(ctx, pix);
fz_run_page(doc, page, dev, &transform, NULL);
fz_output_png(out, pix, 0);
fflush(stdout);
fz_free_device(dev);
}
if (pix != NULL) fz_drop_pixmap(ctx, pix);
if (page != NULL) fz_free_page(doc, page);
fz_close_output(out);
fz_close_document(doc);
fz_free_context(ctx);
return 0;
}`