1

This question already has an answer here:

I am using some code recommended by the editor of a journal. However, the \renewcommand line for \thesubsection and \thesubsubsection seems to be causing a problem with the cross-referencing function \ref.

When I reference a subsection (e.g., 'II.A') it only displays "A" or a subsubsection (e.g., 'II.A.1') I just get "1".

Is there a way to fix this code so that it properly references the subsections with the section number included.

\documentclass[12pt, titlepage, reqno]{article}

%load packages
\usepackage[margin=1in]{geometry} %overwrites 1.5" default margins   from    article class
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{amssymb,amsmath,amsfonts}% popular packages from the American Mathematical Society
\usepackage{bm}% Bold Math package
\usepackage{array}
\usepackage{color} %colored text
\usepackage{float}
\usepackage{setspace}
\usepackage[super,comma,sort,compress]{natbib}
\usepackage{latexsym}
\usepackage[mathscr]{eucal}
\usepackage{enumerate}
\usepackage{titlesec} %for formatting section titles
%\usepackage{appendix}


%% SECTION TITLE FORMATTING
\renewcommand{\thesection}{\Roman{section}} %numbering
\titleformat{\section}
  {\normalfont \bfseries \raggedright \uppercase}
  {\thesection.} %numbering
  {0.5em}{}

\renewcommand{\thesubsection}{\Alph{subsection}} %numbering
\titleformat{\subsection}
  {\normalfont \bfseries \raggedright}
  {\thesubsection.} %numbering
  {1em}{}

\renewcommand{\thesubsubsection}{\arabic{subsubsection}} %numbering
\titleformat{\subsubsection}
  {\normalfont \bfseries \itshape \raggedright}
  {\thesubsubsection.} %numbering
  {1em}{}

marked as duplicate by touhami, egreg cross-referencing Jul 31 '15 at 17:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I don't see anything there that affects cross references. Please always make a small complete document that demonstrates the problem, so people can reproduce it. – David Carlisle Jul 31 '15 at 16:15
  • Welcome to TeX.SX! Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Ruben Jul 31 '15 at 16:34
  • ... and your example most likely isn't minimal yet. – Ruben Jul 31 '15 at 16:36