Skip to content

Commit

Permalink
Merge pull request #3735 from Toseflo/master
Browse files Browse the repository at this point in the history
Add diffcoeff and upgreek packages to command completion
  • Loading branch information
PHPirates authored Nov 12, 2024
2 parents 3e4defa + 28bffe9 commit 83a0dd1
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 53 deletions.
2 changes: 2 additions & 0 deletions src/nl/hannahsten/texifyidea/lang/LatexPackage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ open class LatexPackage @JvmOverloads constructor(
val COLOR = LatexPackage("color")
val COMMENT = LatexPackage("comment")
val CSQUOTES = LatexPackage("csquotes")
val DIFFCOEFF = LatexPackage("diffcoeff")
val ETOOLBOX = LatexPackage("etoolbox")
val EUROSYM = LatexPackage("eurosym")
val FLOAT = LatexPackage("float")
Expand Down Expand Up @@ -87,6 +88,7 @@ open class LatexPackage @JvmOverloads constructor(
val TEXTCOMP = LatexPackage("textcomp")
val TIKZ = LatexPackage("tikz")
val ULEM = LatexPackage("ulem")
val UPGREEK = LatexPackage("upgreek")
val VARIOREF = LatexPackage("varioref")
val WASYSYM = LatexPackage("wasysym")
val WIDETABLE = LatexPackage("widetable")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package nl.hannahsten.texifyidea.lang.commands

import nl.hannahsten.texifyidea.lang.LatexPackage

/**
* @author Florian Kraft
*/
enum class LatexDiffcoeffCommand(
override val command: String,
override vararg val arguments: Argument = emptyArray(),
override val dependency: LatexPackage = LatexPackage.DIFFCOEFF,
override val display: String? = null,
override val isMathMode: Boolean = true,
) : LatexCommand {

DIFF("diff", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFF_STAR("diff*", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFF_STAR_STAR("diff**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
DIFFP("diffp", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFFP_STAR("diffp*", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFFP_STAR_STAR("diffp**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
DIFS("difs", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFS_STAR("difs*", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFS_STAR_STAR("difs**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
DIFSP("difsp", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFSP_STAR("difsp*", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFSP_STAR_STAR("difsp**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
DIFC("difc", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFC_STAR_STAR("difc**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
DIFCP("difcp", "order-spec".asOptional(), "differentiand".asRequired(), "variable(s)".asRequired(), "pt of eval".asOptional()),
DIFCP_STAR_STAR("difcp**", "order-spec".asOptional(), "variable(s)".asRequired(), "differentiand".asRequired(), "pt of eval".asOptional()),
;

override val identifier: String
get() = name
}
102 changes: 51 additions & 51 deletions src/nl/hannahsten/texifyidea/lang/commands/LatexGreekCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,57 @@ enum class LatexGreekCommand(
val collapse: Boolean = false
) : LatexCommand {

ALPHA("alpha", display = "α", collapse = true),
BETA("beta", display = "β", collapse = true),
GAMMA("gamma", display = "γ", collapse = true),
CAPITAL_GAMMA("Gamma", display = "Γ", collapse = true),
CAPITAL_GAMMA_VARIANT("varGamma", dependency = AMSMATH, collapse = true),
DELTA("delta", display = "δ", collapse = true),
CAPITAL_DELTA("Delta", display = "Δ", collapse = true),
CAPITAL_DELTA_VARIANT("varDelta", dependency = AMSMATH, collapse = true),
EPSILON("epsilon", display = "ϵ", collapse = true),
BETTER_LOOKING_EPSILON("varepsilon", display = "ε", collapse = true),
ZETA("zeta", display = "ζ", collapse = true),
ETA("eta", display = "η", collapse = true),
THETA("theta", display = "θ", collapse = true),
THETA_VARIANT("vartheta", display = "ϑ", collapse = true),
CAPITAL_THETA("Theta", display = "Θ", collapse = true),
CAPITAL_THETA_VARIANT("varTheta", dependency = AMSMATH, collapse = true),
IOTA("iota", display = "ι", collapse = true),
KAPPA("kappa", display = "κ", collapse = true),
LAMBDA("lambda", display = "λ", collapse = true),
CAPITAL_LAMBDA("Lambda", display = "Λ", collapse = true),
CAPITAL_LAMBDA_VARIANT("varLambda", dependency = AMSMATH, collapse = true),
MU("mu", display = "μ", collapse = true),
NU("nu", display = "ν", collapse = true),
XI("xi", display = "ξ", collapse = true),
CAPITAL_XI("Xi", display = "Ξ", collapse = true),
CAPITAL_XI_VARIANT("varXi", dependency = AMSMATH, collapse = true),
PI("pi", display = "π", collapse = true),
PI_VARIANT("varpi", display = "ϖ", collapse = true),
CAPITAL_PI("Pi", display = "Π", collapse = true),
CAPITAL_PI_VARIANT("varPi", dependency = AMSMATH, collapse = true),
RHO("rho", display = "ρ", collapse = true),
RHO_VARIANT("varrho", display = "ϱ", collapse = true),
SIGMA("sigma", display = "σ", collapse = true),
FINAL_SIGMA("varsigma", display = "ς", collapse = true),
CAPITAL_SIGMA("Sigma", display = "Σ", collapse = true),
CAPITAL_SIGMA_VARIANT("varSigma", dependency = AMSMATH, collapse = true),
TAU("tau", display = "τ", collapse = true),
UPSILON("upsilon", display = "υ", collapse = true),
CAPITAL_UPSILON("Upsilon", display = "ϒ", collapse = true),
CAPITAL_UPSILON_VARIANT("Upsilon", dependency = AMSMATH, collapse = true),
PHI_STRAIGHT("phi", display = "ϕ", collapse = true),
PHI_CURLY("varphi", display = "φ", collapse = true),
CAPITAL_PHI("Phi", display = "Φ", collapse = true),
CAPITAL_PHI_VARIANT("varPhi", dependency = AMSMATH, collapse = true),
CHI("chi", display = "χ", collapse = true),
PSI("psi", display = "ψ", collapse = true),
CAPITAL_PSI("Psi", display = "Ψ", collapse = true),
CAPITAL_PSI_VARIANT("varPsi", dependency = AMSMATH, collapse = true),
OMEGA("omega", display = "ω", collapse = true),
CAPITAL_OMEGA("Omega", display = "Ω", collapse = true),
CAPITAL_OMEGA_VARIANT("varOmega", dependency = AMSMATH, collapse = true),
ALPHA("alpha", display = "α"),
BETA("beta", display = "β"),
GAMMA("gamma", display = "γ"),
CAPITAL_GAMMA("Gamma", display = "Γ"),
CAPITAL_GAMMA_VARIANT("varGamma", dependency = AMSMATH),
DELTA("delta", display = "δ"),
CAPITAL_DELTA("Delta", display = "Δ"),
CAPITAL_DELTA_VARIANT("varDelta", dependency = AMSMATH),
EPSILON("epsilon", display = "ϵ"),
BETTER_LOOKING_EPSILON("varepsilon", display = "ε"),
ZETA("zeta", display = "ζ"),
ETA("eta", display = "η"),
THETA("theta", display = "θ"),
THETA_VARIANT("vartheta", display = "ϑ"),
CAPITAL_THETA("Theta", display = "Θ"),
CAPITAL_THETA_VARIANT("varTheta", dependency = AMSMATH),
IOTA("iota", display = "ι"),
KAPPA("kappa", display = "κ"),
LAMBDA("lambda", display = "λ"),
CAPITAL_LAMBDA("Lambda", display = "Λ"),
CAPITAL_LAMBDA_VARIANT("varLambda", dependency = AMSMATH),
MU("mu", display = "μ"),
NU("nu", display = "ν"),
XI("xi", display = "ξ"),
CAPITAL_XI("Xi", display = "Ξ"),
CAPITAL_XI_VARIANT("varXi", dependency = AMSMATH),
PI("pi", display = "π"),
PI_VARIANT("varpi", display = "ϖ"),
CAPITAL_PI("Pi", display = "Π"),
CAPITAL_PI_VARIANT("varPi", dependency = AMSMATH),
RHO("rho", display = "ρ"),
RHO_VARIANT("varrho", display = "ϱ"),
SIGMA("sigma", display = "σ"),
FINAL_SIGMA("varsigma", display = "ς"),
CAPITAL_SIGMA("Sigma", display = "Σ"),
CAPITAL_SIGMA_VARIANT("varSigma", dependency = AMSMATH),
TAU("tau", display = "τ"),
UPSILON("upsilon", display = "υ"),
CAPITAL_UPSILON("Upsilon", display = "ϒ"),
CAPITAL_UPSILON_VARIANT("Upsilon", dependency = AMSMATH),
PHI_STRAIGHT("phi", display = "ϕ"),
PHI_CURLY("varphi", display = "φ"),
CAPITAL_PHI("Phi", display = "Φ"),
CAPITAL_PHI_VARIANT("varPhi", dependency = AMSMATH),
CHI("chi", display = "χ"),
PSI("psi", display = "ψ"),
CAPITAL_PSI("Psi", display = "Ψ"),
CAPITAL_PSI_VARIANT("varPsi", dependency = AMSMATH),
OMEGA("omega", display = "ω"),
CAPITAL_OMEGA("Omega", display = "Ω"),
CAPITAL_OMEGA_VARIANT("varOmega", dependency = AMSMATH),
;

override val identifier: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import arrow.core.getOrNone
import arrow.core.nonEmptySetOf

/**
* @author Hannah Schellekens, Sten Wessel
* @author Hannah Schellekens, Sten Wessel, Florian Kraft
*/
object LatexMathCommand {

Expand All @@ -16,9 +16,11 @@ object LatexMathCommand {
private val ARROWS: Set<LatexCommand> = LatexArrowCommand.entries.toSet()
private val GENERIC_COMMANDS: Set<LatexCommand> = LatexGenericMathCommand.entries.toSet()
private val UNCATEGORIZED_STMARYRD_SYMBOLS: Set<LatexCommand> = LatexUncategorizedStmaryrdSymbols.entries.toSet()
private val DIFFCOEFF: Set<LatexCommand> = LatexDiffcoeffCommand.entries.toSet()
private val UPGREEK: Set<LatexCommand> = LatexUpgreekCommand.entries.toSet()

private val ALL: Set<LatexCommand> = GREEK_ALPHABET + OPERATORS + MATHTOOLS_COLONEQ + DELIMITERS + ARROWS +
GENERIC_COMMANDS + UNCATEGORIZED_STMARYRD_SYMBOLS
GENERIC_COMMANDS + UNCATEGORIZED_STMARYRD_SYMBOLS + DIFFCOEFF + UPGREEK

private val lookup = HashMap<String, NonEmptySet<LatexCommand>>()
private val lookupDisplay = HashMap<String, NonEmptySet<LatexCommand>>()
Expand Down
62 changes: 62 additions & 0 deletions src/nl/hannahsten/texifyidea/lang/commands/LatexUpgreekCommand.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package nl.hannahsten.texifyidea.lang.commands

import nl.hannahsten.texifyidea.lang.LatexPackage
import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.UPGREEK

/**
* @author Florian Kraft
*/
enum class LatexUpgreekCommand(
override val command: String,
override vararg val arguments: Argument = emptyArray(),
override val dependency: LatexPackage = LatexPackage.DEFAULT,
override val display: String? = null,
override val isMathMode: Boolean = true,
val collapse: Boolean = false
) : LatexCommand {

UPALPHA("upalpha", display = "α", dependency = UPGREEK),
UPBETA("upbeta", display = "β", dependency = UPGREEK),
UPGAMMA("upgamma", display = "γ", dependency = UPGREEK),
UPGAMMA_CAPITAL("Upgamma", display = "Γ", dependency = UPGREEK),
UPDELTA("updelta", display = "δ", dependency = UPGREEK),
UPDELTA_CAPITAL("Updelta", display = "Δ", dependency = UPGREEK),
UPEPSILON("upepsilon", display = "ϵ", dependency = UPGREEK),
UPEPSILON_VARIANT("upvarepsilon", display = "ε", dependency = UPGREEK),
UPZETA("upzeta", display = "ζ", dependency = UPGREEK),
UPETA("upeta", display = "η", dependency = UPGREEK),
UPTHETA("uptheta", display = "θ", dependency = UPGREEK),
UPTHETA_VARIANT("upvartheta", display = "ϑ", dependency = UPGREEK),
UPTHETA_CAPITAL("Uptheta", display = "Θ", dependency = UPGREEK),
UPIOTA("upiota", display = "ι", dependency = UPGREEK),
UPKAPPA("upkappa", display = "κ", dependency = UPGREEK),
UPLAMBDA("uplambda", display = "λ", dependency = UPGREEK),
UPLAMBDA_CAPITAL("Uplambda", display = "Λ", dependency = UPGREEK),
UPMU("upmu", display = "μ", dependency = UPGREEK),
UPNU("upnu", display = "ν", dependency = UPGREEK),
UPXI("upxi", display = "ξ", dependency = UPGREEK),
UPXI_CAPITAL("Upxi", display = "Ξ", dependency = UPGREEK),
UPPI("uppi", display = "π", dependency = UPGREEK),
UPPI_VARIANT("upvarpi", display = "ϖ", dependency = UPGREEK),
UPPI_CAPITAL("Uppi", display = "Π", dependency = UPGREEK),
UPRHO("uprho", display = "ρ", dependency = UPGREEK),
UPRHO_VARIANT("upvarrho", display = "ρ", dependency = UPGREEK),
UPSIGMA("upsigma", display = "σ", dependency = UPGREEK),
UPSIGMA_VARIANT("upvarsigma", display = "σ", dependency = UPGREEK),
UPSIGMA_CAPITAL("Upsigma", display = "Σ", dependency = UPGREEK),
UPTAU("uptau", display = "τ", dependency = UPGREEK),
UPUPSILON("upupsilon", display = "υ", dependency = UPGREEK),
UPUPSILON_CAPITAL("Upupsilon", display = "ϒ", dependency = UPGREEK),
UPPHI("upphi", display = "ϕ", dependency = UPGREEK),
UPPHI_VARIANT("upvarphi", display = "φ", dependency = UPGREEK),
UPPHI_CAPITAL("Upphi", display = "Φ", dependency = UPGREEK),
UPCHI("upchi", display = "χ", dependency = UPGREEK),
UPPSI("uppsi", display = "ψ", dependency = UPGREEK),
UPPSI_CAPITAL("Uppsi", display = "Ψ", dependency = UPGREEK),
UPOMEGA("upomega", display = "ω", dependency = UPGREEK),
UPOMEGA_CAPITAL("Upomega", display = "Ω", dependency = UPGREEK),
;

override val identifier: String
get() = name
}

0 comments on commit 83a0dd1

Please sign in to comment.