Fix LaTeX export of elisp: and plain links, multi-line link paths !428

merged merged by cmc on 2026-11-21 21:13 UTC · krz/orgstar:gaps-iosqa into main

14 files changed, +145 −31

Layout: unified · split

Sources/OrgCore/Export/ASCIIExport.swift +2 −2
@@ -1231,7 +1231,7 @@ final class ASCIIRenderer {
12311231 private static let unrenderedTypes: Set<String> = ["attachment", "bbdb", "bibtex", "docview", "doi", "eww", "gnus", "info", "irc", "mhe", "rmail", "w3m"]
12321232
12331233 /// `org-link-plain-re`, in any case, for the plain links the parser leaves as text.
1234 private static let plainLink: NSRegularExpression = {
1234 static let plainLink: NSRegularExpression = {
12351235 let plain = #"[^\[\]\s()<>]"#
12361236 let parens = #"[<(\[](?:\#(plain)|[<(\[]\#(plain)*[\])>])*[\])>]"#
12371237 let types = "attachment|bbdb|bibtex|docview|doi|elisp|eww|file\\+emacs|file\\+sys|file|ftp|gnus|help|https?|id|info|irc|mailto|mhe|news|rmail|shell|shortdoc|w3m"
@@ -1244,7 +1244,7 @@ final class ASCIIRenderer {
12441244 if node.firstChild(.linkDescription)?.descendants().contains(where: { $0.kind == .link }) == true {
12451245 throw Unsupported(reason: "Links in link descriptions")
12461246 }
1247 let pathToken = node.tokens.first { $0.kind == .linkPath }?.text
1247 let pathToken = node.linkPath
12481248 var raw = pathToken ?? node.text
12491249 if pathToken == nil, raw.hasPrefix("<"), raw.hasSuffix(">") { raw = String(raw.dropFirst().dropLast()) }
12501250 var description: String? = node.firstChild(.linkDescription) == nil ? nil : try transcode(children)
Sources/OrgCore/Export/ASCIIText.swift +1 −1
@@ -461,7 +461,7 @@ struct ASCIIText {
461461
462462 func link(_ node: SyntaxNode) -> String {
463463 let description = node.firstChild(.linkDescription).map { inline($0) }
464 guard let path = node.tokens.first(where: { $0.kind == .linkPath })?.text else {
464 guard let path = node.linkPath else {
465465 var target = node.text
466466 if target.hasPrefix("<"), target.hasSuffix(">") { target = String(target.dropFirst().dropLast()) }
467467 // A radio link is its text.
Sources/OrgCore/Export/ExportOptions.swift +1 −1
@@ -205,7 +205,7 @@ public enum ExportPreprocess {
205205 let rebased = rebasingLinks(description.text, from: directory, to: includer, plain: true)
206206 if rebased != description.text { edits.append((description.range, rebased)) }
207207 }
208 if let path = node.tokens.first(where: { $0.kind == .linkPath }), let rebased = rebasedPath(path.text, from: directory, to: includer, bracket: true) {
208 if let path = node.tokens.first(where: { $0.kind == .linkPath }), let text = node.linkPath, let rebased = rebasedPath(text, from: directory, to: includer, bracket: true) {
209209 edits.append((path.range, rebased))
210210 }
211211 } else if whole.hasPrefix("<"), whole.hasSuffix(">") {
Sources/OrgCore/Export/HTMLExport.swift +1 −1
@@ -856,7 +856,7 @@ final class HTMLRenderer {
856856 static let imageExtensions: Set<String> = ["png", "jpg", "jpeg", "gif", "svg", "webp", "bmp", "tif", "tiff", "avif"]
857857
858858 private func link(_ node: SyntaxNode) -> String {
859 let path = node.tokens.first { $0.kind == .linkPath }?.text
859 let path = node.linkPath
860860 let description = node.firstChild(.linkDescription)
861861 guard let path else {
862862 // A radio link goes to its target.
Sources/OrgCore/Export/LaTeXExport.swift +85 −7
@@ -64,7 +64,15 @@ public enum LaTeXExport {
6464 if included.contains("{{{") {
6565 if included.contains(marker) { throw LaTeXExport.Unsupported(reason: "U+E000 in the text") }
6666 let ns = included as NSString
67 let kept = OrgParser.parse(included, defaults: settings).root.descendants()
67 let nodes = OrgParser.parse(included, defaults: settings).root.descendants()
68 // A macro a plain link runs on into is part of the link in Org, not expanded.
69 let links = ASCIIRenderer.plainLink.matches(in: included, range: NSRange(location: 0, length: ns.length)).map(\.range)
70 for macro in nodes where macro.kind == .macro {
71 if links.contains(where: { $0.location < macro.range.lowerBound && NSMaxRange($0) > macro.range.lowerBound }) {
72 throw LaTeXExport.Unsupported(reason: "Plain links running into other objects")
73 }
74 }
75 let kept = nodes
6876 .filter { [.verbatim, .code, .block, .fixedWidth, .comment, .latexEnvironment, .exportSnippet].contains($0.kind) }.map(\.range)
6977 var out = ""
7078 var at = 0
@@ -1293,10 +1301,13 @@ final class LaTeXRenderer {
12931301 }
12941302
12951303 private var inTitle = false
1304 /// Whether text is a link's description, where Org finds no plain links.
1305 private var inDescription = false
12961306
12971307 /// `org-export-data` over objects: math objects merged (`org-latex--wrap-latex-math-block`),
12981308 /// objects that export nothing taking their blanks with them unless they are needed.
12991309 func transcode(_ items: [Inline]) throws -> String {
1310 if !inDescription { try refusePlainLinksIntoObjects(items) }
13001311 var out = ""
13011312 var index = 0
13021313 var dropBlanks = false
@@ -1314,7 +1325,7 @@ final class LaTeXRenderer {
13141325 }
13151326 dropBlanks = false
13161327 afterObject = false
1317 out += plainText(t)
1328 out += try plainTextAndLinks(t)
13181329 index += 1
13191330 case .object(let node, let children):
13201331 dropBlanks = false
@@ -1525,7 +1536,7 @@ final class LaTeXRenderer {
15251536 // MARK: Links
15261537
15271538 private func linkTarget(_ node: SyntaxNode) -> (type: String, path: String) {
1528 var raw = node.tokens.first { $0.kind == .linkPath }?.text ?? node.text
1539 var raw = node.linkPath ?? node.text
15291540 if node.tokens.first(where: { $0.kind == .linkPath }) == nil, raw.hasPrefix("<"), raw.hasSuffix(">") {
15301541 raw = String(raw.dropFirst().dropLast())
15311542 }
@@ -1569,7 +1580,11 @@ final class LaTeXRenderer {
15691580
15701581 private func link(_ node: SyntaxNode, _ children: [Inline]) throws -> String? {
15711582 let (type, path) = linkTarget(node)
1583 let saved = inDescription
1584 inDescription = true
1585 defer { inDescription = saved }
15721586 var description: String? = node.firstChild(.linkDescription) == nil ? nil : try transcode(children)
1587 inDescription = saved
15731588 if description == "" { description = nil }
15741589 if node.firstChild(.linkDescription)?.descendants().contains(where: { $0.kind == .link }) == true {
15751590 throw Unsupported(reason: "Links in link descriptions")
@@ -1604,11 +1619,9 @@ final class LaTeXRenderer {
16041619 if let range = format.range(of: "(\(path))") { format.replaceSubrange(range, with: "%s") }
16051620 return format.replacingOccurrences(of: "%s", with: resolved).replacingOccurrences(of: "%%", with: "%")
16061621 case "file":
1607 if path.hasPrefix("~") { throw Unsupported(reason: "File links under ~") }
1608 let uri = path.hasPrefix("//") ? "file:" + path : path.hasPrefix("/") ? "file://" + path : path
1609 let protected = Self.protect(uri)
1622 let protected = Self.protect(try fileURI(path))
16101623 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}"
1611 case "http", "https", "ftp", "mailto", "news":
1624 case "http", "https", "ftp", "mailto", "news", "elisp", "shell", "help", "shortdoc":
16121625 let protected = Self.protect(type + ":" + path)
16131626 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}"
16141627 default:
@@ -1616,6 +1629,71 @@ final class LaTeXRenderer {
16161629 }
16171630 }
16181631
1632 private func fileURI(_ path: String) throws -> String {
1633 if path.hasPrefix("~") { throw Unsupported(reason: "File links under ~") }
1634 return path.hasPrefix("//") ? "file:" + path : path.hasPrefix("/") ? "file://" + path : path
1635 }
1636
1637 /// Org matches `org-link-plain-re` on the source, so a plain link the parser leaves as text
1638 /// can run on into what the parser reads as an object after it, such as `shell:a_b`.
1639 private func refusePlainLinksIntoObjects(_ items: [Inline]) throws {
1640 var raw = ""
1641 var textRuns: [(start: Int, end: Int)] = []
1642 for item in items {
1643 let start = (raw as NSString).length
1644 switch item {
1645 case .text(let t):
1646 raw += t
1647 textRuns.append((start, (raw as NSString).length))
1648 case .object(let node, _):
1649 raw += node.text
1650 }
1651 }
1652 guard textRuns.count < items.count else { return }
1653 for m in ASCIIRenderer.plainLink.matches(in: raw, range: NSRange(location: 0, length: (raw as NSString).length)) {
1654 if let text = textRuns.first(where: { $0.start <= m.range.location && m.range.location < $0.end }), NSMaxRange(m.range) > text.end {
1655 throw Unsupported(reason: "Plain links running into other objects")
1656 }
1657 }
1658 }
1659
1660 /// Text with the plain links the parser leaves in it, `shell:ls` and the like, written as Emacs does.
1661 private func plainTextAndLinks(_ t: String) throws -> String {
1662 guard !inDescription else { return plainText(t) }
1663 let ns = t as NSString
1664 var out = ""
1665 var last = 0
1666 for m in ASCIIRenderer.plainLink.matches(in: t, range: NSRange(location: 0, length: ns.length)) {
1667 let type = ns.substring(with: m.range(at: 1))
1668 var path = ns.substring(with: NSRange(location: NSMaxRange(m.range(at: 1)) + 1, length: NSMaxRange(m.range) - NSMaxRange(m.range(at: 1)) - 1))
1669 var before = ns.substring(with: NSRange(location: last, length: m.range.location - last))
1670 if last > 0 {
1671 // The previous link's post-blank, which Emacs writes as spaces.
1672 let blanks = before.prefix { $0 == " " || $0 == "\t" }
1673 before = String(repeating: " ", count: blanks.count) + before.dropFirst(blanks.count)
1674 }
1675 out += plainText(before)
1676 if type.lowercased() == "file", !path.hasPrefix("//"), let range = path.range(of: "::") { path = String(path[..<range.lowerBound]) }
1677 let ext = (path as NSString).pathExtension.lowercased()
1678 switch type.lowercased() {
1679 case "file":
1680 if ["pdf", "jpeg", "jpg", "png", "ps", "eps", "tikz", "pgf", "svg"].contains(ext) { throw Unsupported(reason: "Plain image links") }
1681 out += "\\url{\(Self.protect(try fileURI(path)))}"
1682 case "http", "https", "ftp", "mailto", "news", "elisp", "shell", "help", "shortdoc":
1683 if ["jpeg", "jpg", "png", "ps", "eps", "tikz", "pgf", "svg"].contains(ext) { throw Unsupported(reason: "Plain image links") }
1684 out += "\\url{\(Self.protect(type + ":" + path))}"
1685 default:
1686 throw Unsupported(reason: "Plain links of type \(type)")
1687 }
1688 last = NSMaxRange(m.range)
1689 }
1690 guard last > 0 else { return plainText(t) }
1691 var rest = ns.substring(from: last)
1692 let blanks = rest.prefix { $0 == " " || $0 == "\t" }
1693 rest = String(repeating: " ", count: blanks.count) + rest.dropFirst(blanks.count)
1694 return out + plainText(rest)
1695 }
1696
16191697 /// Words of a fuzzy link or a title, as `org-export-search-cells` compares them.
16201698 static func words(_ s: String) -> [String] {
16211699 s.uppercased().split(whereSeparator: \.isWhitespace).map(String.init)
Sources/OrgCore/Export/MarkdownExport.swift +1 −1
@@ -358,7 +358,7 @@ final class MarkdownRenderer {
358358 }
359359
360360 private func link(_ node: SyntaxNode) -> String {
361 guard let path = node.tokens.first(where: { $0.kind == .linkPath })?.text else {
361 guard let path = node.linkPath else {
362362 // A radio link is its text.
363363 if !node.text.hasPrefix("<"), !node.text.contains(":") { return node.text }
364364 var target = node.text
Sources/OrgCore/Export/ODTExport.swift +1 −1
@@ -1026,7 +1026,7 @@ final class ODTRenderer {
10261026
10271027 /// A bracket link's path, or a plain or angle `file:` link's.
10281028 static func linkPath(_ node: SyntaxNode) -> String? {
1029 if let token = node.tokens.first(where: { $0.kind == .linkPath }) { return token.text }
1029 if let path = node.linkPath { return path }
10301030 var text = node.text
10311031 if text.hasPrefix("<"), text.hasSuffix(">") { text = String(text.dropFirst().dropLast()) }
10321032 return text.hasPrefix("file:") ? text : nil
Sources/OrgCore/Links/Links.swift +2 −2
@@ -136,8 +136,8 @@ public enum Links {
136136 guard let node = found else { return nil }
137137 let whole = node.text
138138 var link: OrgLink
139 if whole.hasPrefix("[["), let path = node.tokens.first(where: { $0.kind == .linkPath }) {
140 link = parse(bracket: path.text, abbreviations: abbreviations(in: tree.settings.setupKeywords + text))
139 if whole.hasPrefix("[["), let path = node.linkPath {
140 link = parse(bracket: path, abbreviations: abbreviations(in: tree.settings.setupKeywords + text))
141141 } else if whole.hasPrefix("<") && whole.hasSuffix(">") {
142142 link = parse(plain: String(whole.dropFirst().dropLast()))
143143 } else if tree.settings.radioTargets.contains(where: { words($0) == words(whole) }) {
Sources/OrgCore/Parser/Inline.swift +5 −13
@@ -304,7 +304,7 @@ struct InlineScanner {
304304 guard i + 1 < limit, chars[i + 1] == "[" else { return nil }
305305 var j = i + 2
306306 while j < limit, chars[j] != "]" {
307 if chars[j] == "[" || isNewline(chars[j]) { return nil }
307 if chars[j] == "[" { return nil }
308308 if chars[j] == "\\", j + 1 < limit { j += 1 }
309309 j += 1
310310 }
@@ -312,19 +312,11 @@ struct InlineScanner {
312312 let path = (i + 2)..<j
313313 if chars[j + 1] == "]" { return .link(path: path, description: nil, whole: i..<(j + 2)) }
314314 guard chars[j + 1] == "[" else { return nil }
315 // `org-link-bracket-re`: the description is at least one character, up to the first `]]`.
315316 let descriptionStart = j + 2
316 var depth = 0
317 var k = descriptionStart
318 while k < limit {
319 if chars[k] == "[" {
320 depth += 1
321 } else if chars[k] == "]" {
322 if depth == 0 { break }
323 depth -= 1
324 }
325 k += 1
326 }
327 guard k > descriptionStart, k + 1 < limit, chars[k + 1] == "]" else { return nil }
317 var k = descriptionStart + 1
318 while k + 1 < limit, !(chars[k] == "]" && chars[k + 1] == "]") { k += 1 }
319 guard k + 1 < limit else { return nil }
328320 return .link(path: path, description: descriptionStart..<k, whole: i..<(k + 2))
329321 }
330322
Sources/OrgCore/Semantic/DocumentModel.swift +1 −1
@@ -202,7 +202,7 @@ public struct DocumentModel: Sendable {
202202 }
203203
204204 private func linkTarget(_ node: SyntaxNode) -> String {
205 if let path = node.tokens.first(where: { $0.kind == .linkPath }) { return path.text }
205 if let path = node.linkPath { return path }
206206 let text = node.text
207207 if text.hasPrefix("<"), text.hasSuffix(">") { return String(text.dropFirst().dropLast()) }
208208 return text
Sources/OrgCore/Syntax/SyntaxNode.swift +6
@@ -103,6 +103,12 @@ public final class SyntaxNode: Sendable {
103103 public func descendants() -> [SyntaxNode] {
104104 [self] + children.flatMap { $0.descendants() }
105105 }
106
107 /// A bracket link's path as `org-element-link-parser` reads it: each run of blanks
108 /// holding a newline made one space.
109 var linkPath: String? {
110 tokens.first { $0.kind == .linkPath }.map { $0.text.replacing(/[ \t]*\r?\n[ \t]*/.matchingSemantics(.unicodeScalar), with: " ") }
111 }
106112}
107113
108114public struct SyntaxToken: Sendable, Equatable {
Tests/OrgCoreTests/InlineTests.swift +15
@@ -46,6 +46,21 @@ struct InlineTests {
4646 #expect(link.children.map(\.kind) == [.linkDescription])
4747 }
4848
49 /// `org-element-link-parser`: a path may run onto the next line, read with its line break as a space.
50 @Test func linkPathsSpanLines() {
51 let links = OrgParser.parse("[[elisp:(+ 1\n 2)]] and [[a \n\tb][c]]\n\n[[x\n\ny]]\n").root.descendants().filter { $0.kind == .link }
52 #expect(links.map(\.linkPath) == ["elisp:(+ 1 2)", "a b"])
53 let crlf = OrgParser.parse("[[elisp:(+ 1\r\n 2)]] ok\r\n").root.descendants().filter { $0.kind == .link }
54 #expect(crlf.map(\.linkPath) == ["elisp:(+ 1 2)"])
55 }
56
57 /// `org-link-bracket-re`: a description runs to the first `]]`, brackets in it balanced or not.
58 @Test func linkDescriptionsEndAtFirstDoubleBracket() {
59 let text = "[[a][x]b]] [[a][x [y]] [[a][]x]] [[a][[z]]]\n"
60 let descriptions = OrgParser.parse(text).root.descendants().filter { $0.kind == .linkDescription }.map(\.text)
61 #expect(descriptions == ["x]b", "x [y", "]x", "[z"])
62 }
63
4964 @Test func noLinksInsideLinkDescriptions() {
5065 let link = OrgParser.parse("[[a][see https://b.c]]\n").root.descendants().first { $0.kind == .link }!
5166 #expect(link.descendants().filter { $0.kind == .link }.count == 1)
Tests/OrgCoreTests/LaTeXExportTests.swift +23
@@ -106,6 +106,14 @@ struct LaTeXExportTests {
106106 "Snippets @@latex:\\newpage@@ and @@html:<br>@@ gone. Also @@html:x@@ @@html:y@@ end.\n@@html:z@@ start\n",
107107 "Line one\\\\\nline two \\\\\n\\\\\nafter\n",
108108 "Links: [[https://orgmode.org][Org & co]] <https://a.b/c_d> https://x.y/%20 [[mailto:me@x.org]] [[file:doc.pdf][the doc]] [[./rel/file.txt]] [[file:/abs/path.org]]\n",
109 "Run [[elisp:(+ 1 2)][add]] and [[elisp:(message \"50% #x\")]], [[shell:ls ~/x_y][list]] [[shell:echo $HOME]], [[help:car][car]] [[shortdoc:string]].\n",
110 "Plain shell:ls and elisp:foo and help:car here.\nGet ftp://x.org/f now, news:comp.x and mailto:a@b.c, shortdoc:string HTTPS://a.b/c.\nshell:echo_$x% and shell:ls\tx shell:ls[x elisp:(foo) FILE:a.txt File:b.org::s FILE:/abs FILE://h/p.\n[[https://a.b][see shell:ls]] *shell:ls* and\n| news:x |\n",
111 "* Heading shell:ls\nx\n",
112 "[[https://a.b][[x] y]] and [[https://a.b][x [y] z]] after.\n",
113 "A [[https://a.b][a]b]] z [[https://a.b][x [y]] z [[https://a.b][=v]=]] z [[https://a.b][]x]] z [[https://a.b][a\\]b]] z.\n",
114 "[[elisp:foo][[[file:a.png]]]]\n\n[[https://a.b][[[x]] y]]\n\n[[https://a.b][[x]]]\n",
115 "See FILE:a.org::foo.png here.\n",
116 "Run [[elisp:(+ 1\n 2)]] and see [[https://a.b/c\n d]] ok, [[shell:a \n\tb][two\n lines]] and [[elisp:a\tb\n c]].\n",
109117 "* Target section\nA <<anchor>> here and [[anchor]] and [[anchor][desc]].\n* Other\nSee [[*Target section]] and [[Target section][named]] and [[#cid]].\n* Third\n:PROPERTIES:\n:CUSTOM_ID: cid\n:END:\nx\n",
110118 "#+OPTIONS: num:nil\n* Head\nSee [[*Head]].\n",
111119 "Footnotes[fn:1] twice[fn:1] and[fn:2][fn:3] and inline[fn::anon /x/] and[fn:named:inline def].\n\n[fn:1] First.\n\n[fn:2] Second\n with two lines.\n\n[fn:3] Third.\n",
@@ -321,6 +329,12 @@ struct LaTeXExportTests {
321329 }
322330 }
323331
332 /// A bracket link path broken across a CRLF line end is read as Emacs reads it once it decodes the file.
333 @Test func linkPathsAcrossCRLF() throws {
334 let body = try LaTeXExport.document("Text [[elisp:(+ 1\r\n 2)]] and [[https://a.b/c\r\n d]] ok.\r\n", bodyOnly: true)
335 #expect(body.hasPrefix("Text \\url{elisp:(+ 1 2)} and \\url{https://a.b/c d} ok."))
336 }
337
324338 /// What Emacs exports differently or refuses is refused, naming it.
325339 @Test func refusesWhatItCannotMatch() {
326340 func reason(_ org: String) -> String? {
@@ -350,6 +364,15 @@ struct LaTeXExportTests {
350364 let pre = "* Top\n:PROPERTIES:\n:EXPORT_LATEX_CLASS_PRE: \\x\n:END:\nBody.\n"
351365 #expect(ExportScope.subtree(pre, at: 0).flatMap(reason) == "#+LATEX_CLASS_PRE")
352366 #expect(reason("#+OPTIONS: tags:not-in-toc\n* 100% done :a:\n")?.hasPrefix("% in a heading") == true)
367 for org in ["shell:ls^2 x\n", "x shell:a_b\n", "ftp://a/b_c\n", "elisp:x^{2}\n", "help:a_{b}\n", "shell:a\\alpha\n", "shell:a$x$ y\n",
368 "shell:a@@latex:Z@@\n", "shell:a{{{date}}}\n", "shell:ls[fn:1] x\n\n[fn:1] d\n", "*shell:ab_c*\n"] {
369 #expect(reason(org) == "Plain links running into other objects", "\(org)")
370 }
371 #expect(reason("See id:abc.\n") == "Plain links of type id")
372 #expect(reason("See info:emacs here.\n") == "Plain links of type info")
373 #expect(reason("See FILE:a.png here.\n") == "Plain image links")
374 #expect(reason("See FILE:a.png::x here.\n") == "Plain image links")
375 #expect(reason("See FILE:~/a here.\n") == "File links under ~")
353376 }
354377
355378 @Test func labelsStayTheSame() throws {
docs/manual/guide/12-export.org +1 −1
@@ -236,7 +236,7 @@ It reads:
236236
237237=#+TITLE=, =#+SUBTITLE=, =#+AUTHOR=, =#+DATE=, =#+KEYWORDS=, =#+DESCRIPTION=, =#+LANGUAGE= and =#+OPTIONS= work as in Emacs, as do the tags and =COMMENT= that leave headings out (see /Which headings are exported/). Body-only and subtree export are in the export dialog. In a subtree export, the heading's =EXPORT_LATEX_CLASS=, =EXPORT_LATEX_CLASS_OPTIONS=, =EXPORT_LATEX_HEADER=, =EXPORT_LATEX_HEADER_EXTRA=, =EXPORT_LATEX_COMPILER=, =EXPORT_SUBTITLE=, =EXPORT_KEYWORDS=, =EXPORT_DESCRIPTION= and =EXPORT_LANGUAGE= properties replace the file's keywords. As in Emacs, a =PROPERTY+= line adds its value to the property's, after a space.
238238
239A file with something this export doesn't handle stops with "Can't export to LaTeX: " and what it was, rather than giving a =.tex= that differs from Emacs's: a LaTeX class other than the three, Babel or Polyglossia in the header, citations, radio targets, inline tasks, table.el tables, inline source blocks and calls, =#+CALL=, source blocks exported with their results, footnote definitions of several paragraphs, footnotes in headings, tables or item tags, =:mode math= and long tables, =UNNUMBERED= and =ALT_TITLE=, =tex:verbatim=, a quote or center block whose first line holds only spaces and whose second line is not blank, a keyword such as =#+SUBTITLE= repeated with an empty value, and =#+OPTIONS= items other than =toc=, =num=, =H=, =tags=, =todo=, =pri=, =^=, =tex=, =title=, =author=, =date=, =-= and =timestamp= set to something other than Org's default. A link Emacs can't resolve stops the export in both, including a link to a heading, target or named element the export leaves out. On iOS the share sheet stops and the message shows at the bottom of the screen. Publishing to LaTeX stops with the file's name in the message. In the download version, when Emacs is installed, such a file is exported by Emacs instead (see /Exporting through Emacs/).
239A file with something this export doesn't handle stops with "Can't export to LaTeX: " and what it was, rather than giving a =.tex= that differs from Emacs's: a LaTeX class other than the three, Babel or Polyglossia in the header, citations, radio targets, inline tasks, table.el tables, inline source blocks and calls, =#+CALL=, source blocks exported with their results, footnote definitions of several paragraphs, footnotes in headings, tables or item tags, =:mode math= and long tables, =UNNUMBERED= and =ALT_TITLE=, =tex:verbatim=, a quote or center block whose first line holds only spaces and whose second line is not blank, a keyword such as =#+SUBTITLE= repeated with an empty value, plain (unbracketed) links of types it doesn't write, such as =id:= and =info:=, plain links to images, a plain link that runs on into markup such as =shell:a_b=, and =#+OPTIONS= items other than =toc=, =num=, =H=, =tags=, =todo=, =pri=, =^=, =tex=, =title=, =author=, =date=, =-= and =timestamp= set to something other than Org's default. A link Emacs can't resolve stops the export in both, including a link to a heading, target or named element the export leaves out. On iOS the share sheet stops and the message shows at the bottom of the screen. Publishing to LaTeX stops with the file's name in the message. In the download version, when Emacs is installed, such a file is exported by Emacs instead (see /Exporting through Emacs/).
240240
241241* Word, RTF and plain text
242242