New answers tagged

5

You should be really using cleveref features. However, this works. \documentclass{article} \usepackage{hyperref} \AtBeginDocument{% \NewCommandCopy{\originalref}{\ref}% \renewcommand{\ref}[1]{@\originalref{#1}@}% } \begin{document} \section{Test}\label{test} Section \ref{test} \end{document} You need a recent LaTeX kernel (2020-10-01 or later). If ...


1

You'll have to set \@currentlabel manually. If you're using hyperref as well, then an additional \phantomsection should provide the correct hypertarget. \documentclass{article} \usepackage{caption,graphicx} \usepackage{hyperref} \makeatletter \newcommand{\setrefnumber}{\phantomsection\renewcommand{\@currentlabel}}% \makeatother \begin{document} \begin{...


1

If you wish to use more or less the same "skeleton"/framework both for A.tex and for B.tex, then the package docstrip might be your friend: The package docstrip provides the possibility to place tags into a .tex-source-file that begin with % and therefore usually look like comments, and to apply docstrip.tex for reading that .tex-source-file and by ...


3

The following is a basic implementation that sets problems using the description environment while you can set a specific "named \label" to these items that are correctly hyperlinked. \documentclass{article} \usepackage{hyperref} \makeatletter \newcommand{\namelabel}[1]{% \phantomsection \renewcommand{\@currentlabel}{#1}% Update the label ...


2

The package zref might be your friend: By means of zref you can implement your own \label-\ref-like cross-referencing-mechanisms, e.g., for retrieving and storing sentences. By means of zref's module xr you can retrieve zref-cross-referencing-labels from other .tex-documents as long as the .aux-files of these documents are available. I suggest using zref-...


2

Change \renewcommand\thesubscheme{\thescheme\alph{subscheme}} to \renewcommand\thesubscheme{\alph{subscheme}} \renewcommand\p@subscheme{\thescheme} Full example \documentclass[oneside,11pt]{book} %\usepackage[semibold,tt=false]{libertine} %\usepackage{libertinust1math} \usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption} \usepackage[...


2

The way closest to what you asked for I can think of would be to concatenate the bold text to a single macro - which will only help you if you want to include A.tex and B.tex in the same project. Note that this will not create a file B.tex in which all the bold text is written down, but you can use the macro \myBoldText at any point of the document in order ...


4

Create a file textref.sty with the following contents: \newcommand\save[2]{% \@bsphack\protected@write\@auxout{}{\string\newtext{#1}{#2}}\@esphack \newtext{#1}{#2}% } \newcommand\newtext[2]{\global\@namedef{text:#1}{#2}} \newcommand\recall[1]{% \ifcsname text:#1\endcsname \@nameuse{text:#1}% \else \textbf{??? Unknown Text ???}% \fi } \...


1

You can do something like this: {\def\hbox#1{}\def\protect#1\empty{??}\xdef\reftext{\ref{key}\empty}} \convertdigits{\reftext}


1

Here's a proof of concept. \documentclass{article} \usepackage{amsthm} \ExplSyntaxOn \NewDocumentCommand{\theoremstatement}{m m} {% #1 = label, #2 = theorem type \use:e { \exp_not:N \begin{#2} \prop_item:Nn \g_student_theorems_statements_prop { #1 } \exp_not:N \end{#2} } \prop_gput:Nnx \g_student_theorems_numbers_prop { #1 } { \...


1

I don't think it's good, but… Why not? Because the purpose of the top level \label is to refer to the global number and the subequations are there for the reader to see. \documentclass{article} \usepackage{amsmath} %\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later \ExplSyntaxOn \AddToHook{env/subequations/begin} { \cs_set_eq:NN \label \...


1

I guess, the problematic tables are inside of an unnumbered \section and you placed the \label before the \caption command. Please compare the output of the two different sections in the following example. The first table is correct and get referenced correctly, the second table contains \caption and \label in the wrong order, thus resulting in the warning &...


1

The cleveref package offers a low-level macro called \crefrangelabelformat, but it doesn't offer a macro called \crefpairlabelformat. Hence, as you've discovered, \cref{eqn:1a,eqn:1b} uses the simple conjunction "and". Short of contacting the author and maintainer of the cleveref package and asking him to create a macro called \crefpairlabelformat ...


3

The package hyperref should be loaded last: only a few packages have to be loaded after it and none of those in the MWE. However, this doesn't solve the issue. The problem is a race condition: with equation the associated counter is stepped and then reset at its previous value if \tag is scanned before \end{equation}, but it's too late and hyperref has ...


1

Here is an implementation of \sidebysidesubequations that could work: \documentclass{article} \usepackage{amsmath} \usepackage{hyperref} \makeatletter \newcommand{\sidebysidesubequations}[6]{% % #1 reference label % #2 left subequation % #3 left label % #4 midtext % #5 right subequation % #6 right label % \begin{...


2

You could \kern it to the left. \documentclass{article} \usepackage{hyperref} \renewcommand{\sectionautorefname}{\S\kern-4pt} \begin{document} \section{section} \label{section} \autoref{section} \end{document} Perhaps a better way is to gobble the space: \makeatletter \renewcommand{\sectionautorefname}{\S\@gobble} \makeatother though I don't know if this ...


0

In your comments you mentioned that you're using the definitions from http://tex.stackexchange.com/a/69832, which has: \newcommand*{\myexternaldocument}[1]{% \externaldocument{#1}% \addFileDependency{#1.tex}% \addFileDependency{#1.aux}% } But this definition accepts only one argument: there's no way to pass another optional argument along to \...


1

The problem her is that the figure env it self does not provide anything the label can refer to. It is the \caption command that provides a figure number that the \label can refer to. Here is an example: \begin{filecontents}[overwrite]{sub-\jobname.tex} \begin{figure} \rule{4cm}{4cm} \caption{test} \label{fig:my_figure} \end{figure} Look at figure \ref{...


2

You should use \refstepcounter instead of \stepcounter for this. The former does the same as the latter, except it also associate subsequent \label statements with the value of the counter being incremented.


1

A couple thoughts: If you can use biber/BibLaTeX I think that the hard-coded pool size limit doesn't apply. There is a BibLaTeX apa style that may do the trick. Depending on your platform, there may be a bibtex8 program which has command line options to increase the capacity. You could do bibtex8 --big or --huge or --wolfgang depending on your needs. It's ...


1

Add a \label just after \begin{subequations}, but before the align. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{subequations}\label{equ: problem1} \begin{align} & \min_{x} X \label{equ: problem1-a}, \\ \textit{subject to:} & \nonumber \\ & x_i \in \{0,1\} \forall {i \in V} ...


2

You can (locally) redefine \thefigure. It's possible to use two “tagged” captions in the same figure environment, but not a normal and a tagged one. \documentclass{article} \newcommand{\figuretag}[1]{% \addtocounter{figure}{-1}% \renewcommand{\thefigure}{#1}% } \begin{document} Normal figures \ref{normal1} and \ref{normal2}; tagged figure~\ref{tagged}....


4

You should have provided full MWE. However, here is the solution: \documentclass{article} \usepackage[labelformat=simple]{subcaption} % packages subfigure and subfig are obsolete \renewcommand\thesubtable{(\alph{subtable})} \makeatletter \renewcommand\p@subtable{\thetable.} \makeatother \begin{document} \ref{tab:week2} \begin{table}[h] \begin{subtable}[...


0

In the text of your question you use the environment array to create a table. But the environment array is used to create matrices in math mode. I recommend not to misuse the environment array for creating tables but to use the tabular environment for creating tables. By means of the package zref you can easily introduce your own cross-referencing system ...


1

The styles of the biblatex-ext bundle (disclaimer: I'm the author) come with an option called citexref that does pretty much that. In this example I chose an author-year base style instead of an author-title style, because you used author-year in your example. \documentclass[ngerman]{article} \usepackage{babel} \usepackage{csquotes} \usepackage[backend=...


1

The issue here is that you are compressing the references by default, but for the chapter references you don't want to do that compression. The solution is to insert an extra comma between (in this case) the last two of your references; this will turn off the compression for that reference list. For a fuller description see §5 of the documentation. If you ...


Top 50 recent answers are included