Any table I define with "sidewaystable" appears at the last page of created pdf file. How can I solve this?
\begin{sidewaystable}[h]
\caption{Blah Measurements}
\centering % centering table
\begin{tabular}{c c c c c c c c c c}
\hline\hline % inserting double-line
A & B & \multicolumn{3}{c}{C} & C Time + & D & \multicolumn{3}{c}{D Signal} \\
ID & ID & \multicolumn{3}{c}{Coordinates} & Time Diff. & Time & \multicolumn{3}{c}{Parameters} \\ [0.5ex]
\hline % inserts single-line
1 & 1 & 4415633.126837 & 482211.909079 & 939.450000 & 06:07:40 & 06:07:40 & -85 dBm & 6 dB & 5 dBm \\
\hline
\end{tabular}
\label{tab:combined}
\end{sidewaystable}
Have you tried the something like htbp for the placement of the float object?
\begin{sidewaystable}[htbp]
...
\end{sidewaystable}
Just use \clearpage \newpage before \begin{sidewaystable} and \clearpage after the \end{sidewaystable}..
It works without any floats like H, h!, htpb, etc.
you can try and use \begin{table}[h!] -- the ! will try and tell latex to force your table into the exact spot. I've had hit or miss results.
Also, with the float package, you can use a capital H \begin{table}[H] to keep your table from floating.
Related
I have an equation written in a rst file as:
.. math::
F=\begin{bmatrix} \lambda_1 & 0 & 0\\0 & \lambda_2 & 0\\0 & 0 & \lambda_3\end{bmatrix}
:label: eq:6
It is shown perfectly as:
Now I want to refer to this equation in the same rst file. I tried somwthing like:
I need to refer to this :ref:`Link title < eq:6>`
However it did not work. How can I link (e.g. refer) to this equation?
You have mismatched indentation for your math role, an incorrect role option of label instead of name, incorrect ordering of role and its content, and an extra space after the < in your link reference.
The following works for me.
.. math::
:name: eq:6
F=\begin{bmatrix} \lambda_1 & 0 & 0\\0 & \lambda_2 & 0\\0 & 0 & \lambda_3\end{bmatrix}
I need to refer to this :ref:`Link title <eq:6>`
There is another reference to :math:numref:, but I do not think that is what you want. There is also the use of ref where one can use a label as the target of the ref.
I am trying to produce financial statements with latex. An important convention of financial statements is that negative numbers are not presented with a negative sign, rather wrapped in parentheses, like this:
-100 -> (100)
The minimum necessary recreation of my issue is as follows:
\documentclass{report}
\usepackage{tabularx}
\usepackage{spreadtab}
\usepackage{numprint}
\npthousandsep{,}
\begin{document}
\begin{center}
\STautoround{0}
\begin{spreadtab}{{tabularx}{\linewidth}{XN{7}{0}N{7}{0}}}
#\multicolumn{3}{c}{\uppercase{Municipal Government}}\\
#\multicolumn{3}{c}{Statement of Net Position}\\
#\multicolumn{3}{c}{December 31, 2019}\\
&& \\
#\multicolumn{1}{c}{\uppercase{Assets}} & #\multicolumn{1}{c}{2019} & #\multicolumn{1}{c}{2018}\\
#\multicolumn{1}{c}{Current Assets}&&\\
# Cash & 12345 & 54321\\
# Receivables:&&\\
# \hspace{0.25in}Sewer Fees: & 12345 & 54321\\ \cline{2-3}
#\multicolumn{1}{r}{Total Current Assets} & sum(b7:[0,-1]) & sum(c7:[0,-1])\\ % r10
#\multicolumn{1}{c}{\uppercase{Fixed Assets}}&&\\
# Land & 12345 & 54321\\
# Garage & 99247 & 54321\\
# Equipment & 12345 & 54321\\
# Lagoon and Related & 12345 & 54321\\ \cline{2-3}
#\multicolumn{1}{r}{Total Fixed Assets} & sum(b12:[0,-1]) & sum(c12:[0,-1])\\ \cline{2-3} % r15
# Accumulated Depreciation & -12345 & -54321\\ \cline{2-3}
#\multicolumn{1}{r}{Net Fixed Assets} & sum(b16:[0,-1]) & sum(c16:[0,-1])\\ \cline{2-3}
#\multicolumn{1}{r}{Total Assets} & b18+b10 & c18+c10\\ \cline{2-3} \cline{2-3}
\end{spreadtab}
\end{center}
\end{document}
Where rather than Accumulated Depreciation -12345 -54321, it reads Accumulated Depreciation (12345) (54321).
I have found scant little information about it online, and I'm not entirely certain it's possible to do.
If at all possible, I would like to retain the decimal alignment while adding the parentheses. But again, I'm not sure it's possible.
A solution, below, was shared on StackOverflow several years ago, but it concludes in several errors which I am unsure how to move beyond: primarily the compiler complaining about dozens of "missing" or "extra" brackets.
\makeatletter
\renewcommand\STprintnum[1]{\FPifneg{#1}(\#gobble#1)\else#1\fi}
\makeatother
Update: Per the below answer, using SIunitx permits wrapping negative numbers in brackets, but this breaks the decimal alignment. A minimum working example of this is as follows:
\documentclass{report}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{spreadtab}
\sisetup{group-separator = {,}}
\sisetup{bracket-negative-numbers = true}
\begin{document}
\begin{spreadtab}{{tabularx}{\linewidth}{XS[table-format=7.1]S[table-format=7.1]}}
# Fixed Assets & 123456.1 & 135791.1\\
# {Accumulated Depreciation} &-100000.1 &-90000.1\\ \cline{2-3}
#\multicolumn{1}{r}{Net Fixed Assets} & sum(b1:[0,-1]) & sum(c1:[0,-1])\\ \cline{2-3}
\end{spreadtab}
\end{document}
In the above example, the negative numbers are now offset in their alignment by the left and right parenthesis, so they cease to line up with the positive numbers.
I am trying to insert vertical and horizontal lines inside a matrix to divide it into 4 sections. I would like my matrix to look matrix 4.7 in Matrix Population Models by Dr. Caswell.
Please see my try below. How do I improve the code? Thanks a lot in advance.
$$A_{m,4} =
\begin{pmatrix}
a_{1,1} & a_{1,2} | & a_{1,3} & a_{1,n} \\
a_{2,1} & a_{2,2} | & a_{2,3} & a_{2,4} \\
----- | ----\\
a_{m,1} & a_{m,2} & a_{m,3} & a_{m,4}
\end{pmatrix}$$
You can use the following latex code in your RMD file:
$$A_{m,4} =
\left(
\begin{array}{cc|cc}
a_{1,1} & a_{1,2} & a_{1,3} & a_{1,n} \\
a_{2,1} & a_{2,2} & a_{2,3} & a_{2,4} \\
\hline
a_{m,1} & a_{m,2} & a_{m,3} & a_{m,4}
\end{array} \right)$$
The result:
I have a matrix of values (very non-standard summary statistics) that I want to pass from Stata to LaTeX. The command:
esttab matrix(matname) using $myfilename.tex, replace booktabs f
gives the matrix in LaTeX form but also gives the title of the matrix within the fragment. The same is true for:
outtable using myfilename, mat(matname) replace nobox
Currently, every time I rerun my Stata do file I have to go and edit myfilename.tex by hand.
Is there any way to non-manually remove the matrix name from the Stata to LaTeX output?
I tried using the option noheader, which works here:
matrix list matname, noheader
but doesn't seem to be active in esttab or outtable. It also occurred to me that if I could find a way to ask LaTex to just \input PART of the fragment file (lines 2 onward) that would work...
I think the nomtitles option will work. Here's reproducible example:
sysuse auto
reg price trunk headroom
matrix myMat = e(V)
esttab matrix(myMat) using temp.tex, replace booktabs f nomtitles
This produces the text (.tex) file below:
& trunk& headroom& \_cons\\
\midrule
trunk & 10557.96& -35339.31& -39464.18\\
headroom & -35339.31& 269901.5& -321726.7\\
\_cons & -39464.18& -321726.7& 1612951\\
Also, I used the following outtable command
outtable using "./temp", mat(myMat) replace center f(%9.2f) nobox
to produce this output:
% matrix: myMat file: ./temp.tex 10 Jun 2016 12:55:35
\begin{table}[htbp]
\begin{tabular}{lccc} \hline \hline
& trunk & headroom & cons \\ \hline
trunk & 10557.96 \\
headroom & -35339.31 & 269901.52 \\
cons & -39464.18 & -3.22e+05 & 1.61e+06 \\
\hline \hline \end{tabular}
\end{table}
While the matrix name is present in the output, it is commented out and so will not appear in the latex document.
Here is the LaTeX code for my table:
\begin{table}{| c || c | c | c || c | c | c | }
\caption{Examples of the concepts. \label{tab:conceptsimgs}}\\
\hline
\backslashbox{Concept}{Class} &\multicolumn{3}{|c||}{Negative Class} & \multicolumn{3}{|c|}{Positive Class} \\
\hline
\forloop{themenumber}{1}{\value{themenumber} < 4}{
%\hline
\arabic{themenumber}
\forloop{classnumber}{0}{\value{classnumber} < 2}{
\forloop{imagenumber}{1}{\value{imagenumber} < 4}{
& 0
}
}
\\
\hline
}
\end{table}
Something is wrong in the result however. There is some extra thing at the end of the table, as shown in here:
http://www. freeimagehosting. net/image.php?c702bfc838.png
How can I fix it?
That's a nasty one. I've created a minimal example that demonstrates the problem, see below. Try to compile this and take a look at the results.
The point is, you seem to be out of luck — tabular does not like the output of forloop, it cannot disregard the last \addtocounter command. Maybe you can find some other package for loops.
You should be able to figure out the rest from the code below, if not, write a comment.
\documentclass{article}
\usepackage{forloop}
\newcounter{themenumber}
\newcounter{test}
\begin{document}
% this is your table (minimal example)
\begin{tabular}{| c |}
\forloop{themenumber}{1}{\value{themenumber} < 2}{x\\ \hline}
\end{tabular}
\vspace{2cm}
% this is what you wanted to have
\begin{tabular}{| c |}
x \\ \hline
\end{tabular}
\vspace{2cm}
% this is what forloop produces
\begin{tabular}{| c |}
x \\ \hline \addtocounter{test}{1}
\end{tabular}
\end{document}