# Merge TEX Learn how to merge TEX files, combine TEX files into one file programmatically in java language using GroupDocs.Merger for Java library. ## How to merge TEX files in Java [GroupDocs.Merger](https://products.groupdocs.com/merger/java) allows developers to merge TEX files when it's needed to organize multiple TEX files into single document or send fewer attachments etc. And you can do this without any third-party software or manual work involved. With GroupDocs.Merger it is possible to combine TEX documents of any size and structure - all text, images, tables, graphs, forms and other content will be preserved. The following example demonstrates how to merge TEX files with several lines of java code: * Create an instance of [Merger](https://reference.groupdocs.com/merger/java/com.groupdocs.merger/Merger) class and pass source TEX file path as a constructor parameter. You may specify absolute or relative file path as per your requirements. * Add another TEX file to merge with [join](https://reference.groupdocs.com/merger/java/com.groupdocs.merger/Merger#join(java.io.InputStream)) method. Repeat this step for other TEX documents you want to merge. * Call [Merger](https://reference.groupdocs.com/merger/java/com.groupdocs.merger/Merger) class [save](https://reference.groupdocs.com/merger/java/com.groupdocs.merger/Merger#save(java.io.OutputStream)) method and specify the filename for the merged TEX file as parameter. ```java // Load the source TEX file Merger merger = new Merger("c:\sample1.tex") // Add another TEX file to merge merger.join("c:\sample2.tex"); // Merge TEX files and save result merger.save("c:\merged.tex"); ``` ### About TEX File Format TeX is a language that consists of programming as well as mark-up features, used to typeset documents. Donald Knuth from Stanford University, is the creator of this resourceful typesetting system. Across the world, TeX is the ultimate choice of authors and publishers to produce high quality technical documents. TeX performs an outstanding job of formatting complex mathematical expressions. In conjunction with a high-quality phototypesetter, TeX competes the results generated by the best traditional typesetting systems. ### Code Examples Please find more [use-cases and complete Java sources]({{< ref "merger/java/showcases.md" >}}) of our backend and frontend examples and try them for free! ### Merge TEX Live Demo GroupDocs.Merger for Java provides an online [**TEX Merger App**](https://products.groupdocs.app/merger/tex), which allows you to try it for free and check its quality and accuracy. [!["Merge TEX"](https://docs.groupdocs.com/merger/java/images/merge/merge-tex.png)](https://products.groupdocs.app/merger/tex)