How to get a list of all the labels in a LaTeX document in WinEdt

I don't know about a list of labels, but you can try using the showkeys package from CTAN to print the labels in the margins wherever you define them. I use this in my final proof reading to make sure I have everything labeled and in order.


I wanted a list of all the labels in my project and wasn't entirely satisfied with the answers listed here so I wrote a bit of Python to search through my LaTeX project files, find all the labels, and print them out by category. Here is an iPython notebook that demonstrates the code. This code presumes that all your labels are of the form chp:chapter_name or fig:fig_name. i.e. word characters with a colon in the middle. The regular expressions patterns can be modified to fit whatever convention you're using.

Here is the important part of the code:

# reg exp to find full label specifications
patt = re.compile("\\label{(\w*:\w*)}") 
# reg exp to find `addtotoc` labels
app_patt = re.compile("(\w+:\w+)")

lbls = []
for root, dirs, files in os.walk(chdir):
    for fn in files: 
        if fn == 'main.tex':
            # my project has some appendices that are pulled into
            # the project using includepdf and the labels for these
            # are specified using `addtotoc`. This if statement
            # finds those labels in main.tex.
            with open(os.path.join(root, fn)) as f:
                lbls.extend(re.findall(app_patt, f.read()))
        elif fn.endswith(".tex") and fn<>"zTemplateChapter1.tex":
            # there's a template file in my project that I don't
            # want to search for labels.
            with open(os.path.join(root,fn)) as f:
                txt = f.read()
                labels = re.findall(patt, txt)
                lbls.extend(labels)
typs = []
names = []
for lbl in lbls:
    t, n = lbl.split(':')
    typs.append(t)
    names.append(n)

The output for my project looks like:

app:
    depth_param_est
    param_est
    preprocessing
    water_column

chp:
    BPS
    Depth
    Intro
    OpticalRS
    ParamEst
    Water

sec:
    curve_fit_est
    lin_reg_est

fig:
    bps_fig1
    pd_K_ests
    pe_curve_fit
    pe_dwm_bars
    pe_linear_K_est
    pe_linear_K_est_dr
    pe_location_map
    pe_surf_corr_K
    wcc_depths
    wcc_imgcomp
    wcc_location_map
    wcc_method_comp
    wcc_parallel

tab:
    est_parameters

eq:
    albedo_plus
    geometric_factor
    k_from_slope
    linregress
    lyz_model_sag
    lyz_model_transformed
    lyz_shallow_water
    lyz_transform
    mar_sag_comp
    mar_wcc
    maritorena9a
    maritorena_albedo_subsurf
    maritorena_model
    maritorena_toa
    refraction
    sag_index_radiance
    sag_ref_index
    surf_correction
    surf_ref
    toa_refletance
    toar_deep

I had the same problem. I solved it with just a few code lines using the tocloft package. In my opinion the advantage over other solutions is the easy use (put it in an separate file or package and comment it in or out), it is easy to understand and it is easy to adapt to your own needs or to dublicate for other lists (i.e. citations, collect section names, counting your footnotes, ...).

\documentclass{article}
\usepackage{tocloft}

% create a new list incl. counter
\newlistof{labelTagCounter}{labelTags}{List of \textbackslash labeltags}

% redefine the  label command
\let\myLabel\label
\renewcommand{\label}[1]{
\refstepcounter{labelTagCounter}% step the counter
\addcontentsline{labelTags}{labelTagCounter}{\thelabelTagCounter:\quad#1}% add item to list
\myLabel{#1}% now execute the original label command
 }

\AtEndDocument{
\cleardoublepage
\listoflabelTagCounter% print the list
}

\begin{document}
Lorem ipsum dolor\label{labelA} sit amet, consetetur sadipscing elitr\label{labelB},  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam\label{labelC} erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidun\label{labelA}t ut labore et dolore magna aliquyam erat, sed diam voluptua\label{labelD}. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,  sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat\label{labelC}, sed diam voluptua. At vero eos et accusam et justo duo\label{labelC} dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\newpage
Duis autem vel eum iriure dolor in\label{labelE} hendrerit in vulputate velit esse molestie consequat, vel illum\label{labelA} dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue\label{labelC} duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
\end{document}