TeX - LaTeX Asked by Steve Wolfseher on January 19, 2021
I get this error when trying to compile my longtable
caption. Without the caption it all works fine. I also included the after the caption.
!Undefined control sequence.
I tried everything related to find out how to get that error away, however, was not able to solve it. I would really appreciate if you know what to do.
Here is my LaTeX code:
% Preamble
%----------------------------------------------------------------------------------
documentclass[11pt]{article}
% Default Package Setup
usepackage{setspace,graphicx,epstopdf,amsmath,amsfonts,amssymb,amsthm}
usepackage{marginnote,datetime,enumitem,subfigure,rotating,fancyvrb}
usepackage{hyperref,float}
usepackage[longnamesfirst]{natbib}
usepackage{array}
usepackage{booktabs}
usepackage{rotating}
usepackage{tabularx}
usepackage{multirow}
newcolumntype{Y}{>{centeringarraybackslash}X}
usepackage[autostyle]{csquotes}
usepackage{caption}
usepackage{natbib}
captionsetup[table]{belowskip=10pt}
usdate
usepackage{booktabs}
usepackage{longtable}
usepackage{setspace}
usepackage{xltabular}
usepackage{makecell}
usepackage{pdflscape}
% These next lines allow including or excluding different versions of text
% using the package versionPO.sty
% Notes options
usepackage[margin=1in,paperwidth=10in,right=2.5in]{geometry}%
usepackage[textwidth=1.4in,shadow,colorinlistoftodos]{todonotes}%
usepackage[margin=1in]{geometry}%
% Allow todonotes inside footnotes without blowing up LaTeX
% Next command works but now notes can overlap. Instead, we'll
% a special footnote note command that performs this redefinition.
%renewcommand{marginpar}{marginnote}%
% Save original definition of marginpar
letoldmarginparmarginpar
% Workaround for todonotes problem with natbib (To Do list title comes out wrong)
makeatletterletchapter@undefinedmakeatother % Undefine chapter for todonotes
% Define note commands
newcommand{smalltodo}[2][] {todo {begin{spacing}{.5}#2end{spacing}}}
newcommand{rhs}[2][]{smalltodo[color=green!30,#1]{{bf RS:} #2}}
newcommand{rhsnolist}[2][]{smalltodo[nolist,color=green!30,#1]{{bf RS:} #2}}
newcommand{rhsfn}[2][]{% To be used in footnotes (and in floats)
renewcommand{marginpar}{marginnote}%
smalltodo[color=green!30,#1]{{bf RS:} #2}%
renewcommand{marginpar}{oldmarginpar}}
%newcommand{textnote}[1]{ifnotes{{noindentcolor{red}#1}}{}}
newcommand{textnote}[1]{ifnotes{{colorbox{yellow}{{color{red}#1}}}}{}}
% Command to start a new page, starting on odd-numbered page if two side option
% is selected above
newcommand{clearRHS}{clearpagethispagestyle{empty}cleardoublepagethispagestyle{plain}}
% Number paragraphs and subparagraphs and include them in TOC
setcounter{tocdepth}{3}
% RFS-specific includes:
% Use endnotes instead of footnotes
usepackage{endnotes}
% RFS-specific formatting of sections, etc.
captionsetup{labelfont=bf,justification=raggedright,singlelinecheck=false}
newcommand{citeRFS}[1]{citeauthor{#1}~citeyear{#1}}
% Stick footnotes to the end of the page.
usepackage[bottom]{footmisc}
% Define theorem-like commands and a few random function names.
newtheorem{condition}{Condition}
newtheorem{corollary}{Corollary}
newtheorem{proposition}{Proposition}
newtheorem{obs}{Observation}
newcommand{argmax}{mathop{rm arg,max}}
newcommand{sign}{mathop{rm sign}}
newcommand{defeq}{stackrel{rm def}{=}}
% Abbreviations
% Load packages
usepackage[nonumberlist, nopostdot]{glossaries}
setacronymstyle{long-short}
makenoidxglossaries
renewcommandglossaryname{List of Abbreviations and Acronyms}
% Definitions
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
newacronym{mla}{MLA}{Machine Learning Algorithm}
% Special command to define plural forms that not add an S to the singular form.
newacronym[glslongpluralkey={Real Estate Operating Companies}]{reoc}{REOC}{Real Estate Operating Company}
% Appendix
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
begin{document}
appendix
setcounter{secnumdepth}{0}
section{Appendix}
subsection*{A.1quad Definition of Main Variables used in the Study}
label{sec:App1}
begingroup
begin{scriptsize}
begin{spacing}{1}
begin{longtable}{llll}
caption{Overview Variables}
toprule
textbf{begin{tabular}[c]{@{}l@{}}Variable Categoryend{tabular}} & textbf{Variable Name} & textbf{Description} & textbf{Formula} midrule
textit{Assets} & Cash & begin{tabular}[c]{@{}l@{}}The most liquid asset of the firm, used to acquire goods and servicesend{tabular} &
& ShortTermInvestments & begin{tabular}[c]{@{}l@{}}Securities that are expected to be sold within a yearend{tabular} &
& CashAndShortTermInvestments & begin{tabular}[c]{@{}l@{}}The sum of cash and short-term investmentsend{tabular} &
& Receivables & Short-term claims against customers &
& Inventories & begin{tabular}[c]{@{}l@{}}Assets intended to be sold in the ordinary course of businessend{tabular} &
& PropertyPlantEquipment & begin{tabular}[c]{@{}l@{}}Long-term tangible assets used in e.g. production or administrationend{tabular} &
& PrepaidExpenses & begin{tabular}[c]{@{}l@{}}Assets created through advanced payments for goods or services to be received in the futureend{tabular} &
& OtherCurrentAssets & begin{tabular}[c]{@{}l@{}}Other current assets which do not include the items listed above and are converted within a yearend{tabular} &
& CurrentAssets & begin{tabular}[c]{@{}l@{}}Total current assets that are expected to be converted to cash within a yearend{tabular} &
& IntangibleAssets & begin{tabular}[c]{@{}l@{}}Assets that are not physical in nature e.g. Goodwillend{tabular} &
& OtherAssets & begin{tabular}[c]{@{}l@{}}Other assets are a grouping of accounts that have not been listed aboveend{tabular} &
& YoYTotalAssetGrowth & Yearly growth of total assets & begin{tabular}[c]{@{}l@{}}(Total assets current year / Total assets last year) - 1end{tabular} midrule
textit{Liabilities} & OtherCurrentLiabilities & begin{tabular}[c]{@{}l@{}}Claims against the company held by others than suppliersend{tabular} &
& CurrentLiabilities & begin{tabular}[c]{@{}l@{}}Sum of all obligations payable within one yearend{tabular} &
& LongTermDebt & begin{tabular}[c]{@{}l@{}}Long-term financial liability for which payments will be required after one year from initiationend{tabular} &
& OtherLiabilities & begin{tabular}[c]{@{}l@{}}Balance sheet entry used to group together liabilities that are not assigned to common liabilitiesend{tabular} &
& RetainedEarnings & begin{tabular}[c]{@{}l@{}}Retained earnings are the profits earned to date, less dividends paid to investorsend{tabular} &
& OrdinaryStock & begin{tabular}[c]{@{}l@{}}Equity line item that is subordinate to all other types of equityend{tabular} &
& WorkingCapital & begin{tabular}[c]{@{}l@{}}Inidactes the firms efficiency as well as its short-term financial stabilityend{tabular} & begin{tabular}[c]{@{}l@{}}Current assets - Current liabilitiesend{tabular} midrule
textit{begin{tabular}[c]{@{}l@{}}Income Statementend{tabular}} & Revenue & begin{tabular}[c]{@{}l@{}}Income generated from normal business operationsend{tabular} &
& YoYRevenueGrowth & Yearly growth of revenue & begin{tabular}[c]{@{}l@{}}(Revenue current year / Revenue last year) - 1end{tabular}
& CostOfGoodsSold & begin{tabular}[c]{@{}l@{}}Direct costs related to the manufacturing of the goods soldend{tabular} &
& OperatingExpenses & begin{tabular}[c]{@{}l@{}}Sum of the expenses a business incurs through its normal operationsend{tabular} &
& OtherOperatingExpense & begin{tabular}[c]{@{}l@{}}Overhead expenses which do not depend on general operations such as sales or productionend{tabular} &
& StaffExpense & begin{tabular}[c]{@{}l@{}}Expense for employees such as salariesend{tabular} &
& ResearchAndDevelopment & begin{tabular}[c]{@{}l@{}}Includes the cost associated to activities that create or improve products or processesend{tabular} &
& DepreciationAndAmortization & begin{tabular}[c]{@{}l@{}}Non-cash expense of both tangible and intangible assets over timeend{tabular} &
& EBIT & Earnings Before Interests and Taxes &
& EBITMargin & begin{tabular}[c]{@{}l@{}}Percentage of revenue that turned into EBITend{tabular} & EBIT/Revenue
& InterestExpense & begin{tabular}[c]{@{}l@{}}Non-operating expense which represents interest payableend{tabular} &
& PretaxIncome & begin{tabular}[c]{@{}l@{}}Entire income of operations after operating expense, interest and D&A but before taxesend{tabular} &
& IncomeTaxes & Expense paid for taxes &
& NetIncomeorLoss & Profit or loss for the period &
& NonOperatingIncomeorExpense & begin{tabular}[c]{@{}l@{}}Expense or income incurred which does not relate to its main business activitiesend{tabular} & midrule
textit{Cash Flow} & CashFlowInvesting & begin{tabular}[c]{@{}l@{}}Amount of cash generated or used in investing activitiesend{tabular} &
& CashFlowOperating & begin{tabular}[c]{@{}l@{}}Amount of cash generated or used in ongoing regular business activitiesend{tabular} &
& CashFlowFinancing & begin{tabular}[c]{@{}l@{}}Amount of cash generated or used in financing activitiesend{tabular} &
& Dividends & begin{tabular}[c]{@{}l@{}}Portion of earnings paid from company to its shareholdersend{tabular} & midrule
textit{Ratios} & CurrentRatio & begin{tabular}[c]{@{}l@{}}Liquidity measure which shows a company's ability to pay short-term liabilitiesend{tabular} &
& EPS & begin{tabular}[c]{@{}l@{}}Portion of the firm's income which is available to the common stockholdersend{tabular} & begin{tabular}[c]{@{}l@{}}(Net income - Preferred stock dividends) / Common shares outstandingend{tabular}
& EPSExcludingExtraordinaryItems & begin{tabular}[c]{@{}l@{}}EPS but computed with adjusted Income, not taking in account one-time itemsend{tabular} & begin{tabular}[c]{@{}l@{}}(Adjusted net income - Preferred stock dividends) / Common shares outstandingend{tabular}
& TotalAssetTurnover & begin{tabular}[c]{@{}l@{}}Compares sales to assets to measure the efficiency of the firmend{tabular} & Net sales / Total assets
& InventoryTurnover & begin{tabular}[c]{@{}l@{}}Shows number of times that a business sells and replaces its inventory within one yearend{tabular} & COGS / Ending Inventory
& PriceToBookRatio & begin{tabular}[c]{@{}l@{}}Compares market price of the firm's shares to its book value to measure the market's valuation of the stockend{tabular} & begin{tabular}[c]{@{}l@{}}Share price / (Total assets - Intangible assets - Liabilities)end{tabular}
& PriceEarningsRatio & begin{tabular}[c]{@{}l@{}}Shows the multiple of earnings that investors are willing to pay to buy the company's sharesend{tabular} & Share price / Earnings per share
& NetSalesWorkingCapitalRatio & begin{tabular}[c]{@{}l@{}}Measures how efficiently a company is applying its working capital to achieve salesend{tabular} & Net sales / Working capital
& ROE & begin{tabular}[c]{@{}l@{}}Measure used by investors which indicates the company's performanceend{tabular} & begin{tabular}[c]{@{}l@{}}Net Income / Shareholders' equityend{tabular}
& ROA & begin{tabular}[c]{@{}l@{}}Compares the firm's earnings to the total assets and indicated the efficiency of the usage of assetsend{tabular} & After tax profits / Total assets
& InterestCoverage & begin{tabular}[c]{@{}l@{}}Measures a company's ability to pay interest obligations on its outstanding debtend{tabular} & EBIT / Interest expense
& EBITCashRatio & begin{tabular}[c]{@{}l@{}}Measures the relationship of EBIT and cashend{tabular} & EBIT / Cash
& FinancialLeverage & begin{tabular}[c]{@{}l@{}}Measures the ratio of total debt to equityend{tabular} & Total debt / Total equity
& SolvencyRatio & begin{tabular}[c]{@{}l@{}}Measures if the firm's cash flow is sufficient to meet its short- and long-term liabilitiesend{tabular} & begin{tabular}[c]{@{}l@{}}(Net income + depreciation) / (Total liabilities)end{tabular}
& QuickRatio & begin{tabular}[c]{@{}l@{}}Measures the firm's ability to pay off its short-term obligations with liquid assetsend{tabular} & begin{tabular}[c]{@{}l@{}}(Cash + Marketable securities + Receivables) / Current liabilitiesend{tabular}
& DividendYield & begin{tabular}[c]{@{}l@{}}Used by investors to determine their yield by comparingthe dividend paid to the firm's share priceend{tabular} & begin{tabular}[c]{@{}l@{}}Yearly dividend paid / Share priceend{tabular}
& DebtAssetsRatio & begin{tabular}[c]{@{}l@{}}Measures the ratio of total debt to total assetsend{tabular} & Total debt / Total assets
& CashAssetsRatio & begin{tabular}[c]{@{}l@{}}Measures the ratio of cash to total assetsend{tabular} & Cash / Total assets midrule
textit{Macro} & TradeBalance & begin{tabular}[c]{@{}l@{}}Measures the monetary difference between exports and importsend{tabular} & Exports - Imports
textit{} & 10YearSwissGovernmentBondYield & begin{tabular}[c]{@{}l@{}}The yield for the 10-year Swiss goverment bondend{tabular} & midrule
textit{Other} & MarketCapitalization & begin{tabular}[c]{@{}l@{}}The firm's current market value (yearly measured)end{tabular} & begin{tabular}[c]{@{}l@{}}Number of shares outstanding * Current share priceend{tabular}
& MarketBeta & begin{tabular}[c]{@{}l@{}}Measures systematic risk of an individual stock compared to unsystematic risk of the marketend{tabular} & begin{tabular}[c]{@{}l@{}}Covariance (Return stock, Return market) / Variance (Return market)end{tabular}
& Employees & begin{tabular}[c]{@{}l@{}}Number of employees gives an indication of the firm's sizeend{tabular} &
bottomrule
end{longtable}
end{spacing}
end{scriptsize}
endgroup
clearpage
end{document}
Here you see that my column 2 is not top aligned but middle aligned to the description:
The code in your question can be further boiled down to the following MWE:
documentclass[11pt]{article}
usepackage{caption}
usepackage{xltabular}
begin{document}
begin{longtable}{l}
caption{Overview Variables}
text in table
end{longtable}
end{document}
that produces the following error message:
! Undefined control sequence. LT@c@ption ...ndcsname }{#3}LT@captionlistentry{#2}l.10 caption{Overview Variables}
One can get rid of the error message by changing the load order of cpation
and xltabular
and load the latter after the former. With this little change, the MWE becomes compilable.
documentclass[11pt]{article}
usepackage{xltabular}
usepackage{caption}
begin{document}
begin{longtable}{l}
caption{Overview Variables}
text in table
end{longtable}
end{document}
This can of course also be applied to your large example document. Since we already saw that load orders of some packages do in fact matter, you might want to take the opportunity and clean up your preamble. hyperref
should generally (with a few exceptions) be the last package that is loaded. Also, please avoid loading packages more thean just once. Your preamble loads at least natbib
and booktabs
twice.
With the information you currently provided, the error message is not reproducible. Here are however three variants of your table with an improved layout. Probably one of them suits your needs:
documentclass{article}
usepackage{geometry}
usepackage{setspace}
usepackage{longtable}
usepackage{booktabs}
usepackage{xltabular}
usepackage{makecell}
renewcommand{theadfont}{bfseries}
newcolumntype{L}{>{raggedrightarraybackslash}X}
usepackage{pdflscape}
begin{document}
{small
begin{xltabular}{textwidth}{llLL}
caption{Overview Variables}
toprule
thead{Variable Category} & thead{Variable Name} & thead{Description} & thead{Formula} midrule
endfirsthead
toprule
thead{Variable Category} & thead{Variable Name} & thead{Description} & thead{Formula} midrule
endhead
textit{Assets} & Cash & The most liquid asset of the firm, used to acquire goods and services &
& ShortTermInvestments & Securities that are expected to be sold within a year &
& CashAndShortTermInvestments & The sum of cash and short-term investments &
& Receivables & Short-term claims against customers &
& Inventories & Assets intended to be sold in the ordinary course of business &
& PropertyPlantEquipment & Long-term tangible assets used in e.g. production or administration &
& PrepaidExpenses & Assets created through advanced payments for goods or services to be received in the future &
& OtherCurrentAssets & Other current assets which do not include the items listed above and are converted within a year &
& CurrentAssets & Total current assets that are expected to be converted to cash within a year &
& IntangibleAssets & Assets that are not physical in nature e.g. Goodwill &
& OtherAssets & Other assets are a grouping of accounts that have not been listed above &
& YoYTotalAssetGrowth & Yearly growth of total assets & (Total assets current year / Total assets last year) - 1
bottomrule
end{xltabular}}
newpage
{small
begin{xltabular}{textwidth}{@{quadquad}lLL}
caption{Overview Variables}
toprule
Variable Name & Description & Formula midrule
endfirsthead
toprule
Variable Name & Description & Formula midrule
endhead
multicolumn{1}{l}{textit{Assets}}
Cash & The most liquid asset of the firm, used to acquire goods and services & addlinespace
makecell[lt]{ShortTermInvestments} & Securities that are expected to be sold within a year & addlinespace
makecell[lt]{CashAndShortTermInvestments} & The sum of cash and short-term investments & addlinespace
Receivables & Short-term claims against customers & addlinespace
Inventories & Assets intended to be sold in the ordinary course of business & addlinespace
makecell[lt]{PropertyPlantEquipment} & Long-term tangible assets used in e.g. production or administration & addlinespace
PrepaidExpenses & Assets created through advanced payments for goods or services to be received in the future & addlinespace
makecell[lt]{OtherCurrentAssets} & Other current assets which do not include the items listed above and are converted within a year & addlinespace
CurrentAssets & Total current assets that are expected to be converted to cash within a year & addlinespace
IntangibleAssets & Assets that are not physical in nature e.g. Goodwill & addlinespace
OtherAssets & Other assets are a grouping of accounts that have not been listed above & addlinespace
makecell[lt]{YoYTotalAssetGrowth} & Yearly growth of total assets & (Total assets current year / Total assets last year) - 1
bottomrule
end{xltabular}}
newpage
begin{landscape}
small
begin{xltabular}{linewidth}{@{quadquad}lLL}
caption{Overview Variables}
toprule
Variable Name & Description & Formula midrule
endfirsthead
toprule
Variable Name & Description & Formula midrule
endhead
multicolumn{1}{l}{textit{Assets}}
Cash & The most liquid asset of the firm, used to acquire goods and services & addlinespace
makecell[lt]{ShortTermInvestments} & Securities that are expected to be sold within a year & addlinespace
makecell[lt]{CashAndShortTermInvestments} & The sum of cash and short-term investments & addlinespace
Receivables & Short-term claims against customers & addlinespace
Inventories & Assets intended to be sold in the ordinary course of business & addlinespace
makecell[lt]{PropertyPlantEquipment} & Long-term tangible assets used in e.g. production or administration & addlinespace
PrepaidExpenses & Assets created through advanced payments for goods or services to be received in the future & addlinespace
makecell[lt]{OtherCurrentAssets} & Other current assets which do not include the items listed above and are converted within a year & addlinespace
CurrentAssets & Total current assets that are expected to be converted to cash within a year & addlinespace
IntangibleAssets & Assets that are not physical in nature e.g. Goodwill & addlinespace
OtherAssets & Other assets are a grouping of accounts that have not been listed above & addlinespace
makecell[lt]{YoYTotalAssetGrowth} & Yearly growth of total assets & (Total assets current year / Total assets last year) - 1
bottomrule
end{xltabular}
end{landscape}
end{document}
Answered by leandriis on January 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP