When I run a latex file using Texmaker it generated extra files which are .aux, .log, .out, .bbl and .synctex.gz, how can i delete them so that my files will contain only .pdf and .tex.
3 Answers
As said by others, it's not really a great idea to (automatically) remove .aux, .log and similar files. Some of them provide important info in case things go wrong (for example .log), others are needed for things to actually work when you compile your document multiple times (.aux, .toc etc.). Deleting them can break things.
However, if this is related to a desire to have a cleaner working directory, there are a few ways to accomplish that (if not, then apologies for being presumptuous):
- For those who, like me, do things by hand, you can compile your document with the
output-directoryparameter. - Or you can configure TeXMaker to use an output directory for your files. Other tools may have similar options; I'm no expert on TeX IDEs.
Note, however, that both of these solutions will also put the .pdf file in the output/build directory.
Manual Compilation
The first option works thusly:
pdflatex -output-directory=build yourdocument
(or, instead of build, whichever other output directory you want to use)
Before compilation, make sure the build directory exists. Your working directory will look as follows:
.
├── build/
└── yourdocument.tex
After compilation, it will look like this:
.
├── build
│ ├── yourdocument.aux
│ ├── yourdocument.pdf
│ └── yourdocument.log
└── yourdocument.tex
Texmaker (unsure on other IDEs)
In Texmaker, go to the menu option Configure Texmaker and select the highlighted option:
Note that texmaker will create the build directory automatically, unlike pdflatex in console mode.
Addendum: Makefiles
If you want to have your pdf and your tex file in the same directory, but all the other files in the build dir, manual intervention is required, as far as I'm aware. I usually use Makefiles to automate my process, but I'll admit that that might not necessarily be a solution for everyone.
Still, a short example for such a Makefile:
default:
mkdir -p build
pdflatex -output-directory=build mydocument
mv build/mydocument.pdf ./
Then I can just type make in the working directory on the terminal and it will do the right thing, giving me this situation:
.
├── build
│ ├── mydocument.aux
│ └── mydocument.log
├── mydocument.pdf
└── mydocument.tex
- 2,455
Well, It will help you provided that you are using the texstudio editor. Just open your main .tex file. Then compile it once, it will generate the temporary and auxiliary files. Then, go to Tools -> Clean Auxillary files. This will help you, for sure. I don't have any knowledge regarding texmaker and winedit. I hope that these editor provides the same feature as of texstudio. Additionally, you can also delete the temporary files manually by going to the same folder.
Hope it helps.
- 1,552
Simply for Texmaker ,compile your file using Quick build then in the top bar navigate Tools then clean, yet you have to do that each time you compile.
- 211

latexmkorararahave rules to clean up after the compile chain. You can also set texmaker to delete the files. But why on earth? Those files are important and don't do any harm. – Johannes_B May 15 '17 at 04:46