You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I use LaTex in my views to display math equations but the equations are not being rendered when I want to generate an image or PDF from my SwiftUI view.
I was able to get this working in the past but for some strange reason, it's no longer working.
I'm wondering if there is a particular setup or modifier I'm missing.
Here is a snippet of the the code looks like:
private func generateSolutionImage(
mathResponse: MathSolution,
originalImage: UIImage?
) async throws -> URL {
return try await withCheckedThrowingContinuation { continuation in
Task { @MainActor in
do {
// Create the content view for sharing (no ScrollView)
let contentView = SolutionContentView(
mathResponse: mathResponse,
originalImage: originalImage,
showShareButton: false,
forSharing: true
)
let renderer = ImageRenderer(content: contentView)
renderer.scale = 3.0
// Use unspecified size to let SwiftUI determine the natural size
renderer.proposedSize = ProposedViewSize.unspecified
guard let image = renderer.uiImage else {
throw ShareError.imageGenerationFailed
}
let url = try saveImageToTempFile(image: image)
continuation.resume(returning: url)
} catch {
continuation.resume(throwing: error)
}
}
}
}
The latex image rendering has changed significantly and I don't believe will play nicely with an image renderer with the background rendering this view does.
I've added the ability to render the UIImage/NSImage objects themselves to the v2 update. This may solve your problem if you display these instead of the latex view as a subview.
Activity
ShawnBaek commentedon Jan 11, 2026
@tobitech Could you share error information?
colinc86 commentedon Apr 3, 2026
The latex image rendering has changed significantly and I don't believe will play nicely with an image renderer with the background rendering this view does.
I've added the ability to render the UIImage/NSImage objects themselves to the v2 update. This may solve your problem if you display these instead of the latex view as a subview.