w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

xref.c
Go to the documentation of this file.
1 /* xref.c - commands for LaTeX cross references
2 
3 Copyright (C) 2001-2002 The Free Software Foundation
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 This file is available from http://sourceforge.net/projects/latex2rtf/
20 
21 Authors:
22  2001-2002 Scott Prahl
23 */
24 
25 #include <stdlib.h>
26 #include <string.h>
27 #include "main.h"
28 #include "util.h"
29 #include "convert.h"
30 #include "funct1.h"
31 #include "commands.h"
32 #include "cfg.h"
33 #include "xref.h"
34 #include "parser.h"
35 #include "preamble.h"
36 #include "lengths.h"
37 #include "l2r_fonts.h"
38 
44 
45 #define MAX_LABELS 200
46 #define MAX_CITATIONS 1000
47 
50 
52 static int g_last_citation=0;
53 static int g_current_cite_type = 0;
54 static int g_current_cite_seen = 0;
55 static int g_current_cite_paren = 0;
56 static char g_last_author_cited[101];
58 static int g_current_cite_item=0;
59 
61 {
63 }
64 
65 static int citation_used(char *citation)
66 /*
67 return 1 if citation used otherwise return 0 and add citation to list
68 */
69 {
70  int i;
71 
72  for (i=0; i<g_last_citation; i++) {
73  if (strcmp(citation,g_all_citations[i])==0) return 1;
74  }
75 
77  diagnostics(WARNING__,"Too many citations ... increase MAX_CITATIONS");
78  } else {
81  }
82 
83  return 0;
84 }
85 
86 static char *
87 ScanAux(char *token, char * reference, int code)
88 /*************************************************************************
89 purpose: obtains a reference from .aux file
90 
91 code=0 means \token{reference}{number} -> "number"
92 code=1 means \token{reference}{{sect}{line}} -> "sect"
93  ************************************************************************/
94 {
95  static FILE *fAux = NULL;
96  char AuxLine[2048];
97  char target[512];
98  char *s,*t;
99  int braces;
100 
101  if (g_aux_file_missing || strlen(token) == 0) {
102  return NULL;
103  }
104 
105  diagnostics(4,"seeking in .aux for <%s>",reference);
106 
107  snprintf(target, 512, "\\%s{%s}", token, reference);
108 
109  if (fAux == NULL && (fAux = my_fopen(g_aux_name, "r")) == NULL) {
110  diagnostics(WARNING__, "No .aux file. Run LaTeX to create %s\n", g_aux_name);
112  return NULL;
113  }
114 
115  rewind(fAux);
116 
117  while (fgets(AuxLine, 2047, fAux) != NULL) {
118 
119  s = strstr(AuxLine, target);
120  if (s) {
121 
122  s += strlen(target); /* move to \token{reference}{ */
123  if (code==1) s++; /* move to \token{reference}{{ */
124 
125  t = s;
126  braces = 1;
127  while ( braces >= 1) { /* skip matched braces */
128  t++;
129  if (*t == '{') braces++;
130  if (*t == '}') braces--;
131  if (*t == '\0') return NULL;
132  }
133 
134  *t = '\0';
135  diagnostics(4,"found <%s>",s+1);
136  return strdup(s+1);
137  }
138  }
139  return NULL;
140 }
141 
142 void
144 /******************************************************************************
145  purpose: converts footnotes from LaTeX to Rtf
146  params : code specifies whether it is a footnote or a thanks-mark
147  ******************************************************************************/
148 {
149  char *number, *text;
150  static int thankno = 1;
151  int text_ref_upsize, foot_ref_upsize;
152  int DefFont = DefaultFontFamily();
153 
154  diagnostics(4,"Entering ConvertFootNote");
155  number = getBracketParam(); /* ignored by automatic footnumber generation */
156  text = getBraceParam();
157 
158  if (number) free(number);
159  text_ref_upsize = (int) (0.8 * CurrentFontSize());
160  foot_ref_upsize = (int) (0.8 * CurrentFontSize());
161 
162  switch (code) {
163  case FOOTNOTE_THANKS:
164  thankno++;
165  fprintRTF("{\\up%d %d}\n", text_ref_upsize, thankno);
166  fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont);
167  fprintRTF("\\fs%d {\\up%d %d}", CurrentFontSize(), foot_ref_upsize, thankno);
168  break;
169 
170  case FOOTNOTE:
171  fprintRTF("{\\up%d\\chftn}\n", text_ref_upsize);
172  fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont);
173  fprintRTF("\\fs%d {\\up%d\\chftn}", CurrentFontSize(), foot_ref_upsize);
174  break;
175 
176  case FOOTNOTE_TEXT:
177  fprintRTF("{\\*\\footnote \\pard\\plain\\s246\\f%d",DefFont);
178  fprintRTF("\\fs%d ", CurrentFontSize());
179  break;
180  }
181 
183  fprintRTF("}\n ");
184  diagnostics(4,"Exiting CmdFootNote");
185  free(text);
186 }
187 
188 void
190 /******************************************************************************
191  purpose: handle the \nocite{tag}
192  ******************************************************************************/
193 {
194  free(getBraceParam()); /* just skip the parameter */
195 }
196 
197 void
199 {
200  char * s = getBraceParam(); /*throw away widest_label */
201  free(s);
202 }
203 
204 void
206 {
207  int err;
208  char *s;
209 
210  s = getBraceParam(); /*throw away bibliography name */
211  free(s);
212 
214 
215  if (!err) {
216  diagnostics(4, "CmdBibliography ... begin Convert()");
217  Convert();
218  diagnostics(4, "CmdBibliography ... done Convert()");
219  PopSource();
220  } else
221  diagnostics(WARNING__, "Cannot open bibliography file. Create %s using BibTeX", g_bbl_name);
222 }
223 
224 void
226 {
227  int amount = 450;
228 
229  if (code & ON) {
230  char * s = getBraceParam(); /*throw away widest_label */
231  free(s);
232 
233  CmdEndParagraph(0);
236 
237  fprintRTF("{\\plain\\b\\fs32 ");
239  ConvertBabelName("REFNAME");
240  else
241  ConvertBabelName("BIBNAME");
242  fprintRTF("}");
243  CmdEndParagraph(0);
245 
247  setLength("parindent", -amount);
248  g_left_margin_indent += 2*amount;
249  } else {
250  CmdEndParagraph(0);
252  PopEnvironment();
254  }
255 }
256 
257 void
259 {
260  char *label, *key, *signet, *s, c;
261 
263  CmdEndParagraph(0);
265 
267  key = getBraceParam();
268  signet = strdup_nobadchars(key);
269  s=ScanAux("bibcite", key, 0);
270 
271  if (label && !s) { /* happens when file needs to be latex'ed again */
272  diagnostics(WARNING__,"file needs to be latexed again for references");
273  fprintRTF("[");
275  fprintRTF("]");
276  } else {
277  diagnostics(4,"CmdBibitem <%s>",s);
279  fprintRTF("[");
280  fprintRTF("{\\v\\*\\bkmkstart BIB_%s}",signet);
281  ConvertString(s);
282  fprintRTF("{\\*\\bkmkend BIB_%s}",signet);
283  fprintRTF("]");
284  fprintRTF("\\tab ");
285  }
286  /* else emit nothing for APALIKE */
287  }
288 
289  if (s) free(s);
290  if (label) free(label);
291  free(signet);
292  free(key);
293 
294  c=getNonBlank();
295  ungetTexChar(c);
296 }
297 
298 void
300 {
301  /* if openbib chosen then start a paragraph with 1.5em indent
302  otherwise do nothing */
303 }
304 
305 void
307 /******************************************************************************
308 purpose: convert \index{classe!article@\textit{article}!section}
309  to {\xe\v "classe:{\i article}:section"}
310 ******************************************************************************/
311 {
312  char cThis, *text, *r, *s, *t;
313 
314  cThis = getNonBlank();
315  text = getDelimitedText('{', '}', TRUE);
316  diagnostics(4, "CmdIndex \\index{%s}", text);
317  fprintRTF("{\\xe{\\v ");
318 
319  t = text;
320  while (t) {
321  s = t;
322  t = strchr(s,'!');
323  if (t) *t = '\0';
324  r = strchr(s,'@');
325  if (r) s=r+1;
326  ConvertString(s);
327 /* while (*s && *s != '@') putRtfChar(*s++);*/
328  if (t) {
329  fprintRTF("\\:");
330  t++;
331  }
332  }
333 
334  fprintRTF("}}");
335  diagnostics(4, "leaving CmdIndex");
336  free(text);
337 }
338 
339 void
341 {
342  CmdEndParagraph(0);
343  fprintRTF("\\page ");
344  fprintRTF("{\\field{\\*\\fldinst{INDEX \\\\c 2}}{\\fldrslt{}}}");
345 }
346 
347 static int
349 {
350  int i;
351  if (!s) return FALSE;
352  for (i=0; i<=g_label_list_number; i++) {
353  if (strcmp(s,g_label_list[i])==0)
354  return TRUE;
355  }
356  return FALSE;
357 }
358 
359 static void
361 {
362  if (!s) return;
364  diagnostics(WARNING__, "Too many labels...some cross-references will fail");
365  else {
368  }
369 }
370 
371 void
372 InsertBookmark(char *name, char *text)
373 {
374  char *signet;
375  if (!name) {
376  fprintRTF("%s",text);
377  return;
378  }
379 
380  signet = strdup_nobadchars(name);
381 
382  if (ExistsBookmark(signet)) {
383  diagnostics(3,"bookmark %s already exists",signet);
384 
385  } else {
386  diagnostics(3,"bookmark %s being inserted around <%s>",signet,text);
387  RecordBookmark(signet);
388  if (g_fields_use_REF)
389  fprintRTF("{\\*\\bkmkstart BM%s}",signet);
390  fprintRTF("%s",text);
391  if (g_fields_use_REF)
392  fprintRTF("{\\*\\bkmkend BM%s}",signet);
393  }
394 
395  free(signet);
396 }
397 
398 void CmdLabel(int code)
399 /******************************************************************************
400 purpose: handles \label \ref \pageref \cite
401 ******************************************************************************/
402 {
403  char *text, *signet, *s;
404  char *option = NULL;
405  int mode=GetTexMode();
406 
408  text = getBraceParam();
409  if (strlen(text)==0) {
410  free(text);
411  return;
412  }
413 
414  switch (code) {
415  case LABEL_LABEL:
417  if (mode == MODE_DISPLAYMATH) {
419  diagnostics(3,"equation label is <%s>",text);
420  } else
421  InsertBookmark(text,"");
422  break;
423 
424  case LABEL_HYPERREF:
425  case LABEL_REF:
426  signet = strdup_nobadchars(text);
427  s = ScanAux("newlabel", text, 1);
428  if (g_fields_use_REF) {
429  fprintRTF("{\\field{\\*\\fldinst{\\lang1024 REF BM%s \\\\* MERGEFORMAT }}",signet);
430  fprintRTF("{\\fldrslt{");
431  }
432  if (s)
433  ConvertString(s);
434  else
435  fprintRTF("?");
436  if (g_fields_use_REF) fprintRTF("}}}");
437 
438  free(signet);
439  if (s) free(s);
440  break;
441 
442  case LABEL_HYPERPAGEREF:
443  case LABEL_PAGEREF:
444  signet = strdup_nobadchars(text);
445  if (g_fields_use_REF) {
446  fprintRTF("{\\field{\\*\\fldinst{\\lang1024 PAGEREF BM%s \\\\* MERGEFORMAT }}",signet);
447  fprintRTF("{\\fldrslt{");
448  }
449  fprintRTF("%s",signet);
450  if (g_fields_use_REF) fprintRTF("}}}");
451  free(signet);
452  break;
453  }
454 
455  free(text);
456  if (option) free(option);
457 }
458 
459 static char * popCommaName(char *s)
460 /* given s="name1,name2,name3" returns "name2,name3" and makes s="name1"
461  no memory is allocated, commas are replaced by '\0' */
462 {
463  char *t;
464  if (s==NULL || *s=='\0') return NULL;
465 
466  t = strchr(s, ',');
467  if (!t) return NULL;
468 
469  *t = '\0'; /* replace ',' with '\0' */
470  return t+1; /* next string starts after ',' */
471 }
472 
473 static char *
475 /******************************************************************************
476  purpose: return bracketed parameter
477 
478  \item<1> ---> "1" \item<> ---> "" \item the ---> NULL
479  ^ ^ ^
480  \item <1> ---> "1" \item <> ---> "" \item the ---> NULL
481  ^ ^ ^
482  ******************************************************************************/
483 {
484  char c, *text;
485 
486  c = getNonBlank();
487 
488  if (c == '<') {
489  text = getDelimitedText('<','>',TRUE);
490  diagnostics(5, "getAngleParam [%s]", text);
491 
492  } else {
493  ungetTexChar(c);
494  text = NULL;
495  diagnostics(5, "getAngleParam []");
496  }
497 
498  return text;
499 }
500 
501 static int isEmptyName(char *s)
502 {
503  if (s==NULL) return 1;
504  if (s[0]=='\0') return 1;
505  if (s[0]=='{' && s[1]=='}') return 1;
506  return 0;
507 }
508 
509 static void ConvertNatbib(char *s, int code, char *pre, char *post)
510 {
511  char *n, *year, *abbv, *full, *v;
512  PushSource(NULL,s);
513  n=getBraceParam();
515  abbv=getBraceParam();
516  full=getBraceParam();
517  PopSource();
518  diagnostics(5,"natbib [%s] <%s> <%s> <%s> <%s>",pre,n,year,abbv,full);
519  switch (code) {
520  case CITE_CITE:
521  case CITE_T:
522  case CITE_T_STAR:
523  v=abbv;
525  if (!isEmptyName(full)) v = full;
526  if (CITE_T_STAR==code)
527  if (!isEmptyName(full)) v = full;
529  if (!isEmptyName(full)) v = full;
530 
531  ConvertString(v);
532 
533  fprintRTF(" (");
535  if (pre){ fprintRTF(", "); ConvertString(pre); }
536  if (post) { fprintRTF(", "); ConvertString(post); }
537  fprintRTF(")");
538  break;
539 
540  case CITE_P:
541  case CITE_P_STAR:
542  v=abbv;
544  if (!isEmptyName(full)) v = full;
545  if (CITE_P_STAR==code)
546  if (!isEmptyName(full)) v = full;
547 
548  if (pre && g_current_cite_item==1){ ConvertString(pre); fprintRTF(" "); }
549 
550  if (strcmp(v,g_last_author_cited)!=0) { /*suppress repeated names */
551  ConvertString(v);
553  }
554  fprintRTF(", ");
556  if (post && *post !='\0') {
557  fprintRTF(", ");
559  fprintRTF(" ");
560  }
561  break;
562 
563  case CITE_AUTHOR:
564  case CITE_AUTHOR_STAR:
565  v=abbv;
567  v = full;
568  if (CITE_AUTHOR_STAR==code)
569  v = full;
570  ConvertString(v);
571  break;
572 
573  case CITE_YEAR:
574  case CITE_YEAR_P:
575  if (pre){ ConvertString(pre); fprintRTF(" "); }
577  if (post) { fprintRTF(", "); ConvertString(post); }
578  break;
579  }
580  free(n);
581  free(year);
582  free(abbv);
583  free(full);
584 }
585 
586 void CmdCite(int code)
587 /******************************************************************************
588 purpose: handles \cite
589 ******************************************************************************/
590 {
591  char punct[4]="[],";
592  char *text, *str1;
593  char *keys, *key, *next_keys;
594  char *option = NULL;
595  char *pretext = NULL;
596 
597  /* Setup punctuation and read options before citation */
599  *g_last_author_cited='\0';
600 
603  }
604 
606  strcpy(punct,"();");
608  }
609 
611  strcpy(punct,"();");
613  }
614 
616  pretext = getBracketParam();
618  strcpy(punct,"();");
619  if (code!=CITE_P && code!=CITE_P_STAR &&
622  }
623 
625  pretext = getAngleParam();
627  strcpy(punct,"();");
631  }
632 
633  text = getBraceParam();
635  free(text);
636  text=str1;
637 
638  if (strlen(text)==0) {
639  free(text);
640  if (pretext) free(pretext);
641  if (option) free(option);
642  return;
643  }
644 
645  /* output text before citation */
647  fprintRTF("\n%c", punct[0]);
648 
649  if (pretext && g_document_bibstyle == BIBSTYLE_APACITE ) {
650  ConvertString(pretext);
651  fprintRTF(" ");
652  }
653 
654  /* now start processing keys */
656  free(text);
657  key = keys;
658  next_keys = popCommaName(key);
659 
661  while (key) {
662  char *s, *t;
664 
665  s = ScanAux("bibcite", key, 0); /* look up bibliographic reference */
666 
667  if (g_document_bibstyle == BIBSTYLE_APALIKE) { /* can't use Word refs for APALIKE or APACITE*/
668  t = s ? s : key;
669  ConvertString(t);
670  }
671 
673  t = s ? s : key;
674  if (code==CITE_SHORT)
676  ConvertString(t);
677  if (code==CITE_SHORT)
679  }
680 
681  if (g_document_bibstyle == BIBSTYLE_APACITE) { /* */
682  t = s ? s : key;
684  ConvertString(t);
685  }
686 
688  diagnostics(2,"natbib key=[%s] <%s>",key, s);
689  if (s) {
691  ConvertNatbib(s,code,pretext,option);
692  } else
694  }
695 
696  if (g_document_bibstyle == BIBSTYLE_STANDARD) { /* */
697  char *signet = strdup_nobadchars(key);
698  t = s ? s : signet; /* if .aux is missing or incomplete use original citation */
699  if (g_fields_use_REF) {
700  fprintRTF("{\\field{\\*\\fldinst{\\lang1024 REF BIB_%s \\\\* MERGEFORMAT }}",signet);
701  fprintRTF("{\\fldrslt{");
702  }
703  ConvertString(t);
704  if (g_fields_use_REF) fprintRTF("}}}");
705  if (signet) free(signet);
706  }
707 
708  if (next_keys) fprintRTF("%c ",punct[2]); /* punctuation between citations */
709  key=next_keys;
710  next_keys=popCommaName(key); /* key modified to be a single key */
711  if (s) free(s);
712  }
713 
714  /* final text after citation */
716  fprintRTF(", ");
718  }
719 
720  if (g_current_cite_paren) fprintRTF("\n%c", punct[1]);
721 
722  if (keys) free(keys);
723  if (option) free(option);
724  if (pretext) free(pretext);
725 }
726 
727 void
729 /******************************************************************************
730 purpose: handles \htmladdnormallink{text}{link}
731 ******************************************************************************/
732 {
733  char * text, *ref, *s;
734 
735  if (code == LABEL_HTMLADDNORMALREF) {
736  text = getBraceParam();
737  ref = getBraceParam();
738 
739  while ((s = strstr(text,"\\~{}")) != NULL) {
740  *s = '~';
741  strcpy(s+1,s+4);
742  }
743  while ((s = strstr(ref,"\\~{}")) != NULL) {
744  *s = '~';
745  strcpy(s+1,s+4);
746  }
747 
748  fprintRTF("{\\field{\\*\\fldinst{ HYPERLINK \"%s\" }{{}}}",ref);
749  fprintRTF("{\\fldrslt{\\ul %s}}}", text);
750  free(text);
751  free(ref);
752  } else if (code == LABEL_HTMLREF) {
753  text = getBraceParam();
754  ref = getBraceParam();
756  free(text);
757  free(ref);
758  }
759 }
760 
761 void
763 {
764  char *s, *t, *v, *year;
765 
766  diagnostics(4,"Entering CmdBCAY", s);
767 
768  s = getBraceParam();
769  t = getBraceParam();
770  year = getBraceParam();
771  v = g_current_cite_seen ? t : s;
772 
773  diagnostics(4,"s = <%s>", s);
774  diagnostics(4,"t = <%s>", t);
775  diagnostics(4,"year = <%s>", year);
776  diagnostics(4,"type = %d, seen = %d, item= %d",g_current_cite_type,g_current_cite_seen,g_current_cite_item);
777 
778  switch (g_current_cite_type){
779 
780  case CITE_CITE:
781  case CITE_CITE_NP:
782  case CITE_CITE_A:
783  if (strcmp(v,g_last_author_cited)!=0) { /*suppress repeated names */
784  ConvertString(v);
786 
788  fprintRTF(" (");
789  else
790  fprintRTF(", ");
791  }
792 
795  fprintRTF(")");
796  break;
797 
798  case CITE_CITE_AUTHOR:
799  ConvertString(v);
800  break;
801 
802  case CITE_FULL:
803  case CITE_FULL_NP:
804  case CITE_FULL_A:
805  ConvertString(s);
807  fprintRTF(" (");
808  else
809  fprintRTF(", ");
810 
813  fprintRTF(")");
814  break;
815 
816  case CITE_FULL_AUTHOR:
817  ConvertString(s);
818  break;
819 
820  case CITE_SHORT:
821  case CITE_SHORT_NP:
822  case CITE_SHORT_A:
823  case CITE_SHORT_AUTHOR:
824  ConvertString(t);
825  break;
826 
827  case CITE_YEAR:
828  case CITE_YEAR_NP:
830  break;
831 
832  }
833  free(s);
834  free(t);
835  free(year);
836 }
837 
838 void
840 /******************************************************************************
841 purpose: handles apacite stuff
842 ******************************************************************************/
843 {
844  int n;
845  char *s;
846 
847  switch (code) {
848  case 0: fprintRTF("("); break; /* BBOP */
849  case 1: fprintRTF("&"); break; /* BBAA */
850  case 2: fprintRTF("and"); break; /* BBAB */
851  case 3: fprintRTF(", "); break; /* BBAY */
852  case 4: fprintRTF("; "); break; /* BBC */
853  case 5: fprintRTF(", "); break; /* BBN */
854  case 6: fprintRTF(")"); break; /* BBCP */
855  case 7: fprintRTF(""); break; /* BBOQ */
856  case 8: fprintRTF(""); break; /* BBCQ */
857  case 9: fprintRTF(","); break; /* BCBT */
858  case 10: fprintRTF(","); break; /* BCBL */
859  case 11: fprintRTF("et al."); break; /* BOthers */
860  case 12: fprintRTF("in press"); break; /* BIP */
861  case 13: fprintRTF("and"); break; /* BAnd */
862  case 14: fprintRTF("Ed."); break; /* BED */
863  case 15: fprintRTF("Eds."); break; /* BEDS */
864  case 16: fprintRTF("Trans."); break; /* BTRANS */
865  case 17: fprintRTF("Trans."); break; /* BTRANSS */
866  case 18: fprintRTF("Chair"); break; /* BCHAIR */
867  case 19: fprintRTF("Chairs"); break; /* BCHAIRS */
868  case 20: fprintRTF("Vol."); break; /* BVOL */
869  case 21: fprintRTF("Vols."); break; /* BVOLS */
870  case 22: fprintRTF("No."); break; /* BNUM */
871  case 23: fprintRTF("Nos."); break; /* BNUMS */
872  case 24: fprintRTF("ed."); break; /* BEd */
873  case 25: fprintRTF("p."); break; /* BPG */
874  case 26: fprintRTF("pp."); break; /* BPGS */
875  case 27: fprintRTF("Tech. Rep."); break; /* BTR */
876  case 28: fprintRTF("Doctoral dissertation"); break; /* BPhD */
877  case 29: fprintRTF("Unpublished doctoral dissertation"); break; /* BUPhD */
878  case 30: fprintRTF("Master's thesis"); break; /* BMTh */
879  case 31: fprintRTF("Unpublished master's thesis"); break; /* BUMTh */
880  case 32: fprintRTF("Original work published "); break; /* BOWP */
881  case 33: fprintRTF("Reprinted from "); break; /* BREPR */
882  case 34: s=getBraceParam();
883  if (sscanf(s, "%d", &n)==1)
884  fprintRTF("%c", (char) 'a' + n - 1);
885  free(s);
886  break;
887  case 35: fprintRTF("%s", (g_current_cite_paren) ? "&" : "and"); /*BBA*/
888  break;
889  case 36: s=getBraceParam(); /* \AX{entry} */
890  diagnostics(4,"Ignoring \\AX{%s}",s);
891  if (s) free(s);
892  break;
893  default: ;
894  }
895 }
896 
897 void
899 /******************************************************************************
900 purpose: handles \citename from authordate bib style
901 ******************************************************************************/
902 {
903  char *s;
904 
905  diagnostics(4,"Entering CmdCitename", s);
906 
907  s = getBraceParam();
908 
909  if (!g_suppress_name)
910  ConvertString(s);
911 
912  free(s);
913 
914 }
#define strdup
Definition: Utility.h:167
int code
Definition: aftopl.c:52
#define year
Definition: aptex-macros.h:808
#define name
#define text(a)
Definition: aptex-macros.h:925
#define mode
Definition: aptex-macros.h:510
void ConvertBabelName(char *name)
Definition: cfg.c:429
#define n
Definition: t4ht.c:1290
#define MODE_DISPLAYMATH
Definition: convert.h:5
@ pre
Definition: ctie-k.c:71
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define free(a)
Definition: decNumber.cpp:310
int citation
Definition: devnag.c:399
int v
Definition: dviconv.c:10
#define fgets
Definition: xxstdio.h:29
int strcmp()
Definition: coll.cpp:143
int sscanf()
char * strcpy()
struct keys keys[]
int g_left_margin_indent
Definition: funct1.c:53
void CmdVspace(int code)
Definition: funct1.c:169
void CmdEndParagraph(int code)
Definition: funct1.c:146
bool g_processing_list_environment
Definition: funct1.c:62
void CmdStartParagraph(int code)
Definition: funct1.c:65
#define FIRST_PAR
Definition: funct1.h:40
#define VSPACE_SMALL_SKIP
Definition: funct1.h:59
#define VSPACE_MEDIUM_SKIP
Definition: funct1.h:60
#define TITLE_PAR
Definition: funct1.h:42
#define s
Definition: afcover.h:80
#define t
Definition: afcover.h:96
#define c(n)
Definition: gpos-common.c:150
#define strchr
Definition: gsftopk.c:59
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
char * strstr()
void PushEnvironment(int code)
Definition: commands.c:812
void PopEnvironment()
Definition: commands.c:903
#define GENERIC_ENV
Definition: commands.h:15
void ConvertString(char *string)
Definition: convert.c:103
void Convert()
Definition: convert.c:182
int GetTexMode(void)
Definition: convert.c:97
FILE * my_fopen(char *path, char *mode)
Definition: main.c:817
void diagnostics(int level, char *format,...)
Definition: main.c:469
int g_document_bibstyle
Definition: main.c:93
void fprintRTF(char *format,...)
Definition: main.c:722
bool g_aux_file_missing
Definition: main.c:90
bool g_processing_figure
Definition: main.c:82
char * g_aux_name
Definition: main.c:57
bool g_document_type
Definition: main.c:92
bool g_fields_use_REF
Definition: main.c:96
char * g_bbl_name
Definition: main.c:58
#define WARNING__
Definition: main.h:32
bool g_processing_table
Definition: tables.c:58
int PushSource(char *filename, char *string)
Definition: parser.c:139
void PopSource(void)
Definition: parser.c:243
#define snprintf
Definition: snprintf.c:41
int DefaultFontFamily(void)
Definition: l2r_fonts.c:581
int CurrentFontSize(void)
Definition: l2r_fonts.c:665
void ungetTexChar(char c)
char * getBraceParam(void)
char * getBracketParam(void)
char * getDelimitedText(char left, char right, bool raw)
char getNonBlank(void)
void setLength(char *s, int d)
Definition: lengths.c:84
#define target(code, i)
Definition: lpeg.c:1165
@ err
Definition: mtxline.h:24
def ref(x)
Definition: pdf-org.py:104
int r
Definition: ppmqvga.c:68
Definition: inftrees.h:24
Definition: psspecial.c:52
Definition: getopt.h:95
Definition: ttf.h:449
Definition: dvips.h:235
Definition: parser.c:43
struct def_label label[1024]
Definition: t1part.c:286
int number
Definition: t1part.c:207
#define FILE
Definition: t1stdio.h:34
*job_name strlen((char *) job_name) - 4)
#define key
Definition: tex2xindy.c:753
static int braces
Definition: tex2xindy.c:663
str1
Definition: tex4ht.c:2099
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
#define FORMAT_ARTICLE
Definition: preamble.h:1
char * strdup_nocomments(char *s)
Definition: util.c:120
char * strdup_nobadchars(char *text)
Definition: util.c:168
char * strdup_noblanks(char *s)
Definition: util.c:148
@ ON
Definition: ubidiimp.h:55
void CmdBibliography(int code)
Definition: xref.c:205
char * g_label_list[200]
Definition: xref.c:48
void CmdNoCite(int code)
Definition: xref.c:189
static void ConvertNatbib(char *s, int code, char *pre, char *post)
Definition: xref.c:509
void CmdCiteName(int code)
Definition: xref.c:898
void CmdHtml(int code)
Definition: xref.c:728
static char * getAngleParam(void)
Definition: xref.c:474
char * g_equation_label
Definition: xref.c:41
static int ExistsBookmark(char *s)
Definition: xref.c:348
static int citation_used(char *citation)
Definition: xref.c:65
static void RecordBookmark(char *s)
Definition: xref.c:360
int g_suppress_name
Definition: xref.c:43
static int isEmptyName(char *s)
Definition: xref.c:501
void InsertBookmark(char *name, char *text)
Definition: xref.c:372
void CmdIndex(int code)
Definition: xref.c:306
static int g_last_citation
Definition: xref.c:52
void CmdApaCite(int code)
Definition: xref.c:839
void CmdNewblock(int code)
Definition: xref.c:299
static int g_current_cite_item
Definition: xref.c:58
static int g_current_cite_paren
Definition: xref.c:55
int g_label_list_number
Definition: xref.c:49
void set_longnamesfirst(void)
Definition: xref.c:60
void CmdFootNote(int code)
Definition: xref.c:143
char * g_table_label
Definition: xref.c:40
void CmdBibliographyStyle(int code)
Definition: xref.c:198
char * g_figure_label
Definition: xref.c:39
static int g_citation_longnamesfirst
Definition: xref.c:57
static char * popCommaName(char *s)
Definition: xref.c:459
void CmdPrintIndex(int code)
Definition: xref.c:340
static char g_last_author_cited[101]
Definition: xref.c:56
void CmdBCAY(int code)
Definition: xref.c:762
void CmdCite(int code)
Definition: xref.c:586
char * g_section_label
Definition: xref.c:42
static char * ScanAux(char *token, char *reference, int code)
Definition: xref.c:87
static char * g_all_citations[1000]
Definition: xref.c:51
void CmdThebibliography(int code)
Definition: xref.c:225
#define MAX_CITATIONS
Definition: xref.c:46
void CmdLabel(int code)
Definition: xref.c:398
static int g_current_cite_type
Definition: xref.c:53
#define MAX_LABELS
Definition: xref.c:45
void CmdBibitem(int code)
Definition: xref.c:258
static int g_current_cite_seen
Definition: xref.c:54
#define BIBSTYLE_NATBIB
Definition: xref.h:18
#define CITE_T
Definition: xref.h:36
#define CITE_T_STAR
Definition: xref.h:37
#define LABEL_HTMLADDNORMALREF
Definition: xref.h:12
#define CITE_SHORT_NP
Definition: xref.h:26
#define BIBSTYLE_STANDARD
Definition: xref.h:15
#define FOOTNOTE_TEXT
Definition: xref.h:2
#define CITE_ALP
Definition: xref.h:41
#define CITE_AUTHOR_STAR
Definition: xref.h:46
#define CITE_CITE
Definition: xref.h:21
#define CITE_FULL_A
Definition: xref.h:28
#define LABEL_PAGEREF
Definition: xref.h:11
#define CITE_CITE_A
Definition: xref.h:27
#define CITE_P_STAR
Definition: xref.h:39
#define CITE_P
Definition: xref.h:38
#define CITE_SHORT
Definition: xref.h:23
#define BIBSTYLE_AUTHORDATE
Definition: xref.h:19
#define BIBSTYLE_APACITE
Definition: xref.h:17
#define CITE_FULL_NP
Definition: xref.h:25
#define LABEL_REF
Definition: xref.h:7
#define CITE_CITE_AUTHOR
Definition: xref.h:30
#define CITE_FULL
Definition: xref.h:22
#define LABEL_HYPERPAGEREF
Definition: xref.h:10
#define CITE_SHORT_AUTHOR
Definition: xref.h:32
#define LABEL_LABEL
Definition: xref.h:5
#define LABEL_HTMLREF
Definition: xref.h:13
#define CITE_ALP_STAR
Definition: xref.h:43
#define CITE_YEAR_NP
Definition: xref.h:34
#define CITE_YEAR_P
Definition: xref.h:47
#define CITE_YEAR
Definition: xref.h:33
#define FOOTNOTE_THANKS
Definition: xref.h:3
#define CITE_SHORT_A
Definition: xref.h:29
#define CITE_CITE_NP
Definition: xref.h:24
#define CITE_FULL_AUTHOR
Definition: xref.h:31
#define FOOTNOTE
Definition: xref.h:1
#define CITE_AUTHOR
Definition: xref.h:45
#define LABEL_HYPERREF
Definition: xref.h:6
#define BIBSTYLE_APALIKE
Definition: xref.h:16