Re: Does such a package exist...?
- From: palegreenhorse <palegreenhorse@xxxxxxxxx>
- Date: Thu, 19 Jul 2007 00:24:16 -0000
On Jul 17, 10:42 am, jmp6...@xxxxxxxxxxx wrote:
Surely someone long before me would have wanted the functionality
described below (an extension of cross-referencing) and written a
suitable package. If an experienced user could direct me in the right
direction I would be very grateful.
I am a chemist, currently writing a report which contains a number of
figures. Some, but not all, of these figures contain drawings of
chemical compounds. In the output would like to place a number
underneath these compound figures, thus labelling every compound from
1 to however many different compounds I include (about 20). Of course
I could do this manually, but what if I decide to insert a new
compound halfway along? I would have to re-name all the following
compounds, and we're back to the dark ages of Microsoft Word.
As with cross-referencing, I imagine giving each number a name of my
choice and referring to that name from somewhere in the text. The
functionality is virtually identical to labelling figures. However, I
want the output to simply produce the compound number in the text.
So, for example, under the fifteenth compound figure I would write
something like:
\numlabel{phosphoric acid}.
And in the the text I would write:
... and then I made compound~numref{phosphoric acid} by mixing ...
The output would look like:
... and then I made compound 15 by mixing ...
I would also like to position the number label with accuracy. Not just
vaguely underneath the figure, but exactly where I want it
horizontally. (Perhaps this is asking a bit much and I could live
without it.)
In other words, I am simply looking for a named list of numbers to
place wherever I like. Surely something like this must already exist!
When I needed similar things to happen (although I didn't position
each one individually I just centered under the molecule) I used a
combination of float, caption, subfig, and prettyref packages. (If
you are using the hyperref package define your new floats after
loading hyperref.) And after pasting what is below in I realize it
probably is hard to read. If you think it could be useful to you but
can't make heads or tails of it let me know and I'll try to clarify.
\usepackage{float}
\usepackage[textfont={small},labelsep=period,labelfont={small,bf}]
{caption} %change the default caption format
\usepackage{subfig}
\usepackage{prettyref} %allows auto format of a reference call ie auto
inserts Figure or Scheme and then the number
\newcounter{mol}[chapter] \renewcommand\themol{\thechapter.
\arabic{mol}}%define a counter to auto-number the molecules
\floatstyle{plain}\newfloat{Scheme}{t}{los}[chapter] %generates a new
type of float, Scheme, indexes in document.tos, tries to place at top
of page and has numbering of chapter number.scheme order in chapter
\newsubfloat{Scheme} %for when individual molecules in a scheme are to
be labled with a number
\newrefformat{sch}{Scheme~\ref{#1}}%formats references to schemes to
show up ast Scheme #
\newrefformat{mol}{\textbf{\ref{#1}}}%formats references to molecules
to show up as the boldface number assigned to that molecule
is all in my preamble
then when i actually want to have just a molecule or two on the page i
use
\begin{figure}[hbt]
\captionsetup[subfloat]{labelformat=empty,justification=Centering}
%this figure has no caption or number but center the whole thing
\centering
\subfloat[][\refstepcounter{mol}\textbf{\themol}\label{mol:jahc003}]
%put one molecule on the left with a number labeling it
{\includegraphics[scale=.68]{jahc003}}%the actual graphic of the
molecule
\qquad%some space between
\subfloat[][\refstepcounter{mol}\textbf{\themol}\label{mol:jahc017}]
%put another molecule on the right with the next number labeling it
{\includegraphics[scale=.68]{jahc017}}%the actual graphic of the
next molecule
\end{figure}
now the first time i use a molecule i have to use the
\refstepcounter{mol}\textbf{\themol}\label{mol:mylabel}. so it won't
auto detect the first time you use a molecule. but now i can just
reference \prettyref{mol:jahc003} and it will show up in bold as 1.
you can change how it formats your molecules by adjusting the
reference style defined in the preamble
then when i introduce a new molecule inside a scheme it looks like
this
\begin{Scheme}[htb]
\captionsetup[subfloat]
{labelformat=empty,justification=Centering,singlelinecheck=false}
%don't give the individual items caption enumeration
\centering
\subfloat[][]
{\includegraphics[scale=.68]{PTCD}}%first molecule in the scheme
\subfloat[][]
{\includegraphics[scale=.68]{diethylethyl}}%second molecule and a
reaction arrow
\subfloat[][\prettyref{mol:jahc003}, 99\% yield]%product label, a
molecule introduced above so already has #, and then its yield
{\includegraphics[scale=.68]{jahc003}}%the actual product structure
\\%new line to continue scheme since my molecules were kinda wide
\subfloat[][]
{\includegraphics[scale=.68]{HA}}%second reaction arrow and a
reagent
\subfloat[][\refstepcounter{mol}\textbf{\themol}\label{mol:jahc006}
A=Cl, 99\% yield \newline%a molecule first introduced here so given
the next number in the molecule sequence
\refstepcounter{mol}\textbf{\themol}\label{mol:jahc012} A=4-
methylbenzene sulfonate, 89\% yield]%another new molecule with a
different structure but only in one position so that gets the next new
number
{\includegraphics[scale=.68]{jahc003ha}}%the graphic of the new
molecules thus labeled
\caption{Synthesis of \prettyref{mol:jahc006} and
\prettyref{mol:jahc012}}\label{sch:synthesis1}%the caption for the
entire scheme which references the molecules just assigned numbers in
this scheme
\end{Scheme}
.
- References:
- Does such a package exist...?
- From: jmp6789
- Does such a package exist...?
- Prev by Date: Re: CTAN update: pax v0.1f
- Next by Date: Uploaded TeX
- Previous by thread: Does such a package exist...?
- Next by thread: Font embedding/replacing from external files with pdftex
- Index(es):
Relevant Pages
|