I wrote a command for a document with many figures and tables which belong to each other. Every figure/table has the same caption just one parameter changes and the labels are automatically created. The problem is now, that these labels are not in the label list of TexStudio which would be nice.   \documentclass{article} \usepackage{hyperref}  \DeclareRobustCommand{\captionf}[1]{Parameter of #1\label{fig:Parameter#1} % \global\def \captiont {Description of \autoref{fig:Parameter#1}} }  \begin{document}  \begin{figure}[ht] \centering lalala \caption{\captionf{lalala}} \end{figure}  \begin{table}[ht] \centering \begin{tabular}{cc} la &amp; lu \\ \end{tabular} \caption{\captiont} \end{table}  \end{document}   Does somebody knows a solution to this?
122541
In TeXstudio editor one can easily choose which labels to reference as soon as you type the  cross-referencing-macro you intended to use, for instance, \cref{} of the cleveref package (see image below).     One problem, though, when you use ctable package to create a table, a user-friendly package indeed, you soon discover that you should label the table the way that ctable understands:    ... label=tab:somelabel, ...   Here comes the problem, since labels of tables were marked the way ctable understands, TeXstudio can no more recognize them as normal labels, and you won't find these labels in the drop down menu among other labels made by whatever else method.    This can be of course tolerated when you have a couple of labels, but when you have a lot of them, it turns out to be a tedious task to recall or call out the labels exactly as they are.    I would be grateful if someone would provide a workaround solution for this issue, without sacrificing the use of either ctable package or TeXstudio IDE.  Note: TeXstudio version 2.6.4 ctable version June 14, 2013
95108
I've got a problem using \label and \ref in Texmaker 3.1 (MiKTeX 2.9). When I put label somewhere, i got a frame with label name in it. How can I hide it?  \begin{figure}[h] \includegraphics[width=0.75\textwidth]{img/2}\caption{SomeCaption} \label{fig:4eb1} \end{figure} $\frac{w}{w_1}-1=4$ $4\leqslant n\leqslant3$, using (pic. \ref{fig:4eb1}),blah-blah.   PS: Sorry for my awesome English. :)
100316
I have the following problem. I want to center a listing, I tried this approach:   It works but when I try to set frame or numbers specifically for each listing I get errors. Here´s the M(Not)WE:  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \begin{document}  \begin{figure}[thp]  \begin{tabular}{c}   \begin{lstlisting}[numbers=left] % Here lies the problem without the numbers=left it works    My Code   \end{lstlisting}  \end{tabular}  \centering  \caption{Bla} \end{figure}  \end{document}   Is there another way to center the listings and captions or how could I fix this approach?
32875
I'm facing a problem with my document that has many equations. The problem with the labelling issue if I decide to modify or add new equations. Basically so far, I'm using \label{eq4.1} where 4 for the chapter four and 1 for the first equation. With this approach, if I decide later to add new equations before eq4.1, then I have to change all subsequent equations to reflect this change. I'm looking for a better and flexible approach to cope with this problem.   \documentclass{article} \usepackage{amsmath}  \begin{document}  \begin{align} x &amp;= 2^{100}, \label{eq4.1} \\ y &amp;= 2^{100}, \label{eq4.2} \\ z &amp;= 2^{100}. \label{eq4.3} \end{align}  These are \eqref{eq4.1} and \eqref{eq4.2} and \eqref{eq4.3}.   \end{document}
23230
I'm having an interesting problem with hyperref.  Apparently, when a counter is reset by \setcounter{mycounter}{0} then hyperref always links to the first possible instance of the counter and not the one where the respective label sits.   Check this MWE out:   % !TEX TS-program = xelatexmk \documentclass{article} \usepackage[paperwidth=6in,paperheight=3in]{geometry} \usepackage{hyperref} \hypersetup{colorlinks=true, allcolors=blue, } \newcounter{mycounter}\setcounter{mycounter}{0} \newcommand\countme{\refstepcounter{mycounter}\themycounter}  \begin{document}  First line \countme{} has some interesting text.  The second line \countme \label{onelabel} has \textbf{more} interesting text.  As we saw at line \ref{onelabel} ...  \newpage  A new page brings new numbers \setcounter{mycounter}{0}   A very different first line \countme{} has other interesting text.  The second line \countme \label{otherlabel} has \textbf{different} interesting text.  As we saw at line \ref{otherlabel} ... \end{document}   As you can see in the screenshot below, the pop up preview of the \ref on the second page doesn't refer to the second line with \label{otherlabel} but to the one on the first page (also has the tooltip "Go to page 1" -- in TeXShop).   Am I not understanding something fundamental about hyperref?      The context for all this is an environment that resets my counter to 0 at begin.  And all subsequent \refs to labels in a second or third iteration of the environment point to the very first instance of that environment, not the correct one where the label sits.
115992
I would like to add labels to pages inserted with the pdfpages package. It sort of works right now, but it is not possible to link to the labels with \ref and \pageref commands.  In spite of that not working, it is possible to link to the page with the hyperlink command from hyperref. The goal is to compile a list of things to read in a course and then later say 'read from page xx to yy'.  The pagenumbers should of course be determined automatically. In the document below, the pageref expands to ?? while the text Hello links to the correct page. \documentclass{article} \usepackage{hyperref} \usepackage{pdfpages} \begin{document} See page \pageref{testing.1}. \hyperlink{testing.1}{Hello.} \includepdf[pages=-,link,linkname=testing]{test.pdf} \end{document}  For reference, the inserted document (test.pdf) can be any valid PDF document.
75629
Hi I am new to the forum and fairly new to Tex, if I miss anything out please let me know and I will be glad to post it. I am writing up my PhD thesis using Texmaker on a windows system. I have my document organised with a main file and a sub-directory containing chapter 1 to 5. I want to be able to use the labels I created in chapter two for example in the appendix and vice versa. Is there an easy way to do this?   I have tried following the advice of various posts of including the commands \usepackage{xr} and \externaldocument{Chapters/Chapter_2} in the individual chapters but this leads to an error when compiling.   My Preamble is as follows:  \documentclass[12pt,hidelinks,twoside]{report} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[greek,spanish,english]{babel} \usepackage{textgreek} \usepackage[version=3]{mhchem} \usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry} \usepackage{amsmath, amsfonts, pifont, float, color, url} \usepackage[pdftex]{graphicx} \usepackage[style=numeric,backend=biber,sorting=none]{biblatex} \addbibresource{references.bib} \usepackage[pdftex, plainpages=false, pdfpagelabels, bookmarks=true]{hyperref} \usepackage{fancyhdr} \usepackage[center,font={it,small}]{caption}   I then have a section such as this in the main document:  \begin{document} %%... Title page ... \chapter{Theory and Methods} \label{chap:Theory and Methods} \include{Chapters/chapter_2} %%... Other chapters .... \end{document}   In Chapter 2 I have for example a label for a diagram which I may want to reference in other chapters:  \begin{figure}[H] \centering \includegraphics[height=10cm,width=\textwidth]{RF_colour_hi_res.pdf} \caption{Random Forest} \label{fig:2.1 Random Forest} \end{figure}   How can I have this label show up in other chapters after I type \ref ?  Many thanks in advance.  If any other information is required please let me know.   This has been answered in the comments although the references do not appear in the auto complete if they are copied and pasted in they still work.
19012
I have a problem with the lstlisting package. I want to define an \newenvironment with one obligatory parameter, which will be the caption name for the lstlisting. I will also have other lstlisting environments, that is why I am trying to define them separately.  I am also having some difficulties with \lstinline command (I set up a \newcommand to gain easier coding), which typesets keywords in normal text. Why can't it be in captions and similar?  I suppose something could be wrong with the preamble, that's why all the packages used are listed.  \documentclass{book} \usepackage[a4paper, top=3cm, bottom=3cm, heightrounded, outer=3cm, inner=3cm, marginparwidth=1.5cm, marginparsep=0.5cm]{geometry}  \usepackage{tocloft} \usepackage{amsmath}  \usepackage{eurosym} \usepackage{url} \usepackage{array} \usepackage{tabularx} \usepackage{multirow}  \usepackage{multicol}  \usepackage{graphics} \usepackage[dvips]{graphicx}  \usepackage{epstopdf}  \usepackage[dvipsnames]{xcolor}  \usepackage{verbatim} \usepackage{fancyvrb}  \usepackage{fancyhdr} \usepackage{paralist}  \usepackage{listings}  \usepackage{pifont}  \usepackage{indentfirst}   \lstset{language=[Visual]Basic, % keywordstyle=\color{blue},commentstyle=\color{ForestGreen},stringstyle=\color{Maroon},% basicstyle=\ttfamily\normalsize, frame=lines, % showspaces=false, showstringspaces=false,% tabsize=4, aboveskip=10pt, belowskip=10pt, % lineskip=2pt, numbers=left, numberstyle=\tiny, stepnumber=1, numbersep=5pt,% numberblanklines=false, % breaklines, breakatwhitespace, prebreak=\_, breakindent=0pt % }  \lstset{morekeywords={Or, Loop, Until, To, As, Single, Module, Double, ByVal}}  \lstset{emph={Console}, emphstyle=\color{Aquamarine}}  \newenvironment{case}[1]{\renewcommand\lstlistingname{Case}% \begin{lstlisting}[caption={#1}]}% {\end{lstlisting}}  \newcommand{\code}[1]{\lstinline[basicstyle=\rmfamily\normalsize, prebreak=, keywordstyle=\ttfamily]{#1}}   \begin{document}  Example with inline, that works: \code{Console, Sub in Module}.  \begin{case}{Hello world} %doesn't work Module Module1     Sub Main()         Console.WriteLine("Hello World!")         Console.ReadKey() End Sub End Module \end{case}  \end{document}   Thank you in advance!
92321
is exactly what I'm looking for. I want my description environment to produce this:  Label is long   text  lab2            blalballalaa label3          possible second rule label four      hello world   Someone offered this:  \newenvironment{mydescription}[1]                                                   {\begin{list}{}%    {\renewcommand\makelabel[1]{##1:\hfill}%    \settowidth\labelwidth{\makelabel{#1}}%    \setlength\leftmargin{\labelwidth}    \addtolength\leftmargin{\labelsep}}}   {\end{list}}   Which works great (the parameter is the longest label), except I think the enumitem should be able to do this. Unfortunately, the documentation for it is extremely confusing to me. Could someone show me how to achieve the same result with enumitem?
78548
I am completely noobie in LaTeX. I need to change table name in all captions. But when I write \renewcommand\tablename{newname} at the beginning of document, it doesn't do anything. It's still "Table" My code looks like this:  ... \renewcommand\tablename{new} ... \begin{table}[b] \centering \begin{tabular}{|l|} ... your table ... \end{tabular} \caption{This table shows some data} \end{table} ...   What am I doing wrong?
87654
Problem  I have defined an environment to automatically number example sentences throughout my document. It uses the tabular environment and automatically numbers the first column of each row using a custom counter. I have reasons for not using lists or the theorem counter.  I want to label and reference a table row so that the number associated with the row is displayed. Using \label and \ref does not work. Is there some way to feed a function two args, a key and the current value of my counter, and later use the key to recall the other arg? Or is there another way to do what I want? Not breaking the labels and references for the rest of the document is ideal but not necessary.  (Non-)Working Example  \documentclass{article} \usepackage{array} %don't know why this is needed; get csname error otherwise  % automatically number examples throughout document \newcounter{exno} \newenvironment{examples} { \begin{flushleft} \begin{tabular}{&gt;{(\stepcounter{exno}\theexno)}rl} } { \end{tabular} \end{flushleft} }  \begin{document}  \section{Foo} Here are some numbered example sentences. \begin{examples}   &amp;Content of row 1 \label{row1} \\   &amp;Content of row 2 \label{row2} \end{examples} Now I want to get a 1 here: \ref{row1}. I want to get a 2 here: \ref{row2}.  \end{document}
93009
TeXstudio does a pretty good job with autocompletion. For example, when I type \eqref{, it already comes with suggestions, see the example below.    However, suppose that I don't want to use \eqref but a customized command using newcommand (I do this so that I can quickly switch to different styles, e.g., some for journals/conferences "Eq. (1)" is needed, whereas sometimes "(1)" suffices). In this case, TeXstudio does not do the auto-completion, see the example below.    Is it possible to configure TeXstudio such that it does the auto-completion for custom commands that require a reference?  Note that one option is to redefine \eqref using \renewcommand, but I'm looking for another way so that I can use if for many more commands, not just for \eqref.   Here is my MWE:  \documentclass{article} \usepackage{amsmath}  \newcommand{\alternative}[1]{Eq.~(\ref{#1})}  \begin{document}     \begin{equation}         \label{eq:emc2}         E = mc^2     \end{equation}     I can refer to the equation using \eqref{eq:emc2} and using \alternative{eq:emc2}. \end{document}
116258
In addition to tables and figures, I have a bunch of code pieces. Just like follows:      \begin{figure}     \lstinputlisting[     language=C++, breaklines=true,     keywordstyle=\color{blue},     commentstyle=\color{mygreen},     stringstyle=\color{red},     frame=single,     backgroundcolor=\color{gray},     basicstyle=\footnotesize\ttfamily,     caption={Data acquisition code},     label={code:data}]     {codes/data.cpp} \end{figure}   Those codes do not appear in table of figures or table of contents which is exactly what I want.  Now I want to create a new table of codes \listofcodes similar to \listoffigures. It should create a third table. How do I do that?
58815
I want to do something similar to what is done in  paper:    In particular I'm interested in:   Same amount of images per row Using a vertical label to categorize each row Adding a caption Wrapping the image (so there can be text on one side)   I've read some questions ( and ) but they are very different from what I want, can you help me?  I've tried this, but I'm getting errors:  \usepackage{subcaption} % for subfigures  \begin{table}[ht] \begin{tabular}{ccc} \begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/all_souls_000021.jpg}&amp; \begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/all_souls_000091.jpg}&amp; \begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/oxford_000177.jpg}\\ \end{tabular} \caption{A table with figures} \label{tab:mytable} \end{table}   Error:  ! Missing } inserted.&lt;inserted text&gt;} ...olumnwidth]{Figures/all_souls_000021.jpg}&amp;
13525
I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:  \documentclass{article}  \usepackage{hyperref} \usepackage{cleveref}  \newtheorem{theorem}{Theorem}  \begin{document}  \section{Section 1} \begin{theorem}\label{some label}     This is a theorem. \end{theorem}  \section{Proof to \Cref{some label}}  \end{document}   And here's the pdf:   Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?
111705
--- update ---  Any comments, is this a bug in the caption package or do have have to protect \refstepcounter somehow?  --- \update ---  I have the following MWE:  \documentclass{book}  \usepackage{xparse} %\usepackage{caption}  \newcounter{mycounter} % make a counter \setcounter{mycounter}{0} % init the counter  \NewDocumentCommand \mymark {} {% \refstepcounter{mycounter}% \textsuperscript{\themycounter}}  \begin{document} % one\mymark  \begin{figure} \caption{two\mymark} \label{lab:1} \end{figure}%  three\mymark  \end{document}   without caption package it produces    but if I add the package    Why is the numbering incorrect?
41602
I frequently create labels that follow the same format: white text on a 75% opaque black background, with 10px of margin around the text. Currently, I have to manually build these labels, which takes a lot of work.  In one method, I write the text, figure out its height and width, then create a separate rectangle and place it behind it. This takes a lot of clicking around for every label.  In the other method, I draw out a text box, select it directly, give it the correct background and margins, and then insert the text. However, I must then resize the box manually, meaning more clicking around and greater imprecision. There doesn't seem to be a way to directly select a text box once it has text inside it.  I tried using the script contained in  to resize the text box to the content, but it only resizes the box vertically, and removes my color and margins.  Does anyone have suggestions on how to resolve these problems, or for a better method? I'm using CS3.