This is a Swift package for performing SyncTeX forward and reverse search.
- Minimum supported version:
iOS/iPadOS 13.0.
- This package is a thin wrapper for the
Clanguage librarySyncTeX. Memory management related toClanguage API ofSyncTeXis entirely handled within this package. - Queries must be based on a real
TeXproject structure. This framework can automatically read thesynctexsynchronization file in the directory where the output file is located (these files generally have the file extensionsynctex.gzor.synctex).
Below is a typical example of using this framework for reverse search (finding the corresponding position in the source file based on a point in the PDF file).
Assuming the URL of the TeX engine's output file is outputFileURL.
import SyncTeX
function test() async {
let outputFileURL = URL(filePath: "123.pdf")
do {
let scanner = try await SyncTeXScanner(outputFileURL: outputFileURL)
let resultArray = await scanner.editQuery(page: 10, h: 0.2, v: 0.2) // Page starts from 1
for result in resultArray {
print(result)
}
} catch {
//TODO: Catch Error
}
}All the provided public functions have detailed comments (in English), which can be directly viewed in the ./Sources/SyncTeX/Scanner.swift file.