由买买提看人间百态

topics

全部话题 - 话题: newcommand
1 2 下页 末页 (共2页)
yy
发帖数: 45
1
I tried to alias a newcommand for verbatim like:
\newcommand{\bev}{\begin{verbatim}}
\newcommand{\eev}{\end{verbatim}}
I don't know why the latex seems not recognize this newcommand at all?
Am I missing something?
Thanks,
t***r
发帖数: 4
2
来自主题: TeX版 - newcommand参数重用?
我想定义一个newcommand,有两个参数,第一个optinal, 第二个必须有
问题是,我想实现:如果没有提供第一个参数,他的值就是第二个参数
but it did not work if I say:
\newcommand[2][#2]{....}
It looks #2 does not work here.
Any idea? Thanks a lot!
h*****0
发帖数: 4889
3
来自主题: TeX版 - newcommand参数重用?
我有个麻烦点的方法,自己弄的,能凑合:
\newcommand{\default}{default}
\newcommand{\cs}[2][\default]{\renewcommand{\default}{#2} first={#1}, second
={#2}}
T*******n
发帖数: 493
4
来自主题: TeX版 - newcommand参数重用?
\documentclass{minimal}
\newcommand*{\mywrappercommand}[2][\undefined]{%
\ifx#1\undefined
\myactualcommand{#2}{#2}%
\else
\myactualcommand{#1}{#2}%
\fi
}
\newcommand*{\myactualcommand}[2]{%
Optional argument = #1; mandatory argument = #2.\par
}
\begin{document}
\verb|\mywrappercommand{abc}:| \mywrappercommand{abc}
\verb|\mywrappercommand[xyz]{abc}:| \mywrappercommand[xyz]{abc}
\end{document}
T*******n
发帖数: 493
5
来自主题: TeX版 - newcommand参数重用?
\undefined is never defined anywhere!
Your method works too, but it relies on the use of a global \default,
which could be prone to side effects. You could make it more robust
by changing \default to have private scope:
\makeatletter
\newcommand{\CS}[2][\@default]{%
\begingroup
\newcommand{\@default}{}%
\renewcommand{\@default}{#2}%
first={#1}, second ={#2}
\endgroup
}
\makeatother
i**a
发帖数: 13
6
如果定义了\newcommand{cmd}[args]{def}
那么在使用这个cmd的时候, 后面def里的newline全都被忽略掉了, 怎么才能force a
newline呢?
谢谢
s*****g
发帖数: 5159
7
来自主题: TeX版 - 怎样 undefine 一个 newcommand
go to the template to algorithm2e, change \newcommand{algorithm} to \
renewcommand{algorithm}
good luck.

already
T*******n
发帖数: 493
8
来自主题: TeX版 - 请问括号大小的问题。
I use a set of macros like these. It's not the best, but it saves
me from having to match \biggl with \biggr. You can rename the
macros to whatever you find easier to use, if you don't like the
big, Big, bigg, Bigg scheme.
\newcommand{\bigp}[1]{\bigl(#1\bigr)}
\newcommand{\bigs}[1]{\bigl[#1\bigr]}
\newcommand{\bigb}[1]{\bigl\{#1\bigr\}}
\newcommand{\biga}[1]{\bigl\langle#1\bigr\rangle}
\newcommand{\bigv}[1]{\bigl|#1\bigr|}
\newcommand{\Bigp}[1]{\Bigl(#1\Bigr)}
\newcommand{\Bigs}[1]{\Bigl[#1\Bi
l****u
发帖数: 4
9
多谢版主提示!
我把class文件删减了一下,以下是可以编译但仍存在问题的部分
问题可能在List of References部分
还请麻烦帮忙看一下,多谢!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Defining Class options and loading required packages %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{ifthen}[1996/08/02 v1.0m Standard LaTeX ifthen package (DPC)]
%% Declaring Options \& Initializing Flags
\newcommand{\QZ@ptsize}{}%%define a null command for font-size
\newcounter{QZ@ptcnt}%%define a ... 阅读全帖
p*l
发帖数: 1359
10
我的模版
\ProvidesPackage{beamerthemeclassnote}
\mode
\setbeamertemplate{caption}[numbered]
\setlength\parindent{28pt}
\setlength{\parskip}{0.75\baselineskip}
\setbeamersize{text margin left=0.5in,text margin right=0.5in}
\setbeamercolor{structure}{fg=black}
\setbeamercolor{palette primary}{fg=black,bg=white}
\setbeamertemplate{section in toc}{\vspace{12pt}\textbf{\inserttocsection}\}
\setbeamertemplate{subsection in toc}{\vspace{12pt}\hspace{18pt}\textbf{\
inserttocsubsectionnumber.}~... 阅读全帖
V*********r
发帖数: 666
11
不要搞太花哨的。单栏,Sans-serif字体,整齐一些就行了。
贴个简单的模板
\documentclass[11pt]{article}
\usepackage[top=1in, bottom=1.2in, left=1in, right=1in]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{marvosym}
\usepackage{verbatim} % for multiline comment blocks
\usepackage{etoolbox}
\usepackage[english]{babel}
\usepackage{setspace} %conflict with \usepackage{needspace}
\usepackage{enumitem}
\renewcommand{\rmdefault}{phv} % Arial
\renewcommand{\sfdefault}{phv} %... 阅读全帖
b**s
发帖数: 67
12
What do you mean? You are not making those manually, are you?
I think the default is pretty good, if you really want to change then
following are what in report.cls, you can modify them accordingly in
your preample inclosed by
\makeatletter
\makeatother
TOC:
\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\newcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}}
\newc
T*******n
发帖数: 493
13
来自主题: TeX版 - underbrace的问题

Actually I usually do this:
save the following four lines in mymath.sty
\newcommand{\bigstrut}[0]{\vphantom{\big|}}
\newcommand{\Bigstrut}[0]{\vphantom{\Big|}}
\newcommand{\biggstrut}[0]{\vphantom{\bigg|}} % used below
\newcommand{\Biggstrut}[0]{\vphantom{\Bigg|}}
\endinput
then
\documentclass{article}
\usepackage{amsmath}
\usepackage{mymath}
\begin{document}
\begin{equation*}
\frac{\partial N\left(x,y,t\right)}{\partial t}
% use \biggstrut in next line, let \underbrace think that [-MN] i
T*******n
发帖数: 493
14
This has nothing to do with Winedt.
You either need to load the .cls/.sty/.bst file that defines these macros,
or
define them yourself:
\newcommand{\journal}[1]{\textsl{#1}}
\newcommand{\sci}[0]{\journal{Science}}
\newcommand{\nat}[0]{\journal{Nature}}
\newcommand{\prb}[0]{\journal{Physical Review B}}

,\
b*******t
发帖数: 33714
15
试试看改第7302行
\newcommand\NAT@open{[} \newcommand\NAT@close{]}
改成
\newcommand\NAT@open{(} \newcommand\NAT@close{)}


cls
T*******n
发帖数: 493
16
\documentclass{article}
\usepackage{amsmath}
\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}
\newcommand{\unit}[1]{\unskip\:\ensuremath{\mathrm{#1}}}
\newcommand{\degree}[0]{\ensuremath{{}^\circ}}
\begin{document}
\begin{equation}
x\overset{\text{not enough space to explain}}{=}y
\end{equation}
\begin{equation}
\chem{H_2O}_{(s)}
\xrightarrow[\text{at $T=0\degree\unit{C}$ and $P=1\unit{atm}$}]
{\Delta H_{\text{melt}}}
\chem{H_2O}_{(l)}
\end{equation}
\end{document}
J*******r
发帖数: 379
17
☆─────────────────────────────────────☆
ddyourself (dd) 于 (Tue Nov 8 13:04:09 2005) 提到:
写出相等的原因
☆─────────────────────────────────────☆
TeXnician (毕升) 于 (Tue Nov 8 20:20:32 2005) 提到:
\documentclass{article}
\usepackage{amsmath}
\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}
\newcommand{\unit}[1]{\unskip\:\ensuremath{\mathrm{#1}}}
\newcommand{\degree}[0]{\ensuremath{{}^\circ}}
\begin{document}
\begin{equation}
x\overset{\text{not enough space to explain}}{=}y
\end{equation}
\begin{eq
T*******n
发帖数: 493
18
\usepackage{array}
\newcolumntype{I}{!{\vrule width 1pt}}
\newcommand*{\Hline}[0]{%
\noalign{\global\setlength{\arrayrulewidth}{1pt}}%
\hline
\noalign{\global\setlength{\arrayrulewidth}{0.4pt}}%
}
\newcommand*{\Cline}[1]{%
\noalign{\global\setlength{\arrayrulewidth}{1pt}}%
\cline{#1}%
\noalign{\global\setlength{\arrayrulewidth}{0.4pt}}%
}
\begin{tabular}{Ic|c|cI}
\Hline
x & x & x \\
\cline{1-1}\Cline{2-2}\cline{3-3}
x & \multicolumn{1}{IcI}{x} & x \\
\cline{1-1}\Cline{2-2}\cline{3-3}
D****y
发帖数: 24
19
来自主题: TeX版 - beamer question
\ve is not used by the package, otherwise, latex will complain with the
\newcommand. However, in my case, there is no errors with the \newcommand.
The error I get is something like:
Runaway argument?
\let \AtEndDocument \@firstofone \@enddocumenthook \@checkend {docume\ETC.
! File ended while scanning use of \beamer@collect@@body.
b*******h
发帖数: 56
20
thank you very much!
我不过我后来还是修改了.cls文件
(\newcommand 不能执行,估计.cls优先权大于\newcommand)
d*****y
发帖数: 140
21
这个问题搞定了
\newcommand{\eqlabel}[1]{\tag{#1}\label{#1}}
这样用\eqlabel instead of \label就行了
这样写的时候可以买pdf/dvi里面看到公式的label,方便我查找
如果要正式成文了就
把上面的那句替换成
\newcommand{\eqlabel}[1]{\label{#1}}
a****9
发帖数: 418
22
试试这个
\newcommand{\qed}{\nobreak \vrule height0.75em width0.5em depth0.25em}
如果说已经有了\qed
就把newcommand改成renewcommand
s*****g
发帖数: 5159
23
I usually make this a macro
\newcommand{\brace{#1}}{\left\{#1\right\}}
\newcommand{\paren{#1}}{\left(#1\right)}
this will pair things up easily.
Long time no show.
He might have missed
\usepack{amsmath,amssymb}
y***a
发帖数: 840
24
Hi,
I am submitting my final thesis (double-spaced) and one of my committee
member suggests me to use single-space for footnotes. It makes sense because
it looks much better. Anybody knows how to do that?
I tried
"\newcommand{\MYFOOT}[1]{\begin{singlespace}\footnote{#1}\end{singlespace}}"
it works but there is a large blank space between the footnote ID number in
the text and the text before it. the footnote ID should appear close to the
text before it.
e.g. if I use "AAAA\MYFOOT{fo
l***y
发帖数: 4671
25
来自主题: Linux版 - 请教一下 Figure S1 (转载)
【 以下文字转载自 TeX 讨论区 】
发信人: lummy (河马·云何), 信区: TeX
标 题: 请教一下 Figure S1
发信站: BBS 未名空间站 (Sun Feb 10 20:36:50 2013, 美东)
在写文章,准备投 PLOS 的一个,除了标准的 Figure 1, Figure 2 之类的以外,还要
求在文章尾把所有 Supporting Information 里的图标的 Caption 也列上,也就是说
Figure S1, Figure S2 这种。找了半天不知道该咋整。肯定不能用 \renewcommand,
否则是不是 Figure 1 啥的就不成了?如果用 \newcommand 该咋写呢?
多谢多谢!
G***G
发帖数: 16778
26
来自主题: Programming版 - wpf: 自定义命令command
在wpf中,我有个问题,为什么我们要自定义command?
比如:点击一个button,弹出一个对话框。
我们可以在系统提供的命令中实现,比如:NEW,HELP, CUT, PASTE, COPY
等。
那如果这样的,可以在设定一个button的command为NEW,
但是在New的执行代码里面,不写输入新文本的,而是让这个NEWcommand
进行别的,比如拷贝文字等。
或者说在new command里面进行一些数据处理。
这样,我们进行数据处理,就不需要自定义command了,用系统自带的NEW就可以了。
那为什么我们还要自定义command呢?
T*******n
发帖数: 493
27
来自主题: TeX版 - 怎么改变reference 的字体
Which IEEE class are you using? ieee.cls or ieeetran.cls or something else?
Normally in LaTeX's article class, you have to change the definition of
\section in order to change the appearance of the "Bibliography" heading, but
changing this will affect how all the section headings are set. If this is
what you want to do (assuming the use of the standard article class), put the
following code before \begin{document}:
\makeatletter
\newcommand\section{\@startsection {section}{1}{\z@}%
T*******n
发帖数: 493
28
来自主题: TeX版 - Footnote in latex
\documentclass{article}
\newcommand{\unnumberedfootnote}[1]{%
\begingroup
\renewcommand{\thefootnote}{\relax}%
\footnotetext{#1}%
\endgroup
}
\begin{document}
Some text.\footnote{Footnote one.}
More text.\unnumberedfootnote{Footnote.}
Lots of text.\footnote{Footnote two.}
\end{document}
T*******n
发帖数: 493
29
来自主题: TeX版 - how to convert latex to txt?
If you have sed (you will on UNIX/Linux), you can create
a sed script (detexceptions.sed) and add to it lines like
s/\$\\mu\$/mu/g
s/\\shortcut/very long full phrase/g
s/\\verb\(.\)\([^\1]*\)\(\1\)/\2/
The first line will convert all $\mu$ into mu so that detex
doesn't throw them away. (detex will still throw away
$\mu_1$, so you might need to change the rule to adapt
to your file.)
The second line is useful if you defined something like
\newcommand{\shortcut}{very long full phrase}
T*******n
发帖数: 493
30
Two solutions:
1. \usepackage{amssymb} and say $\blacksquare$
or \ensuremath{\blacksquare}.
2. \rule[0pt]{1ex}{1ex} creates a black square about
the size of an "x" based on the current font size.
Make 0pt positive to raise the square, negative to
lower it.
If you want to use this in several places, define a
macro such as
\newcommand{\mysquare}[0]{\rule[0pt]{1ex}{1ex}}
and say \mysquare wherever you want it.
T*******n
发帖数: 493
31
Maybe, but neither of us can figure out how to fix it,
and I don't really care to know after wasting all that
time.
One thing I find useful in LaTeX is the use of
macros to define symbols in equations. For example,
I can say \newcommand*{\pressure}[0]{p} and then
use $\pressure$ in equations. This helps me keep
the notation consistent throughout the entire
document, and if I later decide to use a different
symbol for pressure I can just change the above
macro definition (one place) to somethin
t**i
发帖数: 688
32
Now I have been able to define a new command \BackgroundText so that I can
put teh desired text in gray into the background. However, how to have it
automatically written once for every page? Currently, I have to call the
command every time I need it.
\usepackage{color, fancybox}
\definecolor{LightGray}{gray}{0.85}
\newcommand{\BackgroundText}{%
\boxput{\rotatebox{45}{\scalebox{5.5}{%
\textcolor{LightGray}{DRAFT}}}}
}

and
T*******n
发帖数: 493
33
来自主题: TeX版 - 如何自定义INDEX的列数?
Look in the .cls and you should find the definition of an
environment called "theindex". This is where the page
layout of the index is usually defined.
You can try the following, add before \begin{document}:
\usepackage{makeidx}
\usepackage{multicol}
\makeatletter
\newcommand{\startindex}[0]{%
\chapter*{\indexname\@mkboth{\indexname}{\indexname}}%
\addcontentsline{toc}{chapter}{\indexname}%
}
\renewenvironment{theindex}{%
\par
\setlength{\columnseprule}{\z@}%
\setlength{\columnsep}{12
T*******n
发帖数: 493
34
You can't to that.
\begin{verbatim} puts TeX's tokenizer in a special mode
where each charcter becomes a token (instead of commands
like "\whatever" being read in as a single token), and it obeys
spaces and obeys line breaks, and no longer understands the
meaning of other characters. The only way to kick itself out
of this mode is for it to run across the exact token sequence
(string) "\end{verbatim}". So the "\end{verbatim}" isn't really an
end-environment command here, it's a dumb text strin
N**D
发帖数: 10322
35
来自主题: TeX版 - 请教公式
\newcommand{\argmin}[1]{{\hbox{$\underset{#1}{\text{\textnormal{argmin}}}\;$
}}}
h**k
发帖数: 48
36
来自主题: TeX版 - 关于report中header设置问题:

FIRST
CONTINUED:
我用了下面的办法:
在\begin{document}之前重新定义了
\pagestyle{myheadings}
\newcommand{\newchap}[1] % Re-define the chaptering command to use
{ % THESE headers.
\chapter{#1}
\markboth{Chapter \thechapter. {#1}\hfill \hfill}{Chapter
\thechapter. {#1}\hfill \hfill}
}
并将以前的\chapter全改为\newchap,结果header字体变小了不在顶出业面,,但是
bibliography中的header却自动变成了最后一章的header而不是以前的bibliography.
应该怎么办? 谢谢
T*******n
发帖数: 493
37
\documentclass{article}
\newcommand{\mc}[0]{\multicolumn}
\begin{document}
A vertical line belongs to the column to its left, except that the
left most vertical line belongs to the first column, so the first
column controls two vertical lines. You can then use
\verb|\multicolumn{}{}{}| to change things.
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
x & y & z \\ \hline
\mc{1}{c|}{x} & y & z \\ \hline
\mc{1}{|c}{x} & y &
t***r
发帖数: 4
38
来自主题: TeX版 - newcommand参数重用?
I will try your solution. Thanks a lot!

second
h*****0
发帖数: 4889
39
来自主题: TeX版 - newcommand参数重用?
\undefined是自己定义的还是原来就有的?
似乎好像比我的还要麻烦一点……
h*****0
发帖数: 4889
40
来自主题: TeX版 - newcommand参数重用?
nice!
我原本是想找个“局部”变量的,但是不会。这些东西从哪可以学到?
h*****0
发帖数: 4889
41
来自主题: TeX版 - newcommand参数重用?
\undefined是一个“值”对吗?
T*******n
发帖数: 493
42
来自主题: TeX版 - newcommand参数重用?
It has no value, but it has special properties as explained in the TeXbook.
T*******n
发帖数: 493
43
来自主题: TeX版 - 请问如何生成这样的矩阵
\documentclass{article}
\usepackage{amsmath}
\makeatletter % required because of the use of \@tempdima
\newcommand*{\toplabel}[4]{%
\settowidth{\@tempdima}{\ensuremath{#1}}%
\makebox[\@tempdima][c]{%
\hss
\ensuremath{%
\makebox[0pt][r]{\ensuremath{\scriptstyle#2}}%
\scriptstyle{#3}%
\makebox[0pt][l]{\ensuremath{\scriptstyle#4}}%
}%
\hss
}%
}
\makeatother
\begin{document}
Here is one way of doing this.
\begin{equation}
%
\begin{array}{r} % matrix of q and q
D****y
发帖数: 24
44
来自主题: TeX版 - beamer question
I met a strange problem when use beamer under MikTex
I tried to give \end{frame} an alias by doing
\newcommand{\ve}{\end{frame}}
However, I always get latex compile errors if I use \ve to end a frame. If I
relace \ve with \end{frame} in my file, everything works fine.
Anyone met similar problem? Is this a bug in MikTex or beamer? I haven't
tried it under TexLive yet.
t**g
发帖数: 1164
45
在文本模式下可以
在数学模式下,如果有'符号,文件依然可以编译通过(不会停止),
可是生成的dvi文件内容就只有到该'符号为止(或者还不到)
而删掉所有出现'的地方就可以完整编译
可是我不明白为什么'在数学模式下用不了?
我查了一下/newcommand的设置,好像没有什么跟'相关的啊
当然我知道把'用/p代替就可以解决问题,
可是我还是想知道为啥'在数学模式下用不了(而在文本模式中就好好的)
c*******h
发帖数: 1096
46
来自主题: TeX版 - 问个自定义符号的文问题
\newlength{\wdo}
\newcommand{\checkline}[1]{\check{#1}%
{\settowidth{\wdo}{$\overline{#1}$}\kern-\wdo}%
\overline{\phantom{#1}}}
s***a
发帖数: 1676
47
来自主题: TeX版 - bibtex help
\newcommand{\gt}{>}
这样也不行嘛?
l*********t
发帖数: 165
48
来自主题: TeX版 - 标题无法居中
\newcommand{\makeheading}[1]%
{\hspace*{-\marginparsep minus \marginparwidth}%
\begin{minipage}[t]{\textwidth+\marginparwidth+\marginparsep}%
{\large \bfseries #1}\\[-0.15\baselineskip]%
\rule{\columnwidth}{1pt}%
\end{minipage}}
............
\makeheading{\center\Large Chapter}
这是个模版来的,就是在chapter 下加了一个下划线,长度可变的,
\center 命令就不起作用了,
要怎么办才能把"chapter" 居中呢?
谢谢
G****A
发帖数: 4160
49
来自主题: TeX版 - 格式问题求教
不知道怎么搞得,页面左边的margin总是明显小于右边。我把握用的package列出来,
请高手帮忙看看,多谢!
********************************************
\documentclass[conference]{IEEEtran}
\usepackage[]{algorithm2e}
\usepackage{latexsym,psfig,url}
\usepackage{amssymb}
\usepackage{multirow}
\usepackage{subfigmat}
\usepackage{pifont,comment}
\usepackage{cite,balance}
\pagestyle{plain}
\usepackage{float}
\usepackage{subfloat}
\newcommand{\excluded}[1]{}
\newtheorem{definition}{Definition}
\newtheorem{proposition}{Proposition}
\newtheorem{theorem}{
g*********r
发帖数: 124
50
来自主题: TeX版 - \xleftrightarrow?
\usepackage{amsmath}
\makeatletter
\def\ExtendSymbol#1#2#3#4#5{\ext@arrow 0099{\arrowfill@#1#2#3}{#4}{#5}}
\makeatother
\newcommand\myArrow[2][]{\ExtendSymbol{\leftarrow}{-}{\rightarrow}{#1}{#2}}
$A\myArrow[A^2=B^2]{A^2=A^2+B^2+C^2}B $

\
1 2 下页 末页 (共2页)