diff --git a/File-Formats/DocIO/Working-with-LaTeX.md b/File-Formats/DocIO/Working-with-LaTeX.md index 00397d842..4b60fefa3 100644 --- a/File-Formats/DocIO/Working-with-LaTeX.md +++ b/File-Formats/DocIO/Working-with-LaTeX.md @@ -313,6 +313,7 @@ The following code example illustrates how to create border box equation using L {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} +{% raw %} // Create a new Word document. using WordDocument document = new WordDocument(); @@ -326,10 +327,11 @@ document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}"); using MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); - +{% endraw %} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} +{% raw %} // Create a new Word document. using WordDocument document = new WordDocument(); @@ -342,9 +344,11 @@ document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}"); //Save the Word document. document.Save("Result.docx", FormatType.Docx); +{% endraw %} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +{% raw %} ' Create a new Word document. Dim document As WordDocument = New WordDocument() @@ -357,6 +361,7 @@ document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}") 'Save the Word document. document.Save("Result.docx", FormatType.Docx) +{% endraw %} {% endhighlight %} {% endtabs %} @@ -375,7 +380,7 @@ The following table demonstrates the LaTeX equivalent to professional format bor 1. Border Box equation -\boxed{{x}^{2}+{y}^{2}={z}^{2}} +{% raw %}\boxed{{x}^{2}+{y}^{2}={z}^{2}}{% endraw %} @@ -1569,3 +1574,265 @@ The following table demonstrates the LaTeX equivalent to professional format Rig {\mathbf{100}}_{\mathbf{40}}^{\mathbf{20}} + +## Format Equations + +### Apply style to characters + +Apply styles to characters, such as bold and bold-italic, for equations in a Word document using LaTeX with the .NET Word Library. Apply the following styles using LaTeX commands. + + + + + + + + + + + + + + + + +
StylesLaTeX
+Bold

+\mathbf

+BoldItalic

+\mathbit

+ +The following code example demonstrates how to apply styles to characters within equations in a Word document. + +{% tabs %} + +{% highlight c# tabtitle="C# [Cross-platform]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation with bold using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathbf{a}}"); + //Append an accent equation with bold-italic using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathbit{a}}"); + + //Save a Word document to the MemoryStream. + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation with bold using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathbf{a}}"); + //Append an accent equation with bold-italic using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathbit{a}}"); + + //Save a Word document. + document.Save("Result.docx", FormatType.Docx); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +' Create a new Word document. +Dim document As WordDocument = New WordDocument() + +'Add one section and one paragraph to the document. +document.EnsureMinimal() + +'Append an accent equation with Bold using LaTeX. +document.LastParagraph.AppendMath(@"\dot{\mathbf{a}}") +'Append an accent equation with Bold-Italic using LaTeX. +document. LastSection.AddParagraph().AppendMath(@"\dot{\mathbit{a}}") + +'Save the Word document. +document.Save("Result.docx", FormatType.Docx) +{% endhighlight %} + +{% endtabs %} + +### Apply scripts to the equation + +Apply scripts, such as double-struck, fraktur, and more, to equations in a Word document using LaTeX with the .NET Word Library. Apply the following scripts using LaTeX commands. + + + + + + + + + + + + + + + + + + + + + + + + +
ScriptsLaTeX
+Double-struck

+\mathbb

+Fraktur

+\mathfrak

+Sans Serif

+\mathsf

+Script

+\mathscr
\mathcal
+ +The following code examples show how to apply the scripts to equations in a Word document. + +{% tabs %} + +{% highlight c# tabtitle="C# [Cross-platform]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation with Double-Struck font using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathbb{a}}"); + //Append an accent equation with Fraktur font using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathfrak{a}}"); + //Append an accent equation with Sans Serif font using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathsf{a}}"); + //Append an accent equation with Script using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathcal{a}}"); + //Append an accent equation with Script using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathscr{a}}"); + + //Save a Word document to the MemoryStream. + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation with DoubleStruck font using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathbb{a}}"); + //Append an accent equation with Fraktur font using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathfrak{a}}"); + //Append an accent equation with SansSerif font using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathsf{a}}"); + //Append an accent equation with Script using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathcal{a}}"); + //Append an accent equation with Script using LaTeX. + document.LastSection.AddParagraph().AppendMath(@"\dot{\mathscr{a}}"); + + //Save a Word document. + document.Save("Result.docx", FormatType.Docx); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +' Create a new Word document. +Dim document As WordDocument = New WordDocument() + +'Add one section and one paragraph to the document. +document.EnsureMinimal() + +'Append an accent equation with DoubleStruck font using LaTeX. +document.LastParagraph.AppendMath(@"\dot{\mathbb{a}}") +'Append an accent equation with Fraktur font using LaTeX. +document.LastSection.AddParagraph().AppendMath(@"\dot{\mathfrak{a}}") +'Append an accent equation with SansSerif font using LaTeX. +document. LastSection.AddParagraph().AppendMath(@"\dot{\mathsf{a}}") +'Append an accent equation with Script using LaTeX. +document. LastSection.AddParagraph().AppendMath(@"\dot{\mathcal{a}}") +'Append an accent equation with Script using LaTeX. +document. LastSection.AddParagraph().AppendMath(@"\dot{\mathscr{a}}") + +'Save a Word document. +document.Save("Result.docx", FormatType.Docx) +{% endhighlight %} + +{% endtabs %} + +![Apply scripts to the equation](WorkingwithMathematicalEquation_images/scripts.png) + +### Preserve as normal text + +By default, characters in equations in a Word document are in italics. However, you can also include normal text within an equation using LaTeX. + +The following code example shows how to preserve text as normal text, without any default formatting, within an equation using LaTeX. + +{% tabs %} + +{% highlight c# tabtitle="C# [Cross-platform]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation as normal text using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathrm{a}}"); + + //Save a Word document to the MemoryStream. + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +// Create a new Word document. +using (WordDocument document = new WordDocument()) +{ + //Add one section and one paragraph to the document. + document.EnsureMinimal(); + + //Append an accent equation as normal text using LaTeX. + document.LastParagraph.AppendMath(@"\dot{\mathrm{a}}"); + + //Save a Word document. + document.Save("Result.docx", FormatType.Docx); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +' Create a new Word document. +Dim document As WordDocument = New WordDocument() + +'Add one section and one paragraph to the document. +document.EnsureMinimal() + +'Append an accent equation as normal text using LaTeX. +document.LastParagraph.AppendMath(@"\dot{\mathrm{a}}") + +'Save a Word document. +document.Save("Result.docx", FormatType.Docx) +{% endhighlight %} + +{% endtabs %} + +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Mathematical-Equation/LaTeX-equations/Format%20Equation). \ No newline at end of file diff --git a/File-Formats/DocIO/WorkingwithMathematicalEquation_images/scripts.png b/File-Formats/DocIO/WorkingwithMathematicalEquation_images/scripts.png new file mode 100644 index 000000000..6f58d33f5 Binary files /dev/null and b/File-Formats/DocIO/WorkingwithMathematicalEquation_images/scripts.png differ diff --git a/File-Formats/Release-Notes/v24.1.47.md b/File-Formats/Release-Notes/v24.1.47.md index b380250cd..ddb797f31 100644 --- a/File-Formats/Release-Notes/v24.1.47.md +++ b/File-Formats/Release-Notes/v24.1.47.md @@ -9,6 +9,19 @@ documentation: ug {% include release-info.html date="January 23, 2024" version="v24.1.47" %} + + +
+With the 2024 Volume 1 release, we will discontinue support for .NET Framework 4.5, 4.5.1, and 4.6 in WinForms, WPF, and the File-Format Frameworks. Instead, we will provide support for .NET 4.6.2. +
## DocIO