-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
I'm observing characters duplication when \left and \right operators are used. Maybe there are other operators that cause this issue too. In the following sample, an equation is rendered with two CRω at the top and CLω² at the bottom.
Here is a sample code that demonstrates this issue:
let latex = #"""
\phi = \arctan\left(\frac{-C R \omega}{1 - C L \omega^2}\right)
"""#
#Preview {
VStack {
SwiftUILaTeXView(
latexString: latex,
textColor: .blue
)
Spacer()
}
}
struct SwiftUILaTeXView: UIViewRepresentable {
let latexString: String
let textColor: UIColor
let textAlignment: MTTextAlignment = .center
func makeUIView(context: Context) -> MTMathUILabel {
let view = MTMathUILabel()
return view
}
func updateUIView(_ uiView: MTMathUILabel, context: Context) {
if latexString != uiView.latex {
uiView.latex = latexString
}
if textColor != uiView.textColor {
uiView.textColor = textColor
}
if textAlignment != uiView.textAlignment {
uiView.textAlignment = textAlignment
}
}
func sizeThatFits(_ proposal: ProposedViewSize, uiView: MTMathUILabel, context: Context) -> CGSize? {
if let width = proposal.width, width.isFinite, width > 0 {
uiView.preferredMaxLayoutWidth = width
let size = uiView.sizeThatFits(CGSize(width: width, height: .greatestFiniteMagnitude))
return size
}
return nil
}
}
When mentioned operators are not used, equation is rendered correctly:
\phi = \arctan(\frac{-C R \omega}{1 - C L \omega^2})
Library version: latest commit from main branch (48ff188).
iOS version: 26.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels