@copylee/dsh-office 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -803,7 +803,7 @@ static class Program
803
803
  { "Sigma", "Σ" }, { "Phi", "Φ" }, { "Psi", "Ψ" }, { "Omega", "Ω" },
804
804
  { "cdot", "⋅" }, { "times", "×" }, { "div", "÷" }, { "pm", "±" }, { "mp", "∓" }, { "approx", "≈" }, { "neq", "≠" }, { "ne", "≠" },
805
805
  { "leq", "≤" }, { "le", "≤" }, { "geq", "≥" }, { "ge", "≥" }, { "ll", "≪" }, { "gg", "≫" }, { "equiv", "≡" }, { "propto", "∝" }, { "sim", "∼" },
806
- { "infty", "∞" }, { "partial", "∂" }, { "nabla", "∇" }, { "sum", "∑" }, { "prod", "∏" }, { "int", "∫" }, { "oint", "∮" },
806
+ { "infty", "∞" }, { "partial", "∂" }, { "nabla", "∇" }, { "sum", "∑" }, { "prod", "∏" }, { "int", "∫" }, { "oint", "∮" }, { "iint", "∬" }, { "iiint", "∭" }, { "oiint", "∯" },
807
807
  { "to", "→" }, { "rightarrow", "→" }, { "leftarrow", "←" }, { "Rightarrow", "⇒" }, { "Leftrightarrow", "⇔" }, { "in", "∈" }, { "notin", "∉" },
808
808
  { "subset", "⊂" }, { "cup", "∪" }, { "cap", "∩" }, { "forall", "∀" }, { "exists", "∃" }, { "angle", "∠" }, { "perp", "⊥" }, { "parallel", "∥" },
809
809
  { "circ", "∘" }, { "degree", "°" }, { "ldots", "…" }, { "cdots", "⋯" }, { "dots", "…" }, { "prime", "′" }, { "hbar", "ℏ" }, { "ell", "ℓ" },
@@ -855,13 +855,22 @@ static class Program
855
855
  {
856
856
  StringBuilder o = new StringBuilder();
857
857
  int i = 0;
858
+ // Integral signs written one after another are one multiple integral.
859
+ if (s.IndexOf("\\int", StringComparison.Ordinal) >= 0)
860
+ {
861
+ s = System.Text.RegularExpressions.Regex.Replace(s, @"\\int(?:\s|\\!)*\\int(?:\s|\\!)*\\int(?![a-zA-Z])", "\\iiint");
862
+ s = System.Text.RegularExpressions.Regex.Replace(s, @"\\int(?:\s|\\!)*\\int(?![a-zA-Z])", "\\iint");
863
+ }
858
864
  // A sum, product or integral was written and its limits may still follow; what comes after them is its
859
865
  // operand, which Word's linear format introduces with "▒" (left out, Word draws an empty box there).
860
866
  bool nary = false;
861
867
  while (i < s.Length)
862
868
  {
863
869
  char c = s[i];
864
- if (nary && c != '^' && c != '_' && c != ' ')
870
+ // Nothing may stand between the limits and "▒": a space there ends the operator with an empty operand.
871
+ if (nary && c == ' ') { i++; continue; }
872
+ if (nary && c == '\\' && i + 1 < s.Length && ",;:! ".IndexOf(s[i + 1]) >= 0) { i += 2; continue; }
873
+ if (nary && c != '^' && c != '_')
865
874
  {
866
875
  if (c == '\\' && string.CompareOrdinal(s, i, "\\limits", 0, 7) == 0) { i += 7; continue; }
867
876
  if (c == '\\' && string.CompareOrdinal(s, i, "\\nolimits", 0, 9) == 0) { i += 9; continue; }
@@ -953,8 +962,10 @@ static class Program
953
962
  string symbol;
954
963
  if (TexSymbols.TryGetValue(name, out symbol))
955
964
  {
965
+ // A function name right after a letter (r\cos u) would be read as one word with it.
966
+ if (symbol.Length > 1 && symbol == name && o.Length > 0 && char.IsLetter(o[o.Length - 1])) o.Append(' ');
956
967
  o.Append(symbol);
957
- if (symbol == "∑" || symbol == "∏" || symbol == "∫" || symbol == "∮") nary = true;
968
+ if (symbol == "∑" || symbol == "∏" || symbol == "∫" || symbol == "∮" || symbol == "∬" || symbol == "∭" || symbol == "∯") nary = true;
958
969
  // A function name is applied to what follows: Word needs a space after it.
959
970
  if (symbol.Length > 1 && symbol == name && i < s.Length && s[i] != ' ' && s[i] != '^' && s[i] != '_') o.Append(' ');
960
971
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copylee/dsh-office",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "DeepSeek Harness Office 插件(Windows):AI 直接在你打开的 Word / Excel / PowerPoint 里改文档,改动实时出现在窗口中,你可以同时编辑;读结构、批量编辑、渲染成图核对、保存。",
5
5
  "type": "module",
6
6
  "author": "copylee",