Comments (12)
Doesn't sound like a jlatexmath bug as there's no automatic line-breaking support
In any case, you'll need to provide the exact LaTeX strings ("English" and "Asian") that you are sending to the library if you want us to check further
from jlatexmath.
Doesn't sound like a jlatexmath bug as there's no automatic line-breaking support
hello murkle,
I am the (co)author of the Freeplane LaTeX plugin, and I am quite sure that JLaTeXMath supports automatic line breaking
using the TeXIconBuilder interface (inner class in TeXFormula.java, I introduced this a long time ago):
return tf.new TeXIconBuilder()
.setStyle(style)
.setSize(size)
.setWidth(TeXConstants.UNIT_PIXEL, maxWidth, align)
.setIsMaxWidth(true)
// .setInterLineSpacing(TeXConstants.UNIT_PIXEL, /*40f*/size * 1.2F)
.setInterLineSpacing(latexInterlineSpacingUnit, latexInterlineSpacingValue)
.build();
Cheers and Best Regards,
Felix
from jlatexmath.
package com.bendzi.frameworks.jlatexmath;
import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXFormula;
import org.scilab.forge.jlatexmath.TeXIcon;
import javax.swing.*;
import java.awt.*;
public class JLatexMathTesting {
public static void main(String[] argv) {
String chineseText = "是次合作為大型科研計劃「大灣區光化學臭氧污染及區域和跨區域傳輸特徵研究」的一部分。該計劃由廣東省政府、香港特區政府和澳門特區政府聯合推出,旨在研究臭氧對整個區域所造成的空氣質素問題。";
String englishText = "I live in a house near the mountains. I have two brothers and one sister, and I was born last. ";
String englishLongWord = englishText.replaceAll(" ", "");
String koreanText = " 모든 사람은 교육을 받을 권리를 가진다 . 교육은 최소한 초등 및 기초단계에서는 무상이어야 한다. 초등교육은 의무적이어야 한다. 기술 및 직업교육은 일반적으로 접근이 가능하여야 하며, 고등교육은 모든 사람에게 실력에 근거하여 동등하게 접근 가능하여야 한다.";
String koreanLongWord = koreanText.replaceAll(" ", "");
String[] texts = {
chineseText,
englishText,
englishLongWord,
koreanText,
koreanLongWord,
};
JFrame jf = new JFrame();
GridLayout layoutManager = new GridLayout(texts.length, 1);
JPanel contentPane = new JPanel(layoutManager);
contentPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
jf.setContentPane(contentPane);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
for (String text : texts) {
TeXFormula formula = new TeXFormula("\\text{ " + text + "}");
TeXIcon icon = formula.new TeXIconBuilder().setStyle(TeXConstants.STYLE_DISPLAY)
.setSize(16)
.setWidth(TeXConstants.UNIT_PIXEL, 256f, TeXConstants.ALIGN_CENTER)
.setIsMaxWidth(true).setInterLineSpacing(TeXConstants.UNIT_PIXEL, 20f)
.build();
JLabel jl = new JLabel(icon);
jl.setBorder(BorderFactory.createLineBorder(Color.BLACK));
contentPane.add(jl);
}
jf.pack();
jf.setVisible(true);
}
}
Please, refer to this full example. Line breaks is supported by jLatexMath - however it doesn't work on the chinese utf-8 whitespace symbols. Furthermore - in XeLatex, when using the \usepackage{xeCJK}
package - it breaks even on word symbols.
from jlatexmath.
Sorry, not sure what you mean by "chinese utf-8 whitespace symbols" - what is the Unicode number for those?
from jlatexmath.
BTW setIsMaxWidth()
isn't present any more in the currently developed version (https://github.com/opencollab/jlatexmath/blob/experimental/jlatexmath/src/main/java/org/scilab/forge/jlatexmath/share/TeXFormula.java )
from jlatexmath.
BTW
setIsMaxWidth()
isn't present any more in the currently developed version (https://github.com/opencollab/jlatexmath/blob/experimental/jlatexmath/src/main/java/org/scilab/forge/jlatexmath/share/TeXFormula.java )
hello murkle,
thanks for the heads-up!
it looks like we need to set a length in the TeXEnvironment in order to get automatic line breaking:
Is experimental the branch leading up to 2.0 or 1.0.8?
Cheers and Best Regards,
Felix
from jlatexmath.
experimental == v2.0
from jlatexmath.
Sorry, not sure what you mean by "chinese utf-8 whitespace symbols" - what is the Unicode number for those?
U+3000, U+3001, U+3002, U+300C, U+300D and many many more. I don't think it's even possible to list them all in fact (I'm not that familiar with ideographic characters).
However the solution that breaks the lines at characters might work well too as it would add a line breaks for the cases above too. (maybe as an optional flag)
from jlatexmath.
I agree that https://www.fileformat.info/info/unicode/char/3000/index.htm is whitespace but not https://www.fileformat.info/info/unicode/char/3001/index.htm - that's a comma
I don't think you'd want to break on https://www.fileformat.info/info/unicode/char/300c/index.htm
You can use Character.isWhitespace() https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html
If that's not what you want then you'll need to compile a full list of what you do want to break on as a first step
from jlatexmath.
Does the JLaTeXMath of GeoGebra have auto linebreak?
from jlatexmath.
Nope
from jlatexmath.
Thanks, Michael. :-(
from jlatexmath.
Related Issues (20)
- needs to be modularized HOT 1
- unknown symbols brought by 'lvert' in latex formula expression HOT 2
- TypedAtom not generated when named function is inside a BigOperatorAtom
- License seems to be violated by GeoGebra
- Show only one line. I want it to show multi lines like textview. Thank team JLatexMath HOT 1
- Could anyone help me with the information about any new releases or new versions of JlatexMath after JlatexMath-1.0.7? HOT 3
- permil sign HOT 2
- need full documentation HOT 2
- Something wrong with the \underbrace and \overbrace ? HOT 3
- Polyglossia and Arabic Latex functionality
- Why garbled HOT 11
- JlatexMath-1.0.8-SNAPSHOT and DocBook/FOP
- New API to walk the layout tree or render to somewhere other than Graphics2D
- TeXFormula throws ParseException error HOT 2
- Nested fractions inside parentheses HOT 1
- latex \left\{ \begin{array}[1]\\2x+y=4 \\ x+2y=5 \\\end{array} \right. is not rignht HOT 1
- Is there a text Justify command/environment? HOT 1
- How to generate metric xml file from ttf file HOT 6
- Latent NPE in OverUnderBox
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jlatexmath.