Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscripts #71

Closed
Fedhman opened this issue Dec 8, 2015 · 5 comments
Closed

subscripts #71

Fedhman opened this issue Dec 8, 2015 · 5 comments
Assignees
Labels
enhancement A suggestion about how to improve the project programming Something related to the programming activity on the project

Comments

@Fedhman
Copy link

Fedhman commented Dec 8, 2015

They would be really usefull, expecially to differenciate resistors and capacitors (and so on).

@DarwinNE DarwinNE added enhancement A suggestion about how to improve the project programming Something related to the programming activity on the project labels Dec 8, 2015
@DarwinNE
Copy link
Owner

DarwinNE commented Dec 8, 2015

I agree, and the same is true for superscripts.

I thought it would be reasonable to implement a mini-markup language such as follows:

R_1 for R1 or I^2 for I2 and braces for longer stuff such as h_{fe} for hfe.

What do you think about it?

@Fedhman
Copy link
Author

Fedhman commented Dec 8, 2015

As LaTex programming languages. Yeah it would be perfect

@DarwinNE
Copy link
Owner

DarwinNE commented Dec 8, 2015

Exactly. I love LaTeX!

@DarwinNE DarwinNE added this to the FidoCadJ 0.24.7 milestone Aug 30, 2016
@DarwinNE DarwinNE self-assigned this May 3, 2020
@DarwinNE
Copy link
Owner

DarwinNE commented May 3, 2020

R_1 for R1 or I^2 for I2 and braces for longer stuff such as h_{fe} for hfe.

After much thought, I decided against it. This would require to implement a sort of a mini-language and I don't really want to do that. Instead, I think a good solution may be to use a very simple convention:

^  -> goes towards the exponent
_ -> goes towards the index

The meaning of those rules is the following one:

x^2 will be interpreted as "x2"
this is a ^test_ where the _rest^ is not important will yield "this is a test where the rest is not important"

In other words, in the second example the _ cancels the effect of ^ and vice versa. Parsing this is much easier than the LaTeX-style syntax.

DarwinNE added a commit that referenced this issue May 3, 2020
…unt the zoom level, but parsing ^ and _ commands is now active.
DarwinNE added a commit that referenced this issue May 5, 2020
…ess correct. Remain to be updated: calculation of text boundaries for selection and dirty area calculation during redraw, exporting towards vector formats.
DarwinNE added a commit that referenced this issue May 8, 2020
DarwinNE added a commit that referenced this issue May 18, 2020
DarwinNE added a commit that referenced this issue May 18, 2020
DarwinNE added a commit that referenced this issue May 19, 2020
@DarwinNE
Copy link
Owner

It has not been very easy, but at the end the implementation of superscripts and subscripts in the vector file export could be done relatively smoothly.

I finally opted for this description:

Subscripts: insert text between the underscore _ and the caret ^; for example _12^ writes 12 as a subscript. Superscripts: insert text between the caret ^ and the underscore _; for example ^56_ writes 56 as a superscript. In the two cases, the last ^ or _ are optional. To print the _ or ^ character, use a backspace, i.e. \_ to obtain _ and \^ to obtain ^. Use two backspaces to obtain a single \. Example: 3^2_+4^2_=5^2 or C_12

(resource text_hints in the English language).

I close this issue now, as the implementation is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion about how to improve the project programming Something related to the programming activity on the project
Projects
None yet
Development

No branches or pull requests

2 participants