Texmaker and TeXstudioSearching in files to be included

Information and discussion about Texmaker, an integrated LaTeX environment for several platforms, and the related TeXstudio
Post Reply
NinV
Posts: 69
Joined: Sun Oct 05, 2008 12:57 pm

Searching in files to be included

Post by NinV »

Hi,

I'm writing a document which is getting too big. So I decided to split it into different files using the command \include. To my surprise I'm not able to do a search in all files, as far as I understand it's possibile to do a search only in the file which you are working on.

Is there a way to do a multifile search?

Thank you for any help.
Nino
Window + MiKTeX 2.7
Ubuntu + TexLive + Kile
Xandros (eeePC) + TeTex + TexMaker

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Searching in files to be included

Post by frabjous »

Couldn't you just use grep from the command line?

E.g.:

Code: Select all

grep -n "Search word" *
will search all the files in the folder for a given search word and return the filenames, line numbers and matching lines.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Searching in files to be included

Post by meho_r »

I used to use a combination: Texmaker(X) for initial document preparation (entering text, commands and stuff) and TeXWorks for the second stage (reviewing and correcting mistakes; TeXWorks can search for a string in all open files). Also, Kile's projects allow you to search through all files that belong to a project.

EDIT: Actually, now I see that TexmakerX too has a search scope: "open documents". It seems that only TM is falling behind in that regard.
NinV
Posts: 69
Joined: Sun Oct 05, 2008 12:57 pm

Searching in files to be included

Post by NinV »

frabjous wrote:Couldn't you just use grep from the command line?
Are you serious? If so, I really fail to understand how it is possible to work this way! How long does it take to edit a big document split in several files?

Thanks,
Nino
Window + MiKTeX 2.7
Ubuntu + TexLive + Kile
Xandros (eeePC) + TeTex + TexMaker
NinV
Posts: 69
Joined: Sun Oct 05, 2008 12:57 pm

Re: Searching in files to be included

Post by NinV »

Thank you all for your attention. It seems that I have to get rid of Texmaker :o

Nino
Window + MiKTeX 2.7
Ubuntu + TexLive + Kile
Xandros (eeePC) + TeTex + TexMaker
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Searching in files to be included

Post by frabjous »

NinV wrote:
frabjous wrote:Couldn't you just use grep from the command line?
Are you serious? If so, I really fail to understand how it is possible to work this way! How long does it take to edit a big document split in several files?
I'm not suggesting you do all your editing from the command line. Just multi-file finds and finds/replaces. (And if you want to do the replaces, you can use sed.)

If you stick with linux, you'll find more and more uses for the commandline. It does not slow things down. It speeds things up. You can batch-do anything. It helps that I always have at least one (typically four) teminals running, which I can access with a single key. (I use guake drop-down terminal; on Kubuntu you might prefer Yakuake.)

But by all means, if you want this feature in your editor, switch editors! I was just suggesting it in case you didn't want to switch. TexMakerX is of course the natural thing to move to from Texmaker. Your sig. suggests you know Kile already so I don't know why you're not using that. Are the KDE libs too much for your netbook?

I use vim personally, which of course has this feature, though I tend just to do things like this from the commandline, because, honestly, it's faster! Also, I don't constantly have to have every file in my project open at once eating up RAM when I'm only editing one of them.
minidiable
Posts: 30
Joined: Tue Nov 13, 2012 4:18 pm

Searching in files to be included

Post by minidiable »

I found the solution with GREP pretty useful.

I wanted just to add that you can search recursively in all the folders of the directory in which you are by using the following command:

Code: Select all

grep -rn "WordToSearch" *
I hope someone will find it useful.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Searching in files to be included

Post by Stefan Kottwitz »

Thanks, that's a very good addition! Not everybody knows the -r switch. Older versions of grep did not support recursive search, I think. In earlier times I used find such as by find "." -name "*.tex" | xargs grep search <string>.

Stefan
LaTeX.org admin
Post Reply