[TxMt] Re: LaTeX users: best practice for changing \label

René Schwaiger sanssecours at f-m.fm
Sat Mar 28 12:48:52 UTC 2015


Hi Ross,

> On 28 Mar 2015, at 10:25 , Ross Ahmed <rossahmed at googlemail.com> wrote:
> 
> In my .tex file, I have section titles and labels like this:
> 
> \section{My section title}
> \label{sec:my_section_title}
> 
> I can then cross-reference this section in my text like this:
> 
> Lorem ipsum dolor sit amet \ref{my_section_title}
> 
> I'm frequently changing my section titles to something very different different which forces me to change my labels and cross references. This can becomes tedious when my cross references are scattered through a long document.
> 
> What is the best way of changing labels in which the cross references are scattered through long development?

I would just use “Find All”:

1. Select one occurrence of the word you want to replace e.g. `sec:my_section_title`
2. Invoke “Find All”: `⌘F`
3. Write down the new name of the label

If you want to replace the label in a project with multiple files:

1. Select one occurrence of the word you want to replace e.g. `sec:my_section_title`
2. Copy the selection to the “Find Clipboard” by pressing `⌘E`
3. Open the Find Window: `⇧⌘F`
4. Use “Find All”: `↩`
5. Enter the replacement in the field on the right of “Replace:”
6. Press “Replace All”

> Is there any way to automate the process?

I guess so. But I don't think that automating would help that much.

> Ross Ahmed
> Ecologist
> --
> 07875533906
> Twitter: @RossAhmed
> LinkedIn: Ross Ahmed

Kind regards,
  René


More information about the textmate mailing list