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.
As said by others, it's not really a great idea to (automatically) remove
.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 (
.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
- 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
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.
If you want to have 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
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
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.